Task

Take a combined set of elements and apply a function to each element.




      DIM a(4)
      a() = 1, 2, 3, 4, 5
      PROCmap(a(), FNsqrt())
      FOR i = 0 TO 4
        PRINT a(i)
      NEXT
      END
 
      DEF FNsqrt(n) = SQR(n)
 
      DEF PROCmap(array(), RETURN func%)
      LOCAL I%
      FOR I% = 0 TO DIM(array(),1)
        array(I%) = FN(^func%)(array(I%))
      NEXT
      ENDPROC
 