Page 1 of 1

Migrating from APL2 to Dyalog

Posted: Wed Jul 26, 2023 9:35 pm
by rex
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

Re: Migrating from APL2 to Dyalog

Posted: Mon Jul 31, 2023 3:23 pm
by Adam|Dyalog
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)←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