Sunday, 31 March 2013

Revisiting Structs

We learned about structs in class awhile back, but recently we had to work with structs in fractal.rkt code. When defining the function of sierpinski I based my definition off the check-expect that was already given in the starter code. It took me awhile and a little frustration until I realized that the struct required me to specify the param-depth and param-base of the function using the placeholder rp.

3 comments:

  1. Yeah, the structs thing we learned a while back kind of had me a bit confused at first. Luckily, with the aid of my partner, I was able to figure out how to complete the code.
    What had me confused for the longest time is that I would subtract 1 from rp, so I'd write param-depth (sub1 rp). Obviously this wouldn't work, but I didn't know that then! It took me a while to figure out where to put the brackets/ subtract one. Hopefully the project is going well for you!

    ReplyDelete
  2. Yeah, I completed it after playing around with the code for about 30 minutes. I also tried just using (sub1 rp) at first.

    ReplyDelete
  3. Sometimes you end up having to reach back for something introduced a long time ago. Because fractal and contrast needed two parameters, I used struct.

    ReplyDelete