On Mon, Sep 24, 2007 at 04:29:25PM -0400, William Ramsay wrote: > That's the problem, I don't know what to use. I've tried call-with-values > and receive, but both give me errors, mostly because I have no idea what > I'm doing. Receive expects (name1 name2 ...) valexp body, but this > produces an error since name1 is not a command. > > Why not just return a list and make it simple?
Because the pixel routines conceptually return four values, _not_ one value which is a list. > The call to (imlib:pixel img x y) should return the r, g, b, a values > of the pixel. It should, and it does. > Just calling it produces r. Yes, this is (afaik) a deviation from the standard. I don't like it one bit, precisely for this reason: it's damned confusing. I want an error if I forgot to receive all values, I don't want the first value, dammit! (that's what it does; it discards all values except the first) Complain to Felix about this if you don't like it :) > The others are there, but how do I get them? (receive (r g b a) (imlib:pixel/rgba img x y) (do-something-with r g b a)) Alternatively, (call-with-values (lambda () (imlib:pixel/rgba img x y)) (lambda (r g b a) ...)) > confused.... Hope this helps! Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth
pgpdJYQlYalZe.pgp
Description: PGP signature
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users