Re: [racket] Problem Stream with alternating values

2013-05-21 Thread Patrick Sweetman
You are correct in this, Shannon, and you have nicely explained all of the otherwise confusing clues about thunks. I shall revisit these problems from the point of view of view of the course. The section of Dan Grossman's video lectures that deal with Racket are an excellent introduction to the

Re: [racket] Problem Stream with alternating values

2013-05-21 Thread Shannon Severance
Patrick, > I saw that. The requirement for a stream of alternating values was > clearly stated, but then it confusingly talked about the internal > structure of a stream. Surely if the stream is constructed by > stream primitives then it will all be thunked. Or do you read the > problem as requi

Re: [racket] Problem Stream with alternating values

2013-05-21 Thread Jos Koot
domingo, 19 de mayo de 2013 21:20 > To: users@racket-lang.org > Subject: Re: [racket] Problem Stream with alternating values > > On 19/05/2013 21:22, Jos Koot wrote: > > Your function H1 is not lazy enough. > > > > Closely following the instructions of the exercise

Re: [racket] Problem Stream with alternating values

2013-05-19 Thread Patrick Sweetman
t; > Jos > >> -Original Message- >> From: users-boun...@racket-lang.org >> [mailto:users-boun...@racket-lang.org] On Behalf Of Patrick Sweetman >> Sent: jueves, 16 de mayo de 2013 14:31 >> To: users@racket-lang.org >> Subject: [racket] Problem Stream w

Re: [racket] Problem Stream with alternating values

2013-05-19 Thread Patrick Sweetman
so ... the H1 recursion is evaluating it's arguments, producing a list instead of a stream? I based this on the ones function with the H1 helper function to act as a toggle. However, closer adherence to the 'ones' example and consing both values at the same time works just fine, and is much more

Re: [racket] Problem Stream with alternating values

2013-05-19 Thread Jos Koot
jueves, 16 de mayo de 2013 14:31 > To: users@racket-lang.org > Subject: [racket] Problem Stream with alternating values > > I'm doing this problem: > > 6. Write a stream dan-then-dog, where the elements of the stream > alternate between the strings "dan.jpg" and

Re: [racket] Problem Stream with alternating values

2013-05-18 Thread Robby Findler
If you were to replace stream-cons with this function: (define (not-stream-cons x y) (printf "x ~s y ~s\n" x y) 'something-random) would it make sense to you what happens? Robby On Thu, May 16, 2013 at 7:30 AM, Patrick Sweetman wrote: > I'm doing this problem: > > 6. Write a stream dan-then-d

[racket] Problem Stream with alternating values

2013-05-18 Thread Patrick Sweetman
I'm doing this problem: 6. Write a stream dan-then-dog, where the elements of the stream alternate between the strings "dan.jpg" and "dog.jpg" (starting with "dan.jpg"). More specically, dan-then-dog should be a thunk that when called produces a pair of "dan.jpg" and a thunk that when called produ