[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does Guile have a curry form?
From: |
Thien-Thi Nguyen |
Subject: |
Re: Does Guile have a curry form? |
Date: |
Thu, 02 Dec 2010 09:17:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
() Marek Kubica <address@hidden>
() Thu, 2 Dec 2010 05:45:56 +0100
Before I reinvent the wheel, does Guile have support for
something similar to Racket's curry/curryr or Pythons
functools.partial, which returns me a lambda with some
arguments already pre-set?
If you mean:
(define ((foo x) y)
(+ x y))
===
(define (foo x)
(lambda (y)
(+ x y)))
with usage, e.g.:
(map (foo 1) (iota 3))
=> (1 2 3)
then, yes, prior to Guile 1.9, this was supported out of the box.
With 1.9 and later you must:
(use-modules (ice-9 curried-definitions))
first. I wonder if there is a way to autoload that module, to
achieve the pre-1.9 (out of the box) behavior.