Arc Forumnew | comments | leaders | submitlogin
Map + question
2 points by ChristophRe 4370 days ago | 3 comments
Hallo!

I have a question about adding to lists together.

  (map + '(1 2 3) '(3 2 1)) 
works fine, but I have a list of lists like

  (= ll '((1 2 3) '(3 2 1))

  (map + ll) ; <- does not work it clear
but how could I transform it into this form

  (map + '(1 2 3) '(3 2 1))
thank you for help


3 points by Pauan 4370 days ago | link

Use apply:

  (= ll '((1 2 3) (3 2 1)))

  (apply map + ll)
These two are the same:

  (+ 1 2 3)
  (apply + '(1 2 3))

-----

2 points by ChristophRe 4370 days ago | link

Thank you, Pauan.

Ok. I did the mistake (missed to take the apply) not to apply it.

No it is clear. I learned from this mistakes.

Do you the word "mis-take

-----

3 points by rocketnia 4370 days ago | link

"Do you the word "mis-take"

I don't know exactly what you're asking for, but I'll try to help you. :)

---

Thank you, Pauan.

Ok. I made a mistake not to call apply.

Now it is clear. I learned from this mistake.

---

The phrase "apply it" is confusing because we sometimes say "apply a function (to some arguments)" even when we're not calling apply.

As a verb, "to mistake something (for something else)" means "to misunderstand something (thinking it's something else instead)." As a noun, "a mistake" is an accidental occurrence. The idiom "to make a mistake" means to cause an occurrence by accident.

The word "mistake" isn't usually broken up into "mis-" ("incorrectly") and "take" ("understand").

-----