Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

the whole point of the "code is data" mantra is that it is both - the list `(1 2 3)` and the lisp code that evaluates to said list when parsed and interpreted.


wouldn't the data version be '(1 2 3) ? sorry I am just trying to understand


Usually yes. To distinguish between lists and function calls. However if we are to pass code literals to eval, we need to quote them:

    =>(eval '(1 2 3))
    Cannot call 1 as a function.
    =>(eval ''(1 2 3))
    (1 2 3)


You're basically asking if literals are code. I imagine you'll get varied opinions about that.

(And yes, that can be used unquoted in a few different contexts in Lisp, such as a special form or macro, or if you've managed to convince the reader that 1 is a function.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: