[Haskell-cafe] Mapping a list of functions

Christopher Done chrisdone at googlemail.com
Sun Jun 20 07:43:23 EDT 2010


I love that. It's great. Definitely going in my .ghci file.

On 20 June 2010 12:28, Liam O'Connor <liamoc at cse.unsw.edu.au> wrote:
> swing map :: forall a b. [a -> b] -> a -> [b]
> swing any :: forall a. [a -> Bool] -> a -> Bool
> swing foldr :: forall a b. b -> a -> [a -> b -> b] -> b
> swing zipWith :: forall a b c. [a -> b -> c] -> a -> [b] -> [c]
> swing find :: forall a. [a -> Bool] -> a -> Maybe (a -> Bool)
>   -- applies each of the predicates to the given value, returning the
> first predicate which succeeds, if any
> swing partition :: forall a. [a -> Bool] -> a -> ([a -> Bool], [a -> Bool])
>
>
> Essentially, the main use case seems to be transforming HOFs that
> operate on a list of values and a single function into HOFs that
> operate on a list of functions and a single value.
>
> Cheers.
> ~Liam
>
>
>
> On 19 June 2010 19:30, Limestraël <limestrael at gmail.com> wrote:
>> ???
>> What does exactly swing do ?
>>
>> 2010/6/18 Bulat Ziganshin <bulat.ziganshin at gmail.com>
>>>
>>> Hello Martin,
>>>
>>> Thursday, June 17, 2010, 11:02:31 PM, you wrote:
>>>
>>> > But what if I want to apply a list of functions to a single argument. I
>>> > can
>>>
>>> one more answer is "swing map":
>>>
>>> http://www.haskell.org/haskellwiki/Pointfree#Swing
>>>
>>>
>>>
>>> --
>>> Best regards,
>>>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list