unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* apply
@ 2005-08-03  8:38 Aurelien Chanudet
  2005-08-03 12:17 ` apply Mikael Djurfeldt
  0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Chanudet @ 2005-08-03  8:38 UTC (permalink / raw)


Hi all,

Consider the following code :

guile> (define x '( (1 1) (2 2) (3 3) ))
guile> (apply (lambda (a b c) (map list a b c) x)
((1 2 3) (1 2 3))

I can't figure out a concise an elegant way to achieve the same result
using a lambda form that will work whatever the length of x. Any
suggestion ?

Thanks,
Aurelien


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: apply
  2005-08-03  8:38 apply Aurelien Chanudet
@ 2005-08-03 12:17 ` Mikael Djurfeldt
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Djurfeldt @ 2005-08-03 12:17 UTC (permalink / raw)
  Cc: guile-user, Mikael Djurfeldt

On 8/3/05, Aurelien Chanudet <aurelien.chanudet@gmail.com> wrote:
> Hi all,
> 
> Consider the following code :
> 
> guile> (define x '( (1 1) (2 2) (3 3) ))
> guile> (apply (lambda (a b c) (map list a b c) x)
> ((1 2 3) (1 2 3))
> 
> I can't figure out a concise an elegant way to achieve the same result
> using a lambda form that will work whatever the length of x. Any
> suggestion ?

Well, using a lambda form in the same way as above, it would be:

  (apply (lambda args (apply map list args)) x)

but it's simpler to do

  (apply map list x)

M


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2005-08-03 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-03  8:38 apply Aurelien Chanudet
2005-08-03 12:17 ` apply Mikael Djurfeldt

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).