Re: [racket] eval question

2014-11-20 Thread Manfred Lotz
On Thu, 20 Nov 2014 15:54:58 + Sam Tobin-Hochstadt wrote: > On Thu Nov 20 2014 at 10:42:08 AM Benjamin Greenman > wrote: > > > But why does eval's default namespace include "+" but not "expt"? > > > > It doesn't include either `+` or `expt`. The initial value for > `current-namespace` insi

Re: [racket] eval question

2014-11-20 Thread Sam Tobin-Hochstadt
On Thu Nov 20 2014 at 10:42:08 AM Benjamin Greenman wrote: > But why does eval's default namespace include "+" but not "expt"? > It doesn't include either `+` or `expt`. The initial value for `current-namespace` inside a module is an empty namespace. Sam Racket Users list

Re: [racket] eval question

2014-11-20 Thread Jens Axel Søgaard
2014-11-20 16:26 GMT+01:00 Manfred Lotz : > Hi there, > If I do this in a REPL > > Welcome to Racket v6.1.1. > -> (define p1 '(a . (expt 2 3))) > -> (eval (cdr p1)) > 8 Since the value of p1 is '(expt 2 3) eval will evaluate '(expt 2 3) in the current namespace. In the repl the current namespace i

Re: [racket] eval question

2014-11-20 Thread Benjamin Greenman
But why does eval's default namespace include "+" but not "expt"? On Thu, Nov 20, 2014 at 10:39 AM, Éric Tanter wrote: > This is answered in the Racket Guide, see section 15.1. > > The reason is that you need to provide a namespace (which in the > interaction mode is already initialized). > > So

Re: [racket] eval question

2014-11-20 Thread Éric Tanter
This is answered in the Racket Guide, see section 15.1. The reason is that you need to provide a namespace (which in the interaction mode is already initialized). So if you do: #lang racket/base (define ns (make-base-namespace)) ; create namespace (define p1 '(a . (expt 2 3))) (eval (cdr p1) ns

Re: [racket] eval question

2014-11-20 Thread Ryan Culpepper
See the guide section on eval [1], particularly the section on namespaces. Ryan [1] http://docs.racket-lang.org/guide/eval.html On 11/20/2014 10:26 AM, Manfred Lotz wrote: Hi there, If I do this in a REPL Welcome to Racket v6.1.1. -> (define p1 '(a . (expt 2 3))) -> (eval (cdr p1)) 8 it wor

Re: [racket] eval question

2011-05-21 Thread prad
Eli Barzilay writes: > About a minute ago, prad wrote: >> if i run the last line in the repl, it works. >> however, if i just try to run the program i the following error: >> >> compile: unbound identifier (and no #%app syntax transformer is bound) >> at: display in: (display phr) >> >> so it s

Re: [racket] eval question

2011-03-31 Thread Eli Barzilay
About a minute ago, prad wrote: > if i run the last line in the repl, it works. > however, if i just try to run the program i the following error: > > compile: unbound identifier (and no #%app syntax transformer is bound) > at: display in: (display phr) > > so it seems that it doesn't recognize t