Christopher Browne <[EMAIL PROTECTED]> writes:

> The nearest equivalent in Scheme would be to define the function
> thus:

I've also seen a simple solution where you just use:

  (define (foo . args)
    (let ((color (kwd:get-arg 'color: args))
          (size (kwd:get-arg 'size: args)))

    ...)

And then you can call foo like this:

  (foo 'color: 'red 'size: 'big)
  (foo 'size: 'small)

not as elegant as avoiding the quotes and the . arg list, and not as
efficient as a system that can internally handle the optional args as
a hash or switch, but this is workable where speed isn't absolutely
critical.

> [Aside: I find that when I am wondering how to implement something,
> it is a *remarkably* useful idea to look to Common Lisp.  The designers
> hashed through more complex issues with *reasonable* success than just
> about any other computer language.  If you want to build a date library,
> look at the HyperSpec.  If you're not sure how to implement a mathematical
> function, look at the HyperSpec.  They may well explain why the option
> that comes to mind first is actually a very BAD idea...]

CL is an *amazing* mixture of the wonderful and the truly baroque.  It
is by far the system where you're most likely to decide you need
something and then discover that it's already there.

There are things I really like about it, but others that make me, on
balance, prefer Scheme, and if the SRFI's can pick up some steam, they
might be able to provide most of the things I like about CL.  We'll
see.

I do agree that *not* paying attention to how CL got it right, or
wrong in any given case is probably unwise.

-- 
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930

--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]


Reply via email to