chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] is case-lambda expensive?


From: Kon Lovett
Subject: Re: [Chicken-users] is case-lambda expensive?
Date: Wed, 24 May 2006 11:13:50 -0700

On May 24, 2006, at 10:33 AM, Matthew David Parker wrote:




Ex: (w/ csi)

#;1> (define (msdl.pixel x y rgb alpha #!optional (img 0)) 'foo)
#;2> (procedure-information msdl.pixel)
(msdl.pixel x y rgb alpha #!optional (img 0))
#;3> (msdl.pixel 3)
Error: too few arguments - received 1 but expected 4: #<procedure
(msdl.pixel x y rgb alpha #!optional (img 0))>

         Call history:

         <eval>          (msdl.pixel 3)  <--


That is just want I want; for it to throw an error and then print out the info, but I have to define and compile my functions in csc first, so I get the weird errors will all the numbers after them. Is there some way to
clean up the debug output from functions that come from csc?

I don't think so. I don't see an 'invalid-procedure-call-arity- handler.' And the name of the optional is lost w/ the compiler. Umm, hook 'error'? Sorry.

Is it better
to use the #!optional thing instead of case-lambda? (I have to use one of
those for the img argument at least).

Hum, "better." Funny, for a "small" programming notation Scheme seems to have an almost Perl-like mania for multiple ways to do the same thing.

Personal style & portability.

case-lambda can be repetitive & no support for named arguments but it is a srfi.

I find the DSSSL lambdas easier to read, but NOT portable. (Marc Feeley has a draft srfi-89 to replace DSSSL w/ a more scheme-like notation.)

I think 'let-optionals' & ':optional' are by Olin Shivers from Scsh, and rather common.


Matt


And (w/ csc)

Error: too few arguments - received 1 but expected 4: #<procedure
(msdl.pixel x3 y4 rgb5 alpha6 . g27)>

         Call history:

         t1.scm: 3    msdl.pixel                 <--


Thanks,
Matt

(btw, "msdl" is just a temporary name, as there is already an
"msdl" for
SDL)


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




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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]