Email list hosting service & mailing list manager


Re: Alternative formulations of keywords Eli Barzilay 12 Apr 2006 12:29 UTC

On Apr 12, John Cowan wrote:
> Marc Feeley scripsit:
> > For example can your proposed approach work in this case:
> >
> >    (define (f g)
> >      (g foo: 11 bar: 22))
>
> Plainly no.  The compiler should cough with "keywords in call of unknown
> function".
>
> > or in this case:
> >
> >    (define (f #!key (x 11) (y 22)) (+ x y))
> >    (define (g z) (f y: z))
> >    (define (h) (set! f (lambda (#!key (y 33) (z 44)) (* y z))))
>
> Again, plainly no.  [...]
>
> In short, the definition of a function must be either global or
> lexically apparent for it to be callable with keywords.

And there goes all hope of using higher order functions with keywords,
if theses restrictions are used.  (My guess is that you really want
ocaml keyword arguments, which are something completely different than
most use of keywords in the Lisp/Scheme world.)

--
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!