It seems there's an assumption about the range of the parameter
function and the range of the entire function. That is, I think we're
assuming that the length of the final result is the same as the length
of the result of the first function?

If I'm correct in presuming that constraint, then I think this
indicates that a "more elegant" solution might involve using the
lightweight-dependently-typed vectors approach. Though I can't promise
it will actually be nicer!

Nick

On 12/4/06, Joachim Breitner <[EMAIL PROTECTED]> wrote:
Hi,

while pondering over the four fours problem, I wondered: Is there a
function of type
        (a -> [b]) -> [a -> b]

It looks a bit like sequence when applied in the ((->) a) Monad:
        sequence :: [a -> b] -> a -> [b]
but I was looking for the other direction.

I came up with:
        \g -> map (\n a -> g a !! n) [1..]
which has the desired type and functionality, but it looks rather
inelegant and messy. Any better ideas?

Thanks,
Joachim

--
Joachim "nomeata" Breitner
  mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C
  JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/
  Debian Developer: [EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to