[Haskell-cafe] General function to count list elements?
Lennart Augustsson
lennart at augustsson.net
Sun Apr 19 18:45:29 EDT 2009
And when the need gets big enough you pull out StablePtr and use that. :)
On Sun, Apr 19, 2009 at 10:43 PM, Peter Verswyvelen <bugfact at gmail.com> wrote:
> Sometimes I do miss the pragmatic C solution:
> - two function pointers that are equal surely represent the same functions
> (although in C nothing is really sure ;)
> - two function pointers that are different, might or might not represent
> that same functions.
> But this weak equality can sometimes be handy.
> For example, suppose you have a predicate a -> Bool, and a list of these
> predicates [a -> Bool], but you want to remove all functions that are
> obviously equal in the C way from the list for optimization... Okay big
> hack, and one could do this already with reallyUnsafePtrEquality# I guess...
> On Sat, Apr 18, 2009 at 6:02 PM, John A. De Goes <john at n-brain.net> wrote:
>>
>> Two functions are equal iff they have the same domain and range and the
>> same outputs for the same inputs. Simple to state, but extremely difficult
>> to implement in a useful way, and impossible to implement in a perfect way.
>>
>> If you had a compiler or algorithm capable of determining function
>> equality, you could use it to prove or disprove arbitrary theorems in
>> mathematics.
>
> _______________________________________________
> 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