Migrating from APL2 to Dyalog

How to move APL code to Dyalog

Migrating from APL2 to Dyalog

Postby rex on Wed Jul 26, 2023 9:35 pm

I wrote an article about this for Vector back in 1996.
So it's old, but I bet much of it is still relevant today.
https://www.rexswain.com/vector.pdf
rex
 
Posts: 12
Joined: Sat Jun 10, 2023 10:49 pm

Re: Migrating from APL2 to Dyalog

Postby Adam|Dyalog on Mon Jul 31, 2023 3:23 pm

From a quick read-through, it appears that many of the most severe issues have gone away over the years, or have viable work-arounds:
  1. There's no need to search for ⎕NC of the left argument to selectively insert braces around the left argument; just insert braces everywhere. Any monadic use of a strictly dyadic function would VALUE ERROR upon first usage of the left argument, just as APL2 would.
  2. While it is hard to identify uses of / as replicate vs reduce, a viable solution is to replace all instances with {⍺⍺/⍵} or {⍺⍺/[k]⍵} when used with an axis.
  3. You should probably use the Unicode version of Dyalog, which handles ⌻ ⍂ ⍸ ∵
  4. You can sink with {}
  5. (1 0 1/M[;4])←0 and (A⊃B)[I]←X work fine now.
  6. ,/⍳0 now returns ⊂⍳0 just like APL2.
  7. ⎕DL now handles fractional seconds.
  8. (X Y)←⊂'ABC' now behaves like APL2
  9. You can write your own ¨ that has APL2-like behaviour as Each←{⍺←⊢ ⋄ 0∊⍴¨⍺ ⍵ ⍵:⍺⊢¨⍵ ⋄ ⍺ ⍺⍺¨⍵} but note that it doesn't use the special fill function that corresponds to the operand.
  10. Dyalog now has ⌷.
  11. And n-wise reduction.
  12. And scalar function axis.
  13. And ⎕UCS
  14. )RESET does now allow an argument
User avatar
Adam|Dyalog
 
Posts: 143
Joined: Thu Jun 25, 2015 1:13 pm


Return to Migrating from other Systems

Who is online

Users browsing this forum: No registered users and 1 guest