In Ruby, you can achieve the equivalent of 10×⍳2+5
in APL using the following code:
main.rb32 chars2 lines
Explanation:
(0..(2+5-1))
creates a range from 0 to 6 (2+5-1)..map
iterates over the range and applies the provided block to each element.i * 10
multiplies each element in the range by 10.Thus, the result will be [0, 10, 20, 30, 40, 50]
, just like in APL.
gistlibby LogSnag