[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Imlib2 question
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] Imlib2 question |
Date: |
Mon, 24 Sep 2007 22:42:22 +0200 |
User-agent: |
Mutt/1.4.2.3i |
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
pgpmsfivGnOFe.pgp
Description: PGP signature
- [Chicken-users] Imlib2 question, William Ramsay, 2007/09/24
- Re: [Chicken-users] Imlib2 question, Alex Queiroz, 2007/09/24
- Re: [Chicken-users] Imlib2 question, William Ramsay, 2007/09/24
- Re: [Chicken-users] Imlib2 question, Graham Fawcett, 2007/09/24
- Re: [Chicken-users] Imlib2 question, William Ramsay, 2007/09/25
- Re: [Chicken-users] Imlib2 question, Peter Bex, 2007/09/25
- Re: [Chicken-users] Imlib2 question, Alex Queiroz, 2007/09/25
- Re: [Chicken-users] Imlib2 question, Graham Fawcett, 2007/09/25
- Re: [Chicken-users] Imlib2 question, John Cowan, 2007/09/25
- Re: [Chicken-users] Imlib2 question, John Cowan, 2007/09/25
- Re: [Chicken-users] Imlib2 question,
Peter Bex <=
- Re: [Chicken-users] Imlib2 question, Peter Bex, 2007/09/24
- Re: [Chicken-users] Imlib2 question, Graham Fawcett, 2007/09/24
- Re: [Chicken-users] Imlib2 question, Zbigniew, 2007/09/25