Arc Forumnew | comments | leaders | submitlogin
Mapa-b
2 points by pingi 5372 days ago | 5 comments
sure, I'm not telling anybody anything new, but I find it so essential ...

  (def mapa-b (f a b (o st 1))
       (accum acc
              (while (<= a b) (acc (f a)) (++ a st))))

  (def map0-n (f n) (mapa-b f 0 n))
  (def map1-n (f n) (mapa-b f 1 n))
use: (mapa-b idfn 10 20), (map0-n [cos (* 0.31415 _)] 10)

have fun. pingi.



2 points by absz 5372 days ago | link

Given the paucity of documentation, you many not have seen it, but you can also use Arc's built-in range function:

  (def mapa-b (f m n (o d 1))
    (map f (range m n d)))

-----

2 points by kens 5370 days ago | link

There's documentation at: http://arcfn.com/doc/list.html#range

-----

2 points by absz 5370 days ago | link

Yes, and you are an awesome person for doing that. However, I don't think anything "official" links to arcfn.com, so finding it is a bit difficult. And of course you haven't documented every single one of the bajillion little changes on Anarki, because you are a human being and need sleep.

Nevertheless, (isa "http://arcfn.com/doc/ 'awesome-thing).

-----

2 points by fallintothis 5372 days ago | link

Though in vanilla Arc

  arc> (sig 'range)
  (start end)

-----

2 points by pingi 5372 days ago | link

you're right, I haven't noticed it; thx.

-----