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

The ' (quote) symbol is not well defined #19

Closed
shlomifruchter opened this issue May 18, 2014 · 2 comments
Closed

The ' (quote) symbol is not well defined #19

shlomifruchter opened this issue May 18, 2014 · 2 comments

Comments

@shlomifruchter
Copy link

I went through the tutorial and it is great!

However, I think the handling of the quote symbol can be better explained. 'quote' is defined as follows in part 2:

quote takes one argument which is returned directly (without being evaluated).

So it is expected that "quote (1 2 3)" should be evaluated to "(1 2 3)".

On the other hand, according to test 6:

assert_equals([1, 2, 3, True], evaluate(parse("'(1 2 3 #t)"), Environment()))

As far as I understand, ' is a shorthand for quote, so it should be evaluated to "(1 2 3 #t)"

@kvalle
Copy link
Owner

kvalle commented May 19, 2014

You're right that (quote (1 2 3)) should evaluate to (1 2 3). As for the test, parse("'(1 2 3 #t)") should indeed evaluate to (1 2 3 #t) as you suggest. The [1, 2, 3, True] expected by the test is the abstract syntax tree form of this expression.

I've updated the test from

assert_equals([1, 2, 3, True], 
              evaluate(parse("'(1 2 3 #t)"), Environment()))

to

assert_equals(parse("(1 2 3 #t)"), 
              evaluate(parse("'(1 2 3 #t)"), Environment()))

in order to be more explicit, although the meaning of the test is unchanged.

Does this answer your question, or have I missunderstood something?

@kvalle
Copy link
Owner

kvalle commented Nov 13, 2014

Still no response; Consider this closed :)

@kvalle kvalle closed this as completed Nov 13, 2014
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

2 participants