cnbbooks / lfe-sicp

SICP, the LFE Edition
https://cnbbooks.github.io/lfe-sicp
125 stars 19 forks source link

10.2.7 Exercise 1.4 #4

Open nelmil opened 9 years ago

nelmil commented 9 years ago

In the exercise funcall is mentioned once before but never with the code #'+/2

(defun a-plus-abs-b (a b)
  (funcall (if (> b 0)
                   #'+/2
                   #'-/2)
               a b)))

So I'm assuming that # is some type of way of referencing the quoted function.

What exactly does the # do? I tried looking through the reference but it's hard to search for just #

rvirding commented 9 years ago

I can answer the question about # from an LFE point of view. It is a prefix character and always used in conjunction with following characters, for example:

If we ever get read macros they will most likely be done through # plus following characters

nelmil commented 9 years ago

Thank you for the explanation.

oubiwann commented 9 years ago

Thanks, @rvirding! I'll add a footnote to that exercise with Robert's explanation.

oubiwann commented 9 years ago

Hrm, actually -- in accord with my comment on the other ticket, I'm just going to leave this out for now. A question here or on the mail list is very appropriate (as it mirrors the TA experience one would have in an course using SICP as the textbook).

I'll keep the ticket open for now, in case we change our minds about this.