guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List functions


From: Hans Aberg
Subject: Re: List functions
Date: Wed, 1 Dec 2010 18:48:56 +0100

On 1 Dec 2010, at 18:35, Joel James Adamson wrote:

It seems natural to translate (f, g) x into ((f g) x), and () x into
(() x), but I'm not sure if the lists (f g) and () can be made acting
as functions this way.

(f g) would evaluate as a composition as long as f takes a procedure as
an argument and returns a function that takes x as its argument.  No
problems there. Alternatively you could think of f returning a function
of x when it evaluates g.

Yes, but in standard syntax would be natural to let (f, g)(x) evaluate to (f(x), g(x)), producing a list of two elements. In Guile, that would be something involving "map". If I try in Haskell, I can let (sin, cos)(2) be the same as
  map (g 2) [sin, cos] where g x = \f -> f x
   -> [0.909297426825682,-0.416146836547142]
But when I try that similar constructs in Guile, I get problems with evaluation.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]