Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

SICP final exercise help

Name: Anonymous 2011-08-11 23:28

Pretty retarded to look for help from /prog/, I know, but you guys got me started on SICP and I figure I'd come to you first even though none of you have actually read it.

SICP doesn't really mention parsing at all, it being left as an exercise for the reader. I wanna sound out that I have the right idea before I start implemention. You have a string of input, you tokenize it, and with lisp-likes it's easiest to just use a recursive descent parser. The recursive descent parser turns the procedure call stack into an abstract syntax tree. Capture that in a cons list, return that.

Name: Anonymous 2011-08-11 23:37

(loop (print (eval (read))))

Name: Anonymous 2011-08-11 23:43

>>2-kun, what I'm talking about is the implementation of read (or maybe helper functions of eval, not totally sure how it all fits).

Name: Anonymous 2011-08-11 23:55

>>3
What you describe is left as an exercise for the reader.

Name: Anonymous 2011-08-12 0:53

Name: Anonymous 2011-08-12 4:34

>>3
READ is user-defined. It can as well read infix syntax and return it as SEXP.

Name: Anonymous 2011-08-12 9:26

You know you're a smug lisp weenie when you ls ~/sicp_exercises and there's a complete list of 100% accurate lisp solutions

Name: Anonymous 2011-08-12 9:35

>>7
If it's Lisp it ain't accurate.

Name: Anonymous 2011-08-12 10:33

>>8
If it's Lisp you're not in control of how shit is implemented, so it's probably not efficient.

Name: Anonymous 2011-08-12 12:06

>>8
Why, of course, it has garbage collection, the ultimate insult to any user of a computer program, as it shows the lack of love that a developer had for not caressing gently each and every byte of precious memory that their program allocated.

Name: Anonymous 2011-08-12 13:30

>>10
I can't tell whether that's sarcasm.

Name: Anonymous 2011-08-12 15:35

>>11
Then you're a moron.

Name: Anonymous 2011-08-12 15:49

>>12 he is not a moron he is beautiful

Name: Anonymous 2011-08-12 19:52

>>12
Sufficiently advanced manual memory management propaganda is indistinguishable from sarcasm.

Name: Anonymous 2011-08-13 14:14

this thread is among the saddest things I've seen in my life so far. shame on you, /prog/; what have you come to..

Name: REPLCOCKS 2011-08-13 14:16

>>15
(loop (print (eval (read))))
You are not capable of comprehending /prog/. Go back to a place which better suits your mental capabilities, like /b/.

Name: VIPPER 2011-08-13 14:31

>>5
First comment
Who the fuck did this!?

Name: >>15 2011-08-13 20:19

>>16
I've been longer on /prog/ than you and >>1-14 combined.
Deal! With! It!

Name: Anonymous 2011-08-13 22:14

>>18
That doesn't change that fact that you belong in /b/.

Name: Anonymous 2011-08-13 22:23

>>1
What part of ``metacircularity'' did you not understand? If you write your own `read', `print', etc., it's not a metacircular interpreter anymore, it's a normal interpreter. The point of it is that you're writing it not to make an interpreter of a language, you're writing it to be an extension of the hosting implementation using data as code, to be a ``metasyntactic abstraction''. That was the point of eval, that is the point of metacircularity, that is the idea on which macros are built on.

Read more SICP, you still have to achieve Satori.

Name: Anonymous 2011-08-13 23:22

>>19
fagstorm

Name: n3n7i 2011-08-14 8:03

...And then DEP comes along.. =D

Name: Anonymous 2011-08-14 8:04

>>22
fuck off

Name: TRUE TRUTH EXPERT 2011-08-14 10:25

>>22
fUCK OFF

Don't change these.
Name: Email:
Entire Thread Thread List