[racket] Generative recursion

2010-11-03 Thread Ken Hegeland
I am trying to do the problem 26.1.1 in the book HTDP and I just feel like the more I think about it, the more confused I get. I found a post from 2007 with some tips from Jens Axel Søgaard, the link is http://objectmix.com/scheme/186349-htdp-generative-recursion.html. I understand whats to be

[racket] 26.1.1 tabulate-div

2010-11-04 Thread Ken Hegeland
I had made a previous post on this subject and have spent a few days trying to work out this problem but I feel like I have hit a dead end, and I am hoping I can get some advice from a few people with more experience than I. The code I have managed to create so far is: (define(find-div n i)   (c

Re: [racket] Generative recursion

2010-11-06 Thread Ken Hegeland
I have been trying to take a break for the weekend and I am going to try to go back at it with a fresh perspective Monday. One thought I did have though, you said tabulate-div means we want all the divisors of 20, so the next step would be tab-div(sub1 n), or 19, Im thinking that would mean a

Re: [racket] Generative recursion

2010-11-06 Thread Ken Hegeland
Something that looks like this: (define(tabulate1 n i) (cond [(> i n)empty] [(=(remainder n i)0)(cons i(tabulate1 n(add1 i)))] [else(tabulat1 n(add1 i))])) (define(tabulate n) (tabulate1 n 1)) I feel like I understand how it works recursively, just the generative recursion method makes me stru

Re: [racket] Generative recursion

2010-11-06 Thread Ken Hegeland
Yes, I have completed all the previous challenges, I have completed most 3 times, and some 2 times. For the most part with all the previous challenges I never had too much trouble. The only other problems that gave me a decent amount of trouble were the permutation function, and computing natura

Re: [racket] Generative recursion

2010-11-06 Thread Ken Hegeland
I am able to define a generative function for tabulate the divisors of 20, so hopefully tomorrow I can figure out how to abstract it, Im sure I might have a bit more trouble with the final step I need to figure out for abstraction. I just wanted to say thanks to wooks and anyone else, I felt ver

[racket] 27.1.3

2010-11-11 Thread Ken Hegeland
I am having trouble changing the Sierpinski function to consume structures, instead of coordinates. I used the same function design for too-small as in 27.1.1, I edited each sub function used to consume triangles as well. When testing the new function with a triangle, and comparing it to previou

[racket] Svannah fractals.

2010-11-12 Thread Ken Hegeland
I have a nearly working code, it draws the tree, but it is slightly off. I realize what is wrong that is causing the problem, for each recursive call I used a set angle. The tree draws all the left branches at the same angle and all right branches at the same angle. I end up with a picture of a

Re: [racket] Svannah fractals.

2010-11-13 Thread Ken Hegeland
I suppose I should have clarified that, yes, its from the book, section 27.1.4. --- On Sat, 11/13/10, Noel Welsh wrote: From: Noel Welsh Subject: Re: [racket] Svannah fractals. To: "Ken Hegeland" Cc: us...@lists.racket-lang.org Date: Saturday, November 13, 2010, 7:35 AM I this in

[racket] [Racket]27.3.5, 27.3.6 htdp

2010-11-19 Thread Ken Hegeland
Hi, Im sorry if I appear to be coming here a lot, just having trouble with the algorithm section more than any others. http://www.htdp.org/2001-01-18/Book/node145.htm I believe I completed find-root-linear, which to me seems like just testing if a number in the table is a root of some function,

[racket] 27.5.4 Gaussian Elimination

2010-11-22 Thread Ken Hegeland
The problem is 27.5.4 can be found at http://htdp.org/2003-09-26/Book/curriculum-Z-H-34.html#node_sec_27.5 I am still on the beginning of this extended exercise and I am entirely lost. I know how it works but can't get anything even remotely close. I was able to create subtract from 27.5.2, but

[racket] Missionaries and cannibals

2010-11-29 Thread Ken Hegeland
The exercise can be found at:http://htdp.org/2003-09-26/Book/curriculum-Z-H-40.html#node_sec_32.2 I am stuck at 32.2.6-.7 I originally had some information incorrect and was able to get mc-solution working correctly, except it didn't need someone to remain on the boat at all times. So it just

Re: [racket] Missionaries and cannibals

2010-11-29 Thread Ken Hegeland
on. --- On Tue, 11/30/10, Matthias Felleisen wrote: From: Matthias Felleisen Subject: Re: [racket] Missionaries and cannibals To: "Ken Hegeland" Cc: us...@lists.racket-lang.org Date: Tuesday, November 30, 2010, 3:19 AM 1. Your sketch sounds about right. The problem is probably sticking to

Re: [racket] Missionaries and cannibals

2010-11-30 Thread Ken Hegeland
gal also return false if input matches some item in history. This would allow me to filter out all illegal moves and previously seen moves. --- On Tue, 11/30/10, Matthias Felleisen wrote: From: Matthias Felleisen Subject: Re: [racket] Missionaries and cannibals To: "Ken Hegelan

Re: [racket] Missionaries and cannibals

2010-12-01 Thread Ken Hegeland
figure out a way to produce false. --- On Tue, 11/30/10, Matthias Felleisen wrote: From: Matthias Felleisen Subject: Re: [racket] Missionaries and cannibals To: "Ken Hegeland" Cc: us...@lists.racket-lang.org Date: Tuesday, November 30, 2010, 2:08 PM Ken, you have not absorbed t

Re: [racket] Missionaries and cannibals

2010-12-01 Thread Ken Hegeland
Figured it out, thanks for all the help Matthias. --- On Tue, 11/30/10, Matthias Felleisen wrote: From: Matthias Felleisen Subject: Re: [racket] Missionaries and cannibals To: "Ken Hegeland" Cc: us...@lists.racket-lang.org Date: Tuesday, November 30, 2010, 11:12 PM On Nov 30, 201

[racket] Encapsulation

2010-12-09 Thread Ken Hegeland
I am working on 39.1.8 of HTDP http://htdp.org/2003-09-26/Book/curriculum-Z-H-49.html#node_sec_39.1 I have the gui all set up. The examples in the book use: (define friends (make-address-book "friends")) and then applies friends to the argument, 'add, or 'search. My thought was a basic list proce

[racket] Mouse events

2010-12-20 Thread Ken Hegeland
I wasn't quite sure what to name this, it is a two part question. I am nearly done with HTDP, and I am starting a small project of my own to make a simple turn based rpg. Its mostly structure mutation. My goal is to use draw mazes on the canvas and then have a character item(most likely a solid

Re: [racket] Basic Racket Question

2010-12-21 Thread Ken Hegeland
While you got it working, you are over complicating the process. First you defined that variables, that's fine (define tax-rate .15) (define pay-rate 12) The function net-pay only needs one input, the amount of hours you are working. With the defined pay-rate and tax-rate, how would you determi

[racket] placing-queen 43.3.1

2010-12-22 Thread Ken Hegeland
I am just about done with the book, only a few more exercises. The method I went at for this problem was to just set the initial position to false and then recur on the interval. My thinking is, to make all the spots the queen threatens on a horizontal, you would leave the y and adjust the x.

Re: [racket] Defining Variables in a function

2011-01-02 Thread Ken Hegeland
The idea of embedding a program inside another is learned later in the book, check on local to see how it works, or don't worry about embedding until later on. Simply define the function for now to just produce the amount of tax, 0, .15, or .28. So the program should work like this (equal? (t

Re: [racket] Couldn't find a step matching that criterion

2011-01-09 Thread Ken Hegeland
Also, Evaluate (check-color 'red 'red 'green 'red) find out what you expect the answer and then step through it and see what happens. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Couldn't find a step matching that criterion

2011-01-09 Thread Ken Hegeland
I apologize, meant to say check: (check-color 'red 'red 'red 'green) _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Couldn't find a step matching that criterion

2011-01-09 Thread Ken Hegeland
Does (check-color 'red 'red 'red 'green) seem like a perfect match? Now check (check-color 'green 'red 'red 'red) it's a very minor coding error I wanted to point out to sayth ________ From: Stephen Chang To: Ken Hegela