Search
Monday, 8th of August 2022, 5:21:01 UTC
17:05:35
rendar
case (Symbol("eval"), *args): return eval_(eval_(*args, env), env)
17:05:42
rendar
this is how i implement (eval ..)
17:06:19
rendar
basically i need 2 nested internal evals to implement it
17:08:17
pjb
rendar: read http://informatimago.free.fr/i/develop/lisp/com/informatimago/small-cl-pgms/aim-8/aim-8.html
17:08:38
pjb
rendar: and then, read: Lisp in Small Pieces http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/LiSP.html http://pagesperso-systeme.lip6.fr/Christian.Queinnec/Books/LiSP-2ndEdition-2006Dec11.tgz
17:09:46
rendar
pjb, i've bought that book
17:09:54
rendar
but seems quite bit advanced for now
17:11:05
pjb
http://informatimago.free.fr/i/develop/lisp/com/informatimago/small-cl-pgms/aim-8/aim-8.lisp
17:12:50
rendar
pjb, ok, but why that eval is wrong? it works..
17:13:54
sham1
You shouldn't need to eval a thing twice
17:15:08
White_Flame
the thing you eval should be a s-expression
17:15:30
rendar
this is my test code, ok? `(eval (quote (+ 1 1)))`
17:16:07
rendar
the parser convert that string into python tuples, which are the s-expr in lisp
17:16:23
White_Flame
ok, when you eval that (as a single eval in your repl, that sexpr being the result of your read), you should get 2
17:16:47
rendar
so i will have this python code: (Symbol("eval"), (Symbol("quote"), (Symbol("+"), 1, 1))))
17:17:41
rendar
the match expr: will recognize that first Symbol("eval"), and will put everything after that, to 'pred', e.g. pred = (Symbol("quote"), (Symbol("+"), 1, 1))))
17:17:53
sham1
Because the quote should disappear by the time you're executing the `(eval '(+ 1 1))` expression
17:18:03
White_Flame
he's just read it, not executed it yet
17:18:15
sham1
And that's why he'll need the double eval
17:18:16
rendar
White_Flame got it right
17:18:30
White_Flame
this eval is in the input, not in the code
17:18:31
rendar
that's what i'm talking about
17:18:42
White_Flame
the implementation code should have a single eval, not eval(eval(...))
17:18:56
rendar
White_Flame, if i remove the first eval
17:19:04
White_Flame
then you have a RPL, not a REPL
17:19:09
rendar
this is the result RESULT: (<Symbol: [quote]>, (<Symbol: [+]>, 1, 1))
17:19:21
White_Flame
oh, removed from the input
17:19:33
White_Flame
that's the result of your read?
17:19:44
rendar
yes, of `(eval (quote (+ 1 1)))`
17:20:00
rendar
with 2 nested evals, i got 2
17:20:10
White_Flame
the result of the READ of the string "(eval (quote (+ 1 1)))" should be the list (eval (quote (+ 1 1)))
17:20:28
White_Flame
you're jumping all over the place
17:20:36
White_Flame
have an explicit read step, eval step, print step
17:20:43
rendar
i still didn't implement the command read, but i have interpreter.eval("(eval ...")
17:20:57
rendar
i still don't have a REPL, man!
17:21:00
White_Flame
eval should not take a sting
Monday, 8th of August 2022, 17:21:01 UTC