18 Dec 2011 00:52
Reading primitive procedures
Frank Lay <itasyno <at> gmail.com>
2011-12-17 23:52:41 GMT
2011-12-17 23:52:41 GMT
Hello,
I don't understand the following Scheme behaviour:
> (read)
+
'+
> (read)
1 +
1
#{Procedure 93 +}
Why in the second interaction is the input '+' read as a procedure, but in the first as a symbol?
I am very new to Scheme, so my apologies if this is a silly question. I'm trying to write an RPN interpreter in Scheme, and I thought I'd apply the procedure read from the input to a stack of operands, however, because of the first case, this method isn't robust. I don't understand how to 'unsymbolise' a symbol into its corresponding procedure. Maybe there is a better way to do this?
Thanks for reading.
RSS Feed