Hi,

Dan Gildea <[email protected]> writes:

> In guile 2.0, I need to use "define*" to define second-order functions
> such as:
>
> (define* ((f a) b) ...)

You should use (ice-9 curried-definitions) for this (see NEWS), and...

> But define* doesn't work for higher-order functions, or for more
> complicated definitions of second-order functions, such as:
>
> (define* (((f a) b) c) ...)
>
> (define* ((f #:optional a) b) ...)

it also works for optional/keyword arguments:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (use-modules(ice-9 curried-definitions))
scheme@(guile-user)> (define* ((f #:optional a) b) (list a b))
scheme@(guile-user)> ((f) 2)
$2 = (#f 2)
scheme@(guile-user)> ((f 1) 2)
$3 = (1 2)
--8<---------------cut here---------------end--------------->8---

Hope this helps,
Ludo’.

Reply via email to