unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Does Guile have a curry form?
@ 2010-12-02  4:45 Marek Kubica
  2010-12-02  8:17 ` Thien-Thi Nguyen
  2010-12-02 14:11 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Kubica @ 2010-12-02  4:45 UTC (permalink / raw)
  To: guile-user

Hi,

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?

regards,
Marek



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does Guile have a curry form?
  2010-12-02  4:45 Does Guile have a curry form? Marek Kubica
@ 2010-12-02  8:17 ` Thien-Thi Nguyen
  2010-12-02 14:11 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2010-12-02  8:17 UTC (permalink / raw)
  To: Marek Kubica; +Cc: guile-user

() Marek Kubica <marek@xivilization.net>
() 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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does Guile have a curry form?
  2010-12-02  4:45 Does Guile have a curry form? Marek Kubica
  2010-12-02  8:17 ` Thien-Thi Nguyen
@ 2010-12-02 14:11 ` Ludovic Courtès
  2010-12-08 14:21   ` Marek Kubica
  1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2010-12-02 14:11 UTC (permalink / raw)
  To: guile-user

Hi,

Marek Kubica <marek@xivilization.net> writes:

> 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?

There’s SRFI-26 (info "(guile) SRFI-26").

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does Guile have a curry form?
  2010-12-02 14:11 ` Ludovic Courtès
@ 2010-12-08 14:21   ` Marek Kubica
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Kubica @ 2010-12-08 14:21 UTC (permalink / raw)
  To: guile-user

Hi,

On Thu, 02 Dec 2010 15:11:59 +0100
ludo@gnu.org (Ludovic Courtès) wrote:

> Marek Kubica <marek@xivilization.net> writes:
> 
> > 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?
> 
> There’s SRFI-26 (info "(guile) SRFI-26").

Thank you, that looks like I was looking for. Good thing I asked.

regards,
Marek



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-08 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02  4:45 Does Guile have a curry form? Marek Kubica
2010-12-02  8:17 ` Thien-Thi Nguyen
2010-12-02 14:11 ` Ludovic Courtès
2010-12-08 14:21   ` Marek Kubica

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).