Re: Reading primitive procedures

RT Happe <[email protected]> Sun, 18 Dec 2011 02:54:17 +0100
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
Frank Lay asked:

> > (read)
> 1 +
> 1
> #{Procedure 93 +}
> 
> Why [...] is the input '+' read as a procedure

When you hit enter after the +  the READ call eats the first datum
and returns the corresponding value, the number 1.
Then the REPL reads and evaluates the second datum, +.
I.e. you did basically the same as

  > (read)
  1
  > +
  #{Procedure 93 +}

In the words of the R5RS,

  READ returns the next object parsable from the given input port,
  updating port to point to the first character past the end
  of the external representation of the object.


> I don't understand how to 'unsymbolise' a symbol into its corresponding procedure.


Have a look at the EVAL procedure, the E in REPL, as in

  (eval '+ (scheme-report-environment 5))

Alternatively & depending on your plans, you could evaluate function symbols yourself,
e.g. map yourself the symbol '+  to the procedure +.


Disclaimer: I am not up to date as to the conformance of s48 with R*RS.


rt