Trying to follow you: is in the following expression applied what you mean by 
different types in the folding?
> Prelude>  foldl (\(x,y) e ->  (y,x+e)) (0,2) [1..5]
> (8,9)

Which I would translate into J like e.g:

    ;({:@],[+{.@])&.>/(;/1+i.5),<0 2
8 9


I can ask Haskell (GHCi interpreter) what this 'whole thing' is typed like:

Prelude> :t foldl (\(x,y) e -> (y,x+e))
foldl (\(x,y) e -> (y,x+e)) :: (Num b) => (b, b) -> [b] -> (b, b)

We have an initial element as tupel (a,a), a list [a] which results in a tupel 
(a,a).
The basic type is here is Num b (Numeric b)  because I apply (+) on b's.
b can be e.g. of type Int, Integer, Double



-- 
Met vriendelijke groet,
=@@i

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to