Re: [racket] why is the comparimng always false

2012-07-01 Thread Matthias Felleisen
Please choose variable names other than Vcat and such. I like a-vcat for example. This name emphasiszes that I get one particular vcat here -- not all of the infinitely many possible ones. explanation: The definition of structures introduces one more thing that is not explained. For example,

Re: [racket] why is the comparimng always false

2012-06-30 Thread Roelof Wobben
Op 30-6-2012 15:55, Matthias Felleisen schreef: On Jun 30, 2012, at 3:03 AM, Roelof Wobben wrote: I can do the same for my problem. ; A Vanimal is one of : ; - (make-Vcat ( x happiness) ; (make-Vcham ( x happiness) So Vanimal is not a struct but strictly a name. Am I on the right track.

Re: [racket] why is the comparimng always false

2012-06-30 Thread Matthias Felleisen
On Jun 30, 2012, at 3:03 AM, Roelof Wobben wrote: > I can do the same for my problem. > > ; A Vanimal is one of : > ; - (make-Vcat ( x happiness) > ; (make-Vcham ( x happiness) > > So Vanimal is not a struct but strictly a name. > > Am I on the right track. YES!

Re: [racket] why is the comparimng always false

2012-06-30 Thread Roelof Wobben
I think I found the solution. I still have to design the render function. I have this : ; niet grafische constanten. (define lengte-werkblad 200) (define breedte-werkblad 1000) (define move-animal 3) (define move-gauge 0.1) ; grafische constanten (define kat .) (define cham .) (define work

Re: [racket] why is the comparimng always false

2012-06-30 Thread Roelof Wobben
Op 30-6-2012 1:38, Neil Van Dyke schreef: Stephen Bloch wrote at 06/29/2012 06:01 PM: Either you introduce this stuff much better than I do, or your students are much sharper. For the possible benefit of any students reading, I think someone say it, rather than leave it implied: Or the differ

Re: [racket] why is the comparimng always false

2012-06-29 Thread Neil Van Dyke
Stephen Bloch wrote at 06/29/2012 06:01 PM: Either you introduce this stuff much better than I do, or your students are much sharper. For the possible benefit of any students reading, I think someone say it, rather than leave it implied: Or the difference could be an isolated effect of, say,

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
> >> > make-person ; string string number -> person > person-forename ; person -> string >^ >| >+-- please do notice the semicolon here; the rest of these > lines are comments > > This will ensure he gets the names right. Interesting idea

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
On Jun 29, 2012, at 10:34 PM, Matthias Felleisen wrote: > > On Jun 29, 2012, at 5:30 PM, Stephen Bloch wrote: > >> This is a fairly common confusion for my students > > > This is the first time I am encountering this confusion. Really? You've never had a student write a define-struct for

Re: [racket] why is the comparimng always false

2012-06-29 Thread Matthias Felleisen
On Jun 29, 2012, at 5:52 PM, Stephen Bloch wrote: > Another thing I recommend: every time you write a define-struct, write down > (in comments) the contracts for all the functions it gives you for free. > > For example, > ; a person has a forename and a family-name (both strings), and a birth-y

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
Another thing I recommend: every time you write a define-struct, write down (in comments) the contracts for all the functions it gives you for free. For example, ; a person has a forename and a family-name (both strings), and a birth-year (a number). (define-struct person forename family-name bi

Re: [racket] why is the comparimng always false

2012-06-29 Thread Matthias Felleisen
On Jun 29, 2012, at 5:30 PM, Stephen Bloch wrote: > This is a fairly common confusion for my students This is the first time I am encountering this confusion. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] why is the comparimng always false

2012-06-29 Thread Stephen Bloch
On Jun 29, 2012, at 9:12 PM, Roelof Wobben wrote: > As I understand it Vanimal is the world which can exist of a Vcat or a Vcham. > The problem is that I cannot know which one it is and if don't do a > define-struct Vanimal () I cannot check if the make the right world. Not true. You can check

Re: [racket] why is the comparimng always false

2012-06-29 Thread Matthias Felleisen
Do pay attention to Vcat? and VCham? On Jun 29, 2012, at 4:12 PM, Roelof Wobben wrote: > I know. > As I understand it Vanimal is the world which can exist of a Vcat or a Vcham. > The problem is that I cannot know which one it is and if don't do a > define-struct Vanimal () I cannot check if th

Re: [racket] why is the comparimng always false

2012-06-29 Thread Roelof Wobben
I know. As I understand it Vanimal is the world which can exist of a Vcat or a Vcham. The problem is that I cannot know which one it is and if don't do a define-struct Vanimal () I cannot check if the make the right world. I will reread the chapter how to solve this. Roelof Op 29-6-2012 21:

Re: [racket] why is the comparimng always false

2012-06-29 Thread Matthias Felleisen
On Jun 29, 2012, at 3:14 PM, Roelof Wobben wrote: > ; Te gebruiken structs > > ; Design a world program that works with both cats and chameleons: > ; A VAnimal is either > ; – a VCat > ; – a VCham > (define-struct Vanimal (Vchat Vcham)) Please re-read the chapter. The above is completely wrong

Re: [racket] why is the comparimng always false

2012-06-29 Thread Roelof Wobben
Thanks for the remark. I have now this as a solution : ; niet grafische constanten. (define lengte-werkblad 200) (define breedte-werkblad 1000) (define move-animal 3) (define move-gauge 0.1) ; grafische constanten (define kat .) (define cham .) (define workspace (empty-scene breedte-werkbla

Re: [racket] why is the comparimng always false

2012-06-29 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 27-06-12 15:56, Matthias Felleisen wrote: > > > 1. You got trapped in a strange corner of the language: > > -- to ask whether some value is a a Vcat you should use Vcat? -- > BSL should not really allow you to say 'Vcat' all by itself. Actually

Re: [racket] why is the comparimng always false

2012-06-27 Thread Roelof Wobben
Oke, If I understand this the struct Vanimal is not a part of the programm ? Roelof Op 27-6-2012 15:56, Matthias Felleisen schreef: 1. You got trapped in a strange corner of the language: -- to ask whether some value is a a Vcat you should use Vcat? -- BSL should not really allow you to s

Re: [racket] why is the comparimng always false

2012-06-27 Thread Matthias Felleisen
1. You got trapped in a strange corner of the language: -- to ask whether some value is a a Vcat you should use Vcat? -- BSL should not really allow you to say 'Vcat' all by itself. [I need to investigate this problem. Sadly it is not a bug.] 2. Try to understand this: (define-struct Vcat

[racket] why is the comparimng always false

2012-06-27 Thread Roelof Wobben
Hello, I try to figure out how I can check if a struct is a Vcat or a Vcham. So i tried this: ; – a VCham (define-struct Vanimal (animal)) ; a struct has two parts ( the x-coordinate of a cat and the happiness of the cat) (define-struct Vcat [x happiness]) ; make Vcat : number (x) number (h)