Search
Monday, 8th of August 2022, 17:21:01 UTC
17:21:12
White_Flame
well, eval("foo") should return "foo", as strings evaluate to themselves
17:21:36
White_Flame
eval takes s-expressions
17:22:00
rendar
interpreter.eval() takes lisp text..
17:22:04
White_Flame
if you type 1 at the repl, it'll return 1. If you type "foo" at the repl, you'll get "foo". If you type (+ 1 2) at the repl, you'll get 3
17:22:17
rendar
eval_() takes s-expr (in my example represented by python tuples)
17:22:32
White_Flame
then what's interpreter.eval("...") ?
17:22:44
rendar
White_Flame, it's almost the repl
17:22:53
White_Flame
then don't call it eval ;)
17:22:54
rendar
it's the thing that will take input from stdin
17:23:10
rendar
White_Flame, in all examples i have seen, they call it eval()
17:23:22
White_Flame
call it repl, if that's what you're building it up to be
17:23:32
White_Flame
or eval-string if that's what it's going to do
17:24:02
White_Flame
but "eval" is a specifically meaningful term in lisp, which should perform what EVAL does in lisp, if you want any clarity in communicating
17:24:24
rendar
White_Flame, yes, i agree
17:24:42
White_Flame
read_eval would be better
17:25:10
White_Flame
and the code of read_eval sould be read(eval(string)) :)
17:25:14
rendar
this is the function https://bpa.st/JJAQ
17:25:19
White_Flame
erm, eval(read(string)) :-P
17:25:48
rendar
now that we have defined this
17:25:52
White_Flame
so .eval is a method on Cons?
17:26:00
rendar
result = i.read_eval("(eval (quote (quote (+ 1 1))))")
17:26:26
sham1
Why are you quoting the quote
17:26:49
White_Flame
that should work, if the intent is to flex nested evaluation
17:27:28
rendar
it should return (+ 1 1)
17:27:50
sham1
So now, when evaluating a procedure call, you want to evaluate the parameters first
17:28:03
rendar
sham1, i already do that
17:28:22
rendar
this is my main internal eval: https://bpa.st/TCQQ
17:29:01
sham1
You're not evaluating pred
17:29:30
rendar
this is why i need 2 nested evals
17:29:45
sham1
But that's the semantics! Eval is not a special form
17:30:17
White_Flame
yep, eval is a plain function, so the plain function caller would evaluate all its args before calling it
17:30:19
rendar
but i was testing implementing eval as a special command
17:31:23
sham1
Well then it should be no surprise that you need the double eval
17:32:26
rendar
indeed, i was not surprised, then i have just asked here for confirm
17:32:41
rendar
but i didn't paste all the issue, my bad
18:28:42
wasamasa
rendar: you might want to look at an easy lisp interpreter, like MAL
18:29:01
wasamasa
rendar: it walks you through everything required to implement a subset of clojure
18:31:16
wasamasa
rendar: less pitfalls, but also less of a learning effect
20:36:52
rendar
wasamasa, i'm looking at https://norvig.com/lispy.html
21:02:19
Lord_of_Life_
** NICK Lord_of_Life
21:26:51
White__Flame
** NICK White_Flame
21:55:10
Goodbye_Vincent1
** NICK Goodbye_Vincent
2:45:55
grawlinson_
** NICK grawlinson
Tuesday, 9th of August 2022, 5:21:01 UTC