Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-22 Thread netraken
On 21/01/2019 21:01, Neil Van Dyke wrote: Hi, > > That's an improper end to a list.  It means a structure of pairs in > which the CDR (right element) of the last pair is not the null list. > Thanks again for your detailed and pedagogic answer. I have replaced 'cons' by 'list' and it is ok.

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-21 Thread netraken
On 20/01/2019 15:33, Neil Van Dyke wrote: [lot of helpful information] OK, it works now. I could finally strip it down to (define (enum-var-dim n v) (if ( = n 2) (cons (fst (cantor-enum v)) (snd (cantor-enum v))) (cons (fst (cantor-enum v))(enum-var-dim (sub1 n) (snd (cantor-enum v))

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hi, Thanks you very much for these very detailed explanations. It helped me a lot. Thank you again, Alain On 20/01/2019 15:33, Neil Van Dyke wrote: > > netraken wrote on 1/20/19 8:31 AM: >> (define (EnumVarDim n value result) >>    (if ( >= n 2) >>    ( (d

Re: [racket-users] Re: Output values

2019-01-20 Thread netraken
On 20/01/2019 19:50, Jonathan Simpson wrote: > Are you looking for the values function?  > > https://docs.racket-lang.org/reference/values.html?q=values#%28def._%28%28quote._~23~25kernel%29._values%29%29 > > In your example you'd end EnumTriplet with this: > > (values x y z) > Yes, that's it.

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hello Neil, Thanks for your help. On 20/01/2019 13:54, Neil Van Dyke wrote: > Hello, Alain.  You might wish to write out htdp.org design recipes for > EnumVarDim and Enum. Yes it seems that this is an useful reference for learning. Thanks for pointing it. I don't know what they're supposed to

[racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hello all, I am a beginner in Racket. I need to define a variable pairValue as the result of Enum(result) The following function ;; Fonction inverse en dimension variable (define (EnumVarDim dim value result) (if ( >= dim 2) ( (define pairValue Enum(result))) (result))) fails with "defi

[racket-users] Output values

2019-01-18 Thread netraken
Hi all, I am an absolute beginner in Racket. I wrote the following function which deals with Cantor pairing function. (define (EnumTriplet n) (define inter (Enum n)) (define z (fst inter)) (define result (Enum (snd inter))) (define x (fst result)) (define y (snd result)) x ;;y ;;z