[Haskell-beginners] List operations

KC kc1956 at gmail.com
Thu May 19 17:52:05 CEST 2011


By the way, you don't need the "flip" function.

map (** 3) [0,1..10]

[ x ** 3 | x <- [0,1..10]]

The section (** 3) will figure out on which side to put the argument/operand.

See http://www.haskell.org/haskellwiki/Section_of_an_infix_operator


2011/5/19  <jianqiuchi at gmail.com>:
> OK, I see. Thanks a lot.
>
> Cheers, =)
>
> ,Felipe Almeida Lessa <felipe.lessa at gmail.com>撰写:
>> On Thu, May 19, 2011 at 11:05 AM,  jianqiuchi at gmail.com> wrote:
>>
>> > I have a question about the cost of list comprehension and map function.
>>
>> >
>>
>> > 1. [x ** 3 | x
>> > 2. map (flip (**) 3) list
>>

-- 
--
Regards,
KC



More information about the Beginners mailing list