[racket-users] Re: Self evaluating Racket Interpreter

2017-05-04 Thread circularballs
I forgot to mention that for some reason, using the builtin foldl doesn't work 
but if I define it myself separately, then it works. 

  (define (foldl proc init lst)
(cond
  ((null? lst) init)
  (else (foldl proc (proc (car lst) init) (cdr lst)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Self evaluating Racket Interpreter

2017-05-04 Thread circularballs
Thanks Matthias. I should have read the error message more carefully. 

For anyone who is interested, it has nothing to do with cons or mcons or 
quotes. There was a mistake in interpreter.rkt.

If you'd like to try finding it yourself, then stop reading.
...
...
...
...
...
...
...
...
...
...
Here's the fix. In interpreter.rkt, under the definition of myeval, in the case 
of a let expression, it should have been:
  [(eq? (car expr) 'let)
   (eval-sequence (cddr expr)
  (extend-env
   (map first (second expr))
   (eval-args (map second (second expr)) env)
   env))]




-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Self evaluating Racket Interpreter

2017-05-01 Thread circularballs
I am somewhat reluctant to use structures as I want to keep the interpreter as 
minimal as possible. Also, I'm not familiar enough with the semantics of frames 
to implement it in interpreter.rkt.

With regards to mcons being different from cons, Oscar Lopez has suggested that 
in stackoverflow. So, I re-implemented the interpreter in r5rs so that set-car! 
and set-cdr! are available and I wouldn't need to use mcons. I've attached the 
files here.

I still got an error
; application: not a procedure;
;  expected a procedure that can be applied to arguments
;   given: (mcons 'expr (mcons 'env))
;   arguments...: [none]

It looks like it still has something to do with mcons. I suspect that this 
might have something to do with Racket's implementation of r5rs? Again, this 
might be completely wrong but I don't know how to determine the cause. 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


interpreter-r5rs.rkt
Description: Binary data


interpreter-r5rs-self-evaluate.rkt
Description: Binary data