Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by sago on Sunday July 15, 2018 @02:39PM
(#17536403)
I don't know Arc, so this confuses me:
What is the logic here? Is l made into a function that holds state and returns each element in turn (like an iterator function)? Because I would've expected:
In what way is map being applied here?
[ Parent
| on HN ]
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by sago on Sunday July 15, 2018 @03:11PM
(#17536526)
After RTFM, I can answer my own question:
> In Arc, data structures can be used wherever functions are, and they behave as functions from indices to whatever's stored there.
(quoted from the Arc tutorial)
So
arc> (l 0)
1
and so on. So the GP makes sense.
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by dmead on Sunday July 15, 2018 @05:11PM
(#17537104)
that's confusing as hell. there's a reason this didn't take off (Besides the competition from clojure)
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by etatoby on Sunday July 15, 2018 @06:59PM
(#17537571)
I don't like the Arc language because it's dynamically typed and thus inherently unsafe (see other threads for this sort of discussion.)
But I like this particular feature. If you think about it, an array is a mathematical function, or map, from indices to values. So it makes sense to be able to apply it to indices to get the respective values.
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by DavidSJ on Sunday July 15, 2018 @07:36PM
(#17537726)
In that sense, map just composes its two arguments.
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by JadeNB on Sunday July 15, 2018 @08:39PM
(#17537938)
That's cool! I'm a mathematician and so inclined to (over-)abstract programming, but it had never occurred to me to think of it that way.
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by sova on Monday July 16, 2018 @04:54PM
(#17545011)
Learn you a lisp for great justice
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by quadcore on Sunday July 15, 2018 @05:45PM
(#17537273)
It's kinda cool to be able to write (myarray i).
Re:Anarki – Community-managed fork of the Arc dialect of Lisp
by ScottBurson on Sunday July 15, 2018 @03:13PM
(#17536539)
I think the list '(0 1 2) is behaving like the function — in CL syntax, sorry, I don't know Arc — (lambda (x) (elt '(0 1 2) x)). That is, the list is being treated as a sequence, which is a function from each index to the corresponding element.