On 2 Dec 2010, at 17:06, Hans Aberg wrote:

Another problem: passing a list of length two to a function that takes two non-arguments. For example,
 (define h (lambda (x y) (display x) (display y)))
and passing (list 1 2) to it.

It is in the same context as before: I want to build functions like in Haskell
 f((1, 2), 3) where f = \((x, y), z) -> (x, y, z)
 --> (1,2,3)

I found that this is possible by:
(define f (lambda (a z) (primitive-eval (cons (lambda (x y) (+ x y z)) a))))
Then
  (f (list 1 2) 3) --> 6

The primitive "list" is important here, as shown in the examples by Keith. So it seems one should type data-lists by adding this symbol. But it is not available in the C-interface as symbol, so I added it in my interface, and in fact a variation called "tuple", which is the same as "list", only that (tuple x) --> x.


Reply via email to