Re: [Chicken-users] Imlib2 question

2007-09-25 Thread William Ramsay
Once I spelled receive correctly it works like a champ.   Thanks.I 
cannot

get over what a great language Scheme is and what a great system Chicken is.
Why would anyone use anything else?

Thanks again.What I was missing in trying to use receive was that 
the results

must be handled inside the body of the procedure.

Bill

Graham Fawcett wrote:

On 9/24/07, William Ramsay [EMAIL PROTECTED] 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.
The call to (imlib:pixel img x y) should return the  r, g, b, a  values
of the  pixel.   Just calling it produces r.   The others are there, but how do 
 I get them?



I don't know imlib; but try:
(receive (r g b a) (imlib:pixel img x y)
  (print r is  r)
  (print b is  b))

Graham

  



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-25 Thread Peter Bex
On Tue, Sep 25, 2007 at 09:04:19AM -0400, William Ramsay wrote:
 Once I spelled receive correctly it works like a champ.   Thanks.I 
 cannot
 get over what a great language Scheme is and what a great system Chicken is.
 Why would anyone use anything else?

Would you mind convincing my boss?  :)

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


pgprzbJYK9ix0.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-25 Thread John Cowan
William Ramsay scripsit:

 Thanks again.What I was missing in trying to use receive was that 
 the results
 must be handled inside the body of the procedure.

If you actually want a list, it's easy to get one with

(receive foo (whatever x y z) foo)

-- 
John Cowan[EMAIL PROTECTED]http://ccil.org/~cowan
   There was an old manSaid with a laugh, I
 From Peru, whose lim'ricks all  Cut them in half, the pay is
   Look'd like haiku.  He  Much better for two.
 --Emmet O'Brien


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-25 Thread Alex Queiroz
Hallo,

On 9/25/07, Peter Bex [EMAIL PROTECTED] wrote:
 On Tue, Sep 25, 2007 at 09:04:19AM -0400, William Ramsay wrote:
  Once I spelled receive correctly it works like a champ.   Thanks.I
  cannot
  get over what a great language Scheme is and what a great system Chicken is.
  Why would anyone use anything else?

 Would you mind convincing my boss?  :)


 Get into the queue! :-)

Cheers,
-- 
-alex
http://www.ventonegro.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-25 Thread Graham Fawcett
On 9/25/07, Alex Queiroz [EMAIL PROTECTED] wrote:
 On 9/25/07, Peter Bex [EMAIL PROTECTED] wrote:
  On Tue, Sep 25, 2007 at 09:04:19AM -0400, William Ramsay wrote:
   Why would anyone use anything else?
  Would you mind convincing my boss?  :)
  Get into the queue! :-)

For what it's worth, I *did* convince my boss; I've used Chicken to
write a set of Web applications to supplement one of our campus
systems. None of the apps was supposed to last more than a semester --
we expected that the primary system itself would grow the same
features during that time -- so they were somewhat willing to let me
take a couple risks. But that was two semesters ago, and the Chicken
apps are still in business.

They've only served about 2 million requests so far (about 10,000 per
day right now), which is far from huge, but they can take a heavier
load. Lord knows I've had a couple problems with them (mostly
self-inflicted ones), but overall it's been a tremendous win.

Some of the things I would have used in my elevator pitch for Chicken
(keeping in mind that Web apps are my thing):

- running an application in a REPL (no compilation step; redefine
  anything you want, any time) is the rapidest development environment
  you can get, bar none.

- It's also a great maintenance environment; almost all bugs can be
  corrected live, without restarting a single process.

- works with all major databases (don't use that Fawcett guy's Oracle
  driver, though, it's a piece of crap); works great without them,
  too.

- can use third-party libraries written in C, Java, Python.

- You can compile the stuff that needs to run faster. Web apps don't
  tend to have too many hotspots, though.

- Chicken and Scheme are relatively easy to learn, and there are
  plenty of resources available.

- works great in a Unix environment, where forking processes is cheap:
  you can write small, fast programs that are suitable for Unix-style
  design (forks, pipes, etc.). Try *that* with Java. This is a good
  approach for shared-nothing, highly-scalable apps. Not that I wrote
  mine that way... ;-)

- What the community lacks in size, it makes up for in brain-power and
  supportiveness.

Everyone here knows that stuff, of course. ;-)

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-25 Thread John Cowan
Graham Fawcett scripsit:

 Some of the things I would have used in my elevator pitch for Chicken
 (keeping in mind that Web apps are my thing):

These should be posted to the Wiki.

-- 
John Cowan   [EMAIL PROTECTED]http://ccil.org/~cowan
Original line from The Warrior's Apprentice by Lois McMaster Bujold:
Only on Barrayar would pulling a loaded needler start a stampede toward one.
English-to-Russian-to-English mangling thereof: Only on Barrayar you risk to
lose support instead of finding it when you threat with the charged weapon.


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-24 Thread Alex Queiroz
Hallo,

On 9/24/07, William Ramsay [EMAIL PROTECTED] wrote:
 Hi,

 Can anyone explain to me how to get the four values from the imlib2 egg
 procedure  (imlib:pixel/rgba img x y)?   It seems to only return the
 first value,
 but it's supposed to return four values.   This may be more of a scheme
 question than an imlib2 question, but either way I can't seem to get it
 to work.


 Are you using RECEIVE or LET-VALUES?

Cheers,
-- 
-alex
http://www.ventonegro.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-24 Thread William Ramsay

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?

The call to (imlib:pixel img x y) should return the  r, g, b, a  values 
of the
pixel.   Just calling it produces r.   The others are there, but how do 
I get

them?

confused

Alex Queiroz wrote:

Hallo,

On 9/24/07, William Ramsay [EMAIL PROTECTED] wrote:
  

Hi,

Can anyone explain to me how to get the four values from the imlib2 egg
procedure  (imlib:pixel/rgba img x y)?   It seems to only return the
first value,
but it's supposed to return four values.   This may be more of a scheme
question than an imlib2 question, but either way I can't seem to get it
to work.




 Are you using RECEIVE or LET-VALUES?

Cheers,
  



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-24 Thread Graham Fawcett
On 9/24/07, William Ramsay [EMAIL PROTECTED] 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.
 The call to (imlib:pixel img x y) should return the  r, g, b, a  values
 of the  pixel.   Just calling it produces r.   The others are there, but how 
 do  I get them?

I don't know imlib; but try:
(receive (r g b a) (imlib:pixel img x y)
  (print r is  r)
  (print b is  b))

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Imlib2 question

2007-09-24 Thread Peter Bex
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


Re: [Chicken-users] Imlib2 question

2007-09-24 Thread Peter Bex
On Mon, Sep 24, 2007 at 10:42:22PM +0200, Peter Bex wrote:
 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!

Sorry for the outburst...

*blushes*

:)

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


pgpV3aO4hNM2h.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users