0

I have something like this

(map (lambda (l) (apply + l)) '('(1 2) '(3 4)))

I expect '(3 7), however I get an error saying that the applied function gets applied to a quote. Why does this happen?

21rw
  • 1,016
  • 1
  • 12
  • 26
  • 1
    When I was a beginner in racket I did have this issue, so it is useful for newcomers to racket. Don't know why it was downvoted :/ – Lazerbeak12345 Sep 21 '20 at 16:43

1 Answers1

3

The list I had was equivalent to

(list (quote (list 1 2)) (quote (list 3 4)))

and not

(list (list 1 2) (list 3 4))

The list was malformed. For the difference between list and quote see this post: What is the difference between quote and list?.

A proper way to do nested loop is like '((1 2) (3 4)).

21rw
  • 1,016
  • 1
  • 12
  • 26