Lisp eval and read-from-string

Discussion of Common Lisp

Lisp eval and read-from-string

Postby sms1989 » Wed Aug 29, 2012 6:30 pm

Hey everyone,

I've been slowly learning Lisp, but really don't know much yet, so I wasn't sure what to search for here. I apologize if this question has already been posted.

I came across a combined Lisp statement: (eval (read-from-string (read-line))) ⇒ ???

I attempted to create a Lisp app to test it, but I am running into problems. My question is, after creating an application with the above statement (or a very similar statement), what would I enter in order to return an answer (once the app is running)? From what I have read, there are 3 ways to enter a line for the compiler to read, but only one way is accepted and the other 2 methods return exception errors. Could you tell me what I would enter to return a valid answer and what I would enter to return the exception errors?

Sorry if that is confusing. I am pretty confused myself. Thanks everyone!
Posts: 1
Joined: Wed Aug 29, 2012 6:21 pm

Re: Lisp eval and read-from-string

Postby sylwester » Thu Aug 30, 2012 4:31 am

:roll: read-line reads one line so you must type in a whole expression in one line.
read-from-string reads a string until ithas a whole expression andreturns a expression as data

These two ar like read, only read reads from input until it has a whole expression.

You may input self evaluating stuff like numbers or something like (if T (print 'boo) (print 'wonnthappen))
I'm the author of two useless languages that uses BF as target machine.
Currently I'm planning a Scheme compiler :p
Posts: 130
Joined: Mon Jul 11, 2011 2:53 pm

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 2 guests