[plt-scheme] some more frtime questions

From: Dave Griffiths (dave at pawfal.org)
Date: Thu Jan 31 14:16:52 EST 2008

On Wed, 2008-01-30 at 17:54 -0500, Gregory Cooper wrote:
> Hi Dave,
> 
> > > Now you have an event stream whose values are behaviors.  You can use
> > > 'switch' to switch repeatedly to the most recent one:
> > > (define last-bullet (switch bullet-e))
> 
> Did you try the single-bullet version?  Does that work?

Yes, that's all working perfectly - and I even understand it I think :)

> > > Of course, now if you fire rapidly, only the last bullet will be
> > > drawn.  If you want to display several bullets at a time, you'll need
> > > to collect them into a list.
> >
> > So I have more or less everything working and understood so far except
> > for this collecting the bullets into a list business - could I trouble
> > you for more explanation?
> 
> Of course.  Once you have bullet-e (in its original form, without the
> set! ;-), you can collect it into a list with collect-b, filtering out
> all the defunct objects along the way.  Maybe something like:
> 
> (define all-bullets
>   (collect-b bullet-e '() (lambda (bullet lst) (cons bullet (filter
> sphere-struct? lst)))))
> 
> Then you should be able to include all-bullets directly in your scene
> list (no switch needed).  Let me know if you run into any other
> difficulties with this.

Hmm, it seems (I think) that the filter isn't working somehow, I'm
getting the following error when I add it to my scene list. This could
be something I'm doing wrong in my render-scene-list procedure:

../../../../usr/local/lib/plt/collects/fluxus-0.14/frisbee.ss::4553.:
for-each: expects type <proper list> as 2nd argument, given:
#(struct:signal () () #f #<procedure:...time/lang-ext.ss:278:34> 7
#<continuation-mark-set> #<parameterization> (#(struct:signal
#<struct:event-cons> (#<weak-box>) #f #<procedure:thunk> 6
#<continuation-mark-set> #<parameterization> (#(struct:sign...; other
arguments were: #<procedure> 

Sorry it's taking me so long to get all this! Hopefully I should be able
to offer some additional documentation in return for all the help.

The source is here: http://www.pawfal.org/flotsam/frisbee/rocket.scm
Let me know if you can't see it - it seems to randomly ask for a
password.

cheers,

dave




Posted on the users mailing list.