[racket] Difference in speed accessing fields of a struct with gen:equal+hash

2014-06-23 Thread Eric Dobson
I added gen:equal+hash to a struct type and noticed that accessing fields of the struct got slower, even though I never used equal? or hash functions. Is this expected? And if so what is the cause of it? #lang racket (struct foo (x) #:transparent) (struct bar (x) #:transparent #:methods g

Re: [racket] Type of syntax-local-phase level

2014-06-23 Thread Asumu Takikawa
On 2014-06-21 22:26:06 -0400, Alexander D. Knauth wrote: > The docs say that (syntax-local-phase-level) returns an exact-integer?, but > the type is (-> (U Integer False)). > > Are the docs right, or is the type right? > > Would a syntax-transformer ever be expanded as a label phase level fo

Re: [racket] (define (f (x y)) body) when y has a previous definition

2014-06-23 Thread Joshua TAYLOR
D'OH. Sorry, I've been reading Common Lisp specs for so long that I read [ x y ] as "and optionally x followed by y", not "a list of x and y". I.e., I don't internally grok square brackets as parentheses. That makes the definition of the define syntax in http://docs.racket-lang.org/reference/def

Re: [racket] (define (f (x y)) body) when y has a previous definition

2014-06-23 Thread Tony Garnock-Jones
On 06/23/2014 09:21 AM, Joshua TAYLOR wrote: >> (define y 2) >> (define (f (x y)) > (print x) > (print y)) > > Is this expected? You've stumbled across Racket's syntax for default values for arguments, a.k.a. optional arguments. [1] If I write (define (myproc [x "hello"]) ...) then if

Re: [racket] (define (f (x y)) body) when y has a previous definition

2014-06-23 Thread Robby Findler
The "y" in your program is the default value of the optional argument 'x'. Does this help clarify? Robby On Mon, Jun 23, 2014 at 8:21 AM, Joshua TAYLOR wrote: > I was answering this Stack Overflow question [1], and came across this > bizarre (to me, anyhow) behavior (REPL transcript from Dr.Rac

[racket] (define (f (x y)) body) when y has a previous definition

2014-06-23 Thread Joshua TAYLOR
I was answering this Stack Overflow question [1], and came across this bizarre (to me, anyhow) behavior (REPL transcript from Dr.Racket) Welcome to DrRacket, version 5.3 [3m]. Language: racket; memory limit: 128 MB. > (define y 2) > (define (f (x y)) (print x) (print y)) > (f 1) 12 Is t

Re: [racket] Determining type from a syntax object

2014-06-23 Thread Antonio Menezes Leitao
Hi, I was trying to achieve something similar but found a problem in my code. I'll be glad if someone can help me solve this. The idea is that I want to define a typed function and then I want to access the parameter types to define a different function. The file containing the macro stuff is: ;