Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10.2.7 Exercise 1.4 #4

Open
nelmil opened this issue Feb 16, 2015 · 4 comments
Open

10.2.7 Exercise 1.4 #4

nelmil opened this issue Feb 16, 2015 · 4 comments

Comments

@nelmil
Copy link

nelmil commented Feb 16, 2015

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
Copy link

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:

  • #' is used to make a function reference as in #'+/2 , #'lists:foldl/3
  • #( ... ) for a literal tuple
  • #b( ... ) for a literal tuple

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

@nelmil
Copy link
Author

nelmil commented Feb 16, 2015

Thank you for the explanation.

@oubiwann
Copy link
Contributor

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

@oubiwann
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants