Hacker News new | ask | show | jobs
by jlarocco 2896 days ago
No offense, but I found your example code really confusing.

For the benefit of people familiar with Common Lisp:

  * (= ...) is assignment, not equality testing
  * (map list index-list) is equivalent to (loop for index in index-list collecting (nth index list)), or in a more FP style (mapcar (rcurry #'nth list) index-list)
  * (map function list) is equivalent to (mapcar function list)
I think your example would have been less confusing if it used larger numbers to highlight where addition was happening and where indexing was happening:

  arc> (= l '(4 5 6))
  (4 5 6)
  arc> (= f [+ _ 10])
  #<fn: f>
  arc> (map l '(2 1 0 0))
  (6 5 4 4)
  arc> (map f '(0 1 2))
  (10 11 12)
1 comments

Thank you the map <list> makes more sense now.

And looks like an easy trap for misreading code ...