Hi, there.  I have just started playing with Racket and would like some help 
with using streams/generators (I am not particularly versed in programming in a 
functional style and am attempting to learn :-))

So I have a function called (new-name) that creates a random name, like "Bob 
Brown" or "Jill Xi".  It looks something like

 (define (new-name ethnicity sex)
  ; return a string like "First LAST" based on ethnicity and sex)

This is all good and dandy and works well.  What I would like to do now is 
something like 

  (define name-gen
    (infinite-generator
       (yield (new-name ethnicity sex))))  ; won't work...

  (get-some-names (name-gen "anglo" "male") 10) ; not sure about this...

Which would, from a generated list or stream, return ten names.  I can do this 
using something like

 (for/list ([i 10])
   (new-name "anglo" "male"))

but that seems to miss out on the goodness of streams/generators.

Any help/tips appreciated.

TIA, .. mark.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to