[racket] learning recursion

2015-02-04 Thread Roelof Wobben
Hello, I try to learn functional programming by self-study. SO i tried to learn erlang but I have difficulties to understand recursion. Expecially things like reverse a list. Is racket a good language a good language to learn recursion the right way ? Roelof Racket Users

[racket] book for a absolute beginner

2014-10-16 Thread Roelof Wobben
Hello, Does anyone know a good book for a absolute beginner in racket with a lot of exercises so I can check if I understand anything right ? Roelof Racket Users list: http://lists.racket-lang.org/users

[racket] how can I use racket on Frugalware

2014-04-06 Thread Roelof Wobben
Hello, Im a Frugalware linux user and when I look at the downloads page I see that there are only packages for Ubuntu and Debian. What is the right way to make Racket work on my own distro. Roelof Racket Users list: http://lists.racket-lang.org/users

[racket] what's the best way to make auxilery functions here.

2012-07-05 Thread Roelof Wobben
Hello, I have this function : ; Vzoo -> Vzoo ; function which alters the happiness and x-coordinate based on the ticks of the computer. (check-expect (tock (make-VZoo (make-VCat 500 5 "rechts") (make-VCham 450 5 "rechts"))) (make-VZoo (make-VCat 503 4.9 "rechts")(make-VCham 453 4.9 "rechts"))

[racket] are these right structs and contracts

2012-07-02 Thread Roelof Wobben
Hello, Im now trying to design exercise 88 and I wonder if these are good designed structs. (define-struct Vcat (X H R)) ; Vcat = (make-Vcat Number Number String) ; interp. (make-cat x h) where x is the x-coordinate of the cat and h is the happiness of the cat and r is the direction of the ca

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] (offlist) Re: why is the comparimng always false

2012-06-30 Thread Roelof Wobben
Op 30-6-2012 16:23, Hendrik Boom schreef: On Sat, Jun 30, 2012 at 10:19:32AM +0200, Roelof Wobben wrote: 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

Re: [racket] why is the comparimng always false

2012-06-30 Thread Roelof Wobben
draaien-cat Vcat))] [(Vcham? s) (if(equal? (Vcham-Richting s) "left") (links-of-draaien-cham Vcham) (rechts-of-draaien-cat Vcham))] )) (define (render s)s) (define (main s) (cond [(Vcat? s) (big-bang s (check-with Vcat?) (on-tick tock) (on-draw render) )] [(Vcham? s) (

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 Roelof Wobben
12 21:47, Matthias Felleisen schreef: 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

Re: [racket] why is the comparimng always false

2012-06-29 Thread Roelof Wobben
ow what it is. [I need to investigate this problem. Sadly it is not a bug.] 2. Try to understand this: (define-struct Vcat [x happiness]) ;; A Vcat is (make-Vcat Number Number) (define-struct Vcham [x happiness]) ;; A Vcham is (make-Vcat Number Number) ;; An Animal is one of: ;; -- (make-Vcat

Re: [racket] why is the comparimng always false

2012-06-27 Thread Roelof Wobben
ss-quotient a) (cond [(Vcat? a) (+ (Vcat-x a) (Vcat-happiness a))] [(Vcham? a) (+ (Vcham-x a) (Vcham-happiness a))])) On Jun 27, 2012, at 5:08 AM, Roelof Wobben wrote: 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-s

[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)

Re: [racket] exercise's question

2012-06-26 Thread Roelof Wobben
: On Jun 26, 2012, at 10:21 AM, Roelof Wobben wrote: Sorry for the confusion. I meant exercise 87 and 88 on the stable version of HtpD/2e. So the questions I have should be : Is it correct that on exercise 87 of How to design Programms I have to make 2 gauges and two animals. And is exercise

Re: [racket] exercise's question

2012-06-26 Thread Roelof Wobben
e/matthias/HtDP2e/Draft/htdp2e-part1.html , ditto ) Can you re-adjust and ask the question again (in public) -- Matthias On Jun 26, 2012, at 9:39 AM, Roelof Wobben wrote: Hello, Sorry for so many questions but i get again confused. Is it correct that on exercise 56 of How to design Programms

[racket] exercise's question

2012-06-26 Thread Roelof Wobben
Hello, Sorry for so many questions but i get again confused. Is it correct that on exercise 56 of How to design Programms I have to make 2 gauges and two animals. And is exercise 57 part 1 not the same as exercise 56 ? Regards, Roelof Racket Users list: http://lists.r

Re: [racket] how must I interpreted this exercise

2012-06-25 Thread Roelof Wobben
One question left : Did I do this exercise the right way ? Roelof Op 25-6-2012 16:21, Roelof Wobben schreef: Nope, I think I have to read the whole book to get this kind of problems. First a lot of things to learn as lists, quote/unquote, lamba. Roelof Op 25-6-2012 16:14, Matthias

Re: [racket] how must I interpreted this exercise

2012-06-25 Thread Roelof Wobben
-near a better solution ;o) I think HtDP has problems that require assembling sentences from different parts of speech. That is a very challenging software field. rac On Jun 25, 2012, at 12:41 AM, Roelof Wobben wrote: You mean something like this : (check-expect (calculate 0 3) 3) (define

Re: [racket] how must I interpreted this exercise

2012-06-24 Thread Roelof Wobben
on. Make that work first. Then you can use the design recipe to make a new function. The new function will accept the output of your first function and return the message that you want… without any repeated words in the function. rac On Jun 24, 2012, at 1:43 PM, Roelof Wobben wrote: Hello,

Re: [racket] how must I interpreted this exercise

2012-06-24 Thread Roelof Wobben
d 's' to the 2nd word in s if it is longer than i letters (check-expect (change s1 2) s1) (check-expect (change s2 3) (cons "And" (cons "thiss" (rest (rest s2) (define (change s i) (if (> (string-length (second s)) i) (cons (first s) (cons (string-append (se

Re: [racket] how must I interpreted this exercise

2012-06-23 Thread Roelof Wobben
t works but I type two time's "it's true". Can this be done so I have to type only one time the sentence and depeding on true or false the word not is used. Roelof Op 23-6-2012 16:18, Matthias Felleisen schreef: Origin means (0,0) or plain 0 in English. On Jun 22, 20

Re: [racket] how must I interpreted this exercise

2012-06-23 Thread Roelof Wobben
. On Jun 22, 2012, at 2:42 PM, Roelof Wobben wrote: Hello, I try to make this exercise : Exercise 76: A programmer has chosen to represent locations as Cartesian points or just points: ;Location is one of: ;–Posn ;–Number ;interp. Posn are positions on the Cartesian grid

[racket] how must I interpreted this exercise

2012-06-22 Thread Roelof Wobben
Hello, I try to make this exercise : Exercise 76: A programmer has chosen to represent locations as Cartesian points or just points: ;Location is one of: ;--Posn ;--Number ;interp. Posn are positions on the Cartesian grid, ;Numbers are positions on the number line Design the f

Re: [racket] left boundary problem

2012-05-11 Thread Roelof Wobben
Nobody who can help me understand what Matthias ment with some remarks such as this one : Oke, but which other contants ? Roelof Op 10-5-2012 18:18, Roelof Wobben schreef: Op 10-5-2012 18:08, Matthias Felleisen schreef: On May 10, 2012, at 11:01 AM, Roelof Wobben wrote: p 10-5-2012 15

Re: [racket] left boundary problem

2012-05-10 Thread Roelof Wobben
Op 10-5-2012 18:08, Matthias Felleisen schreef: On May 10, 2012, at 11:01 AM, Roelof Wobben wrote: p 10-5-2012 15:33, Matthias Felleisen schreef: Exercise 1: eliminate all constants from function definition. (define kat (circle 39 'solid 'red)) (define workspace (empty-scen

[racket] left boundary problem

2012-05-10 Thread Roelof Wobben
Hello, I have to make a programm which displays a cat. When the cat is at the left or rigth end an disapear it has to turn the direction. So I have come to this : (define kat .) (define workspace (empty-scene 1000 200)) (define lengte (image-width workspace)) (define lengte2 (/ (image-width k

Re: [racket] Key-event test problem

2012-05-03 Thread Roelof Wobben
Op 3-5-2012 14:24, Laurine Harbulot schreef: Hello all, We're students and we're working on a space invaders project. Our game runs very well but we've got a problem: We would like to give the opportunity to players to press two keyboards buttons at the same time but for now,our program tests o

Re: [racket] again a image problem

2012-05-03 Thread Roelof Wobben
Op 2-5-2012 22:05, Roelof Wobben schreef: Hello, I try to make a function in which a gauge get descreased and the x-postion of a cat get decreased. But that's not the problem. Im trying to make the display function now. When I break down the display in parts I get this : (defin

[racket] again a image problem

2012-05-02 Thread Roelof Wobben
Hello, I try to make a function in which a gauge get descreased and the x-postion of a cat get decreased. But that's not the problem. Im trying to make the display function now. When I break down the display in parts I get this : (define cat ) (define workspace (empty-scene 1000 200)) (defi

Re: [racket] any remarks

2012-04-19 Thread Roelof Wobben
Op 19-4-2012 22:08, namekuseijin schreef: On Thu, Apr 19, 2012 at 11:04 AM, Roelof Wobben <mailto:r.wob...@home.nl>> wrote: > (define (edit e k) > (cond > [ (and(key=? "right" k) (> (string-length (editor-post e)) 0)) > (make-editor(string-append (editor

[racket] any remarks

2012-04-19 Thread Roelof Wobben
Hello, As a exercise of the Htpd2e I made this script : (define workspace (empty-scene 200 20)) (define cursor (rectangle 2 20 "solid" "red")) (define textcolor "black") (define textfont 11) (define-struct editor (pre post)) ; Editor = (make-editor String String) ; interp. (make-editor s t) mea

Re: [racket] key event problem

2012-04-18 Thread Roelof Wobben
Op 18-4-2012 12:32, Pierpaolo Bernardi schreef: On Wed, Apr 18, 2012 at 11:17, Roelof Wobben wrote: Hello, I try to make a function which controls the key-events. The function does only have to react on backspace , left , right . Give no reaction on tab , rubout or the other keys with a

[racket] key event problem

2012-04-18 Thread Roelof Wobben
Hello, I try to make a function which controls the key-events. The function does only have to react on backspace , left , right . Give no reaction on tab , rubout or the other keys with a length more then 1. When given another key with length 1 it has to insert the key. So i thought this woul

Re: [racket] extra exercises

2012-04-17 Thread Roelof Wobben
Op 17-4-2012 1:31, Stephen Bloch schreef: On Apr 16, 2012, at 5:18 PM, Neil Van Dyke wrote: ... if one is still looking for additional beginner programming exercises, I think that one not-totally-bad option is to start picking standard algorithms and data structures one can learn about by sea

[racket] extra exercises

2012-04-14 Thread Roelof Wobben
Hello, Im following the book Desiging programms second edition. I'm now at the end of chapter 2 and I get the idea I need some extra exercises so I can practice more to follow the desin recipe, difference between a global variable and a function parameter. Are there somewhere some extra exerci

[racket] struct change question.

2012-04-14 Thread Roelof Wobben
Hello, I have this struct : (define-struct editor (pre post)) ; Editor = (make-editor String String) ; interp. (make-editor s t) means the text in the editor is ; (string-append s t) with the cursor displayed between s and t ; make-editor String String -> Editor ; editor-pre Editor -> String ; e

Re: [racket] display problem

2012-04-13 Thread Roelof Wobben
Op 13-4-2012 20:53, Stephen Bloch schreef: On Apr 13, 2012, at 1:49 PM, Roelof Wobben wrote: I still have to write testcases but it's looking good. That's a bad sign: you should be writing test cases BEFORE writing the function :-) (define verwerker (make-editor "aaa"

Re: [racket] display problem

2012-04-13 Thread Roelof Wobben
Op 13-4-2012 19:31, Stephen Bloch schreef: On Apr 12, 2012, at 8:18 AM, Roelof Wobben wrote: Why do you need "overlay"? I would think you could do this just with "beside" (unless you wanted to fine-tune the formatting). Only beside. But how can I then take care that th

Re: [racket] display problem

2012-04-13 Thread Roelof Wobben
Op 12-4-2012 18:30, Roelof Wobben schreef: Op 12-4-2012 18:03, Nick Shelley schreef: Only beside. But how can I then take care that the text are displayed into the empty-scene. I think you need overlay or something for that. Every image function returns an image, so you can use

Re: [racket] display problem

2012-04-12 Thread Roelof Wobben
6:18 AM, Roelof Wobben <mailto:r.wob...@home.nl>> wrote: Op 12-4-2012 14:00, Stephen Bloch schreef: On Apr 11, 2012, at 12:03 PM, Roelof Wobben wrote: I changed the contract to Editor -> Number. When I change the make-editor function the v

Re: [racket] display problem

2012-04-12 Thread Roelof Wobben
Op 12-4-2012 14:00, Stephen Bloch schreef: On Apr 11, 2012, at 12:03 PM, Roelof Wobben wrote: I changed the contract to Editor -> Number. When I change the make-editor function the value changed. So I think the check-expect is wrong but I have no clue how to change it. No, the check-exp

Re: [racket] display problem

2012-04-11 Thread Roelof Wobben
Op 11-4-2012 18:03, Roelof Wobben schreef: Op 11-4-2012 15:10, Stephen Bloch schreef: On Apr 11, 2012, at 7:39 AM, Roelof Wobben wrote: But I see something strange, Both check-expect of the function width gives as output 18. But I expect that on a empty (editor-pre verwerker) gives as

Re: [racket] display problem

2012-04-11 Thread Roelof Wobben
Op 11-4-2012 15:10, Stephen Bloch schreef: On Apr 11, 2012, at 7:39 AM, Roelof Wobben wrote: But I see something strange, Both check-expect of the function width gives as output 18. But I expect that on a empty (editor-pre verwerker) gives as output 0. Am I mistaken or is there something

Re: [racket] display problem

2012-04-11 Thread Roelof Wobben
Op 6-4-2012 15:23, Stephen Bloch schreef: On Apr 6, 2012, at 3:39 AM, Roelof Wobben wrote: ;interp. (make-editorst)means the text in the editor is ;(string-append <http://docs.racket-lang.org/htdp-langs/beginner.html#%28def._%28lib._htdp-beginner..rkt._lang%29._%28%28lib._lang%2Fh

Re: [racket] display problem

2012-04-06 Thread Roelof Wobben
Op 6-4-2012 15:23, Stephen Bloch schreef: On Apr 6, 2012, at 3:39 AM, Roelof Wobben wrote: ;interp. (make-editorst)means the text in the editor is ;(string-append <http://docs.racket-lang.org/htdp-langs/beginner.html#%28def._%28lib._htdp-beginner..rkt._lang%29._%28%28lib._lang%2Fh

Re: [racket] display problem

2012-04-06 Thread Roelof Wobben
Op 6-4-2012 9:20, Danny Yoo schreef: On Friday, April 6, 2012, Roelof Wobben wrote: Op 5-4-2012 20:29, Danny Yoo schreef: I start with this : a| Concretely, what does the editor world value look like at this point? You&#x

Re: [racket] display problem

2012-04-06 Thread Roelof Wobben
Op 5-4-2012 20:28, Stephen Bloch schreef: On Apr 5, 2012, at 1:39 PM, Roelof Wobben wrote: Op 5-4-2012 19:28, Danny Yoo schreef: Can you get the position where the cursor should start by taking the image for the left side text, and take its width? ... I start with this : a| now

Re: [racket] display problem

2012-04-05 Thread Roelof Wobben
Op 5-4-2012 19:28, Danny Yoo schreef: http://www.ccs.neu.edu/home/matthias/HtDP2e/htdp2e-part1.html#(part._edit1) We need more context because there's not enough information in the question to tell what you're trying to do yet. Good luck! Yes, I mean that exercise. Ah. Ok. Can you get the

Re: [racket] display problem

2012-04-05 Thread Roelof Wobben
Op 5-4-2012 18:53, Danny Yoo schreef: I have a struct which contains text and the place of a cursor. The place are 2 strings which contains the character on the left and on the right of the cursor. Now I have to display this. But I wonder how I can set the cursor on the right place when I can't

[racket] display problem

2012-04-05 Thread Roelof Wobben
Hello, I have a struct which contains text and the place of a cursor. The place are 2 strings which contains the character on the left and on the right of the cursor. Now I have to display this. But I wonder how I can set the cursor on the right place when I can't know the numbers where betwe

[racket] why here 2 functions

2012-04-03 Thread Roelof Wobben
I have to make this exercise : Design the function different. It consumes two (representations of ) three-letter words and creates a word from the differences. For each position in t

Re: [racket] ufo structure problem

2012-04-02 Thread Roelof Wobben
Op 2-4-2012 13:02, Stephen Bloch schreef: On Apr 2, 2012, at 3:25 AM, Pierpaolo Bernardi quoted: I thought that the position of the ufo can be find at (posn-y p) and (posn-x) because the postition is a struct of Posn. and replied: You must pay more attention to small details. What is the p i

[racket] exercise 57 of the Desiging programms second Edition

2012-04-01 Thread Roelof Wobben
Hello, Is this a good answer to exercise 57 of the Second Edition book. 1) (define-struct time-midnight (hour minutes seconds)) 2) Struct -> Struct. A programm which calculates the time with 12 'o clock at the evening as starting point. Given ( 1:12.23) expected ( 1:12:23) G

Re: [racket] ufo structure problem

2012-03-30 Thread Roelof Wobben
Op 30-3-2012 12:17, Pierpaolo Bernardi schreef: On Fri, Mar 30, 2012 at 11:53, Roelof Wobben wrote: Op 30-3-2012 9:46, Pierpaolo Bernardi schreef: Hello Roelof, On Fri, Mar 30, 2012 at 09:32, Roelof Wobbenwrote: (define (show-ufo ufo) (place-image BLU (ufo-loc u) MTS)) But still I

Re: [racket] ufo structure problem

2012-03-30 Thread Roelof Wobben
Op 30-3-2012 9:46, Pierpaolo Bernardi schreef: Hello Roelof, On Fri, Mar 30, 2012 at 09:32, Roelof Wobben wrote: (define (show-ufo ufo) (place-image BLU (ufo-loc u) MTS)) But still I can't get the show-ufo work. Check carefully the name of your variables! Doesn't DrRacket g

Re: [racket] ufo structure problem

2012-03-30 Thread Roelof Wobben
, Roelof Wobben schreef: Hello, I try to make the ufo exercise work on this chapter : So I have this : ; visual constants (define MTS (empty-scene 100 100)) (define BLU (place-image (rectangle 25 25 "solid" "blue") 50 50 MTS)) (define-struct velocity (dx dy)) ; A Velocity is a

[racket] ufo structure problem

2012-03-30 Thread Roelof Wobben
Hello, I try to make the ufo exercise work on this chapter : So I have this : ; visual constants (define MTS (empty-scene 100 100)) (define BLU (place-image (rectangle 25 25 "solid" "blue") 50 50 MTS)) (define-struct velocity (dx dy)) ; A Velocity is a structure: (make-vel Number Number) ; int

Re: [racket] structures question

2012-03-29 Thread Roelof Wobben
Op 29-3-2012 16:37, David Van Horn schreef: ;; Posn -> Number. ;; A programm for calculating the distance is Manhatten (check-expect (manhatten (make-posn 7 3 )) 10) (check-expect (manhatten (make-posn 1 1 )) 2) (define (manhatten pos-manhatten) (+ (posn-y pos-manhatten) (posn-x pos-manhatten))

[racket] structures question

2012-03-29 Thread Roelof Wobben
Hello, Im trying to make a programm which use structures and calculates the distance between a point and another point. The first point has coordinates (0,0). So I made this : ;; Posn -> Number. ;; A programm for calculating the distance is Manhatten (check-expect ( manhatten (make-posn 7 3 )

Re: [racket] string problem question

2012-03-20 Thread Roelof Wobben
Thanks, Everything works now like a charm. Roelof Op 20-3-2012 1:20, Stephen Bloch schreef: On Mar 19, 2012, at 3:10 PM, Roelof Wobben wrote: But the contents of color does not change so I get a error message. What is the racket way to change the value of a string. That's not the pr

[racket] string problem question

2012-03-19 Thread Roelof Wobben
Hello, I have to make a traffic-light which changes color after each tick of the computer. So I thought this would work : ;; String -> Image ;; given a state of a trafic-light display a circle of the given color if it's a color of the traffic-light otherwise error (define (light color) (c

[racket] do I understand the concept World ?

2012-03-18 Thread ROELOF WOBBEN
Hello, I have this programm : ; WorldState -> WorldState; the clock ticked; decrease the gauge with 0.1; example:; given: 20, expected 19.9; given: 78, expected 77.9(define (tock ws)   (if (> ws 0) (- ws 0.1)0 )); GaugeState -> Gaugestate. ; display the gauge.(define (gauge ws)  (overlay/xy (rectan

Re: [racket] on-key question

2012-03-15 Thread Roelof Wobben
2. Define a key-handler function This is what I made : ; AllKeys String -> AllKeys ; add ke to w, the state of the world (define (key-handler w ke) (cond [ (key=? ke "\t") w] [ (key=? ke "\r") w] [ (key=? ke " ") w] [ (key=? ke "\b") w] [ (>( string-lenght ke) 1) w [el

Re: [racket] on-key question

2012-03-15 Thread Roelof Wobben
; It does work as expected. [the above are 'live' experiments, copied and pasted here] On Mar 14, 2012, at 1:32 PM, John Clements wrote: On Mar 14, 2012, at 9:05 AM, Roelof Wobben wrote: As far as I can see I have three different things. 1) Input is a character.Append it to th

Re: [racket] on-key question

2012-03-14 Thread Roelof Wobben
As far as I can see I have three different things. 1) Input is a character.Append it to the world. 2) Input is a like this one /t . Do nothing. 3) Input is a double or more string like right. Do nothing. I have to figure out how i can distinct the 1 and 2 from each other. They both have

[racket] on-key question

2012-03-14 Thread Roelof Wobben
Hello, I have to make a function which do nothing with the special key's. According to the manual I can use this : Here is a typical key-event handler: (define (chan

Re: [racket] Could this be done another way

2012-03-12 Thread ROELOF WOBBEN
ck ws)   (modulo (+ ws SPEED) WIDTH)  #;  (if (< ws (-(image-width BACKGROUND) (* 0.54 (image-width auto      (+ ws 3)      ( - ws (image-width BACKGROUND; PositiveNumber -> Image; run the animation at the specified rate [1/28 is decent, try 1/100 too](define (render ws)  (place

[racket] Could this be done another way

2012-03-12 Thread ROELOF WOBBEN
Hello, I have tried to make a function which display a car running on a empty-screen.When the car  is at the end. The car has to begin at the beginning.I have made this : (define wheel-radius 5)(define cab (beside (rectangle (* 6 wheel-radius)(* 4 wheel-radius) "solid" "red")(right-triangle (* 2 wh

Re: [racket] Fwd: Re: Is this a good design

2012-03-02 Thread Roelof Wobben
Op 2-3-2012 10:51, Roelof Wobben schreef: Op 2-3-2012 10:37, Pierpaolo Bernardi schreef: On Fri, Mar 2, 2012 at 09:41, Roelof Wobben wrote: I did some study on that chapter but I cannnot make it work, This is what I have so far : ;;String -> String ;; Get the first character of a str

Re: [racket] Fwd: Re: Is this a good design

2012-03-02 Thread Roelof Wobben
Op 2-3-2012 10:37, Pierpaolo Bernardi schreef: On Fri, Mar 2, 2012 at 09:41, Roelof Wobben wrote: I did some study on that chapter but I cannnot make it work, This is what I have so far : ;;String -> String ;; Get the first character of a string (s) if there is one. error otherw

Re: [racket] Is this a good design

2012-03-02 Thread Roelof Wobben
Op 2-3-2012 9:51, Danny Yoo schreef: > I did some study on that chapter but I cannnot make it work, > This is what I have so far : > > ;;String -> String > ;; Get the first character of a string (s) if there is one. error otherwise. > ;; given "" expected "a" > ;; given "" expected " > (d

Re: [racket] Fwd: Re: Is this a good design

2012-03-02 Thread Roelof Wobben
Op 2-3-2012 8:05, Roelof Wobben schreef: Op 1-3-2012 23:11, David Van Horn schreef: On 3/1/12 4:45 PM, Roelof Wobben wrote: Originele bericht Onderwerp: Re: [racket] Is this a good design Datum: Thu, 01 Mar 2012 10:05:25 +0100 Van: Roelof Wobben Aan: David

Re: [racket] Fwd: Re: Is this a good design

2012-03-01 Thread Roelof Wobben
Op 1-3-2012 23:11, David Van Horn schreef: On 3/1/12 4:45 PM, Roelof Wobben wrote: Originele bericht Onderwerp: Re: [racket] Is this a good design Datum: Thu, 01 Mar 2012 10:05:25 +0100 Van: Roelof Wobben Aan: David Van Horn You can imagine alternative

[racket] Fwd: Re: Is this a good design

2012-03-01 Thread Roelof Wobben
Originele bericht Onderwerp: Re: [racket] Is this a good design Datum: Thu, 01 Mar 2012 10:05:25 +0100 Van:Roelof Wobben Aan:David Van Horn You can imagine alternative statements of the program contract and purpose that would lead to different code. One is

Re: [racket] Is this a good design

2012-02-29 Thread Roelof Wobben
You ignored part of what Asumu said, which (to paraphrase) is that your program should live and die by its contract. When you write down: String -> String you're saying this program consumes a String and produces a String. If somebody applies your program to something that is *not* a stri

Re: [racket] Is this a good design

2012-02-29 Thread Roelof Wobben
>> A couple of comments: >> >> * `string-first` (- instead of the _) is a more idiomatic naming Oke, changed that. >> * (eq? (string? s) true) is >> verbose. (string? s) already returns a boolean. I changed that , thanks for the tip. * Generally, when writing programs using the design recip

[racket] Antw:Re: Is this a good design

2012-02-29 Thread ROELOF WOBBEN
Oke, So no more points which can be better.RoelofOp 29/02/12, Joshua Ewulo schreef: Hello Roelof,It does what it says.JoshuaOn 29 February 2012 18:14, ROELOF WOBBEN > wrote: (define (string_first s)   ( if (eq? (string? s) true) (string-ith  s 0 )"You have not entered

[racket] Is this a good design

2012-02-29 Thread ROELOF WOBBEN
Hello, I am now in the book How to design a programm second edition at the point I have to design functions.Now I wonder if I understand this part right so I have made this function. ;String -> String ;This function takes out the first character of a given string with the name s; given "roelof" exp

[racket] Antw:Re: if problem

2012-02-29 Thread ROELOF WOBBEN
What should happen when the length of the string is not greater than 0?The error message is reminding you to answer this question.CheersP. Oke, So then else part must be filled in.Thanks for the info.Roelof Racket Users list: http://lists.racket-lang.org/users

[racket] if problem

2012-02-29 Thread ROELOF WOBBEN
Hello, I have made this :(define (string-insert s1 i)  (if(> (string-length s1) 0)  (string-append (substring s1 0 i) "-" (substring s1 i (string-length s1)But on the if I get a this message : if: expected a question and two answers, but found only 2 partsSo I think that the if get sonehow mess

[racket] Antw:Re: Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
eb 23, 2012 at 1:18 PM, ROELOF WOBBEN wrote:> I have added the image.ss teachpack.> I have no clue how the 2e image teachpack is named in Dr Racket 2.5.1.>> Roelof>>> Op 23/02/12, Robby Findler schreef:>> I think possibly Roelof has added the HtDP image teachpack,

[racket] Antw:Re: Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
Felleisen wrote:>> The code was developed in BSL. You must have forgotten to copy and paste the require line.>>> On Feb 23, 2012, at 1:52 PM, ROELOF WOBBEN wrote:>>>>>>> Op 23/02/12, Matthias Felleisen schreef:>>>>>> Here is a high-riding Ameri

[racket] Antw:Re: multiple images problem

2012-02-23 Thread ROELOF WOBBEN
Op 23/02/12, Matthias Felleisen schreef: Here is a high-riding American SUV, does this help? (require 2htdp/image)(define cab  (beside (rectangle 33 18 'solid 'red) (right-triangle 10 18 'solid 'red)))(define body (rectangle 100 30 'solid 'red))(define top  (above/align 'right cab body))(define

[racket] multiple images problem

2012-02-23 Thread ROELOF WOBBEN
see I cannot use overlay/xy to make the second wheel.Must I make a images of the 2 wheels first and use overlay/xy or is there another way to achieve this ?Regards,Roelof Wobben Racket Users list: http://lists.racket-lang.org/users

Re: [racket] exercise problem

2012-02-22 Thread Roelof Wobben
Op 22-2-2012 9:58, Roelof Wobben schreef: Thanks, I have now a answer to my question. I will debug my programm with check-expect and wil take a look at the second edition. Roelof Op 21-2-2012 22:40, Stephen Bloch schreef: On Feb 21, 2012, at 3:18 PM, Roelof Wobben wrote: Op 21-2-2012

Re: [racket] exercise problem

2012-02-21 Thread Roelof Wobben
Op 21-2-2012 20:51, Stephen Bloch schreef: On Feb 21, 2012, at 2:43 PM, Roelof Wobben wrote: But now I get this error message : unsaved editor>:27:23: function call: expected a function after the open parenthesis, but found a part in: (tarief1 amount) When I do (tarief 1 amount) instead

[racket] exercise problem

2012-02-21 Thread Roelof Wobben
Hello, I try to make this exercise : Some credit card companies pay back a small portion of the charges a customer makes over a year. One company returns 1. .25% for the first $500 of charges, 2. .50% for the next $1000 (that is, the portion between $500 and $1500), 3. .75% for

[racket] why here a endless loop

2012-02-21 Thread Roelof Wobben
(define (brutoloon h) (* 12 h)) But it seems there a error in belasting. When I do (belasting 239) I don't get a answer but a memory error problem. And I don't see why this happens. Can anyone help me finding out what is wrong here ? Regards, Roelof Wobben Racke

[racket] exercise problem

2012-02-01 Thread Roelof Wobben
Hello, I have this problem : Utopia's tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the program tax, which determines the tax on the gross pay. Also define netpay. The program determines the net pay of an employee f