On 29.06.10 08:37, Ketil Malde wrote:
Albert Y.C.Lai writes:
The doc of deleteBy states: "The deleteBy function behaves like delete, but
takes a user-supplied equality predicate." A precondition is that the
user-supplied predicate is an equality predicate. (>=) is not an equality
predicate, be
Daniel Fischer writes:
> On Tuesday 29 June 2010 13:02:20, Ivan Lazar Miljenovic wrote:
>>
>> That's like asking why we have mapM and forM, etc.
>
> Yes, why?
>
> (okay, I use forM too, it's so much more readable with a short list and a
> long action)
Exactly; using "deleteBy p" (if it was fixe
On Tuesday 29 June 2010 13:02:20, Ivan Lazar Miljenovic wrote:
>
> That's like asking why we have mapM and forM, etc.
Yes, why?
(okay, I use forM too, it's so much more readable with a short list and a
long action)
___
Haskell-Cafe mailing list
Haskell
On Tuesday 29 June 2010 12:50:34, Ketil Malde wrote:
> Daniel Fischer writes:
> >> An important point of a powerful type system is to model your program
> >> so that only sensible code is legal.
> >
> > That would be an awesomely powerful type system :)
>
> Heh. But while we're waiting for it, we
Daniel Fischer writes:
> That's more common, yes (I don't remember ever having used delete(By)
> intentionally). But we've filter for that, so it wouldn't make sense to
> give delete(By) the same semantics. Hence, if you provide both names, what
> else could deleteBy do?
That's like asking wh
On Tuesday 29 June 2010 12:46:21, Ivan Lazar Miljenovic wrote:
>
> At most one element, yes; I question why that design decision was made
> as I'm more likely to want to delete all values rather than just the
> first one
That's more common, yes (I don't remember ever having used delete(By)
intent
Daniel Fischer writes:
>> An important point of a powerful type system is to model your program so
>> that only sensible code is legal.
> That would be an awesomely powerful type system :)
Heh. But while we're waiting for it, we can try to use what we got to
eliminate as much non-sensical code
Ketil Malde writes:
> Max Rabkin writes:
>
>> Your deleteBy is (filter . not), isn't it?
>
> With the caveat that I haven't actually used it, my impression is that
> delete only removes one element, while filter removes all of them.
At most one element, yes; I question why that design decision
Max Rabkin writes:
> Your deleteBy is (filter . not), isn't it?
With the caveat that I haven't actually used it, my impression is that
delete only removes one element, while filter removes all of them.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
_
Max Rabkin writes:
> On Tue, Jun 29, 2010 at 11:46 AM, Ketil Malde wrote:
>> deleteBy :: (a -> Bool) -> [a] -> [a]
>>
>> I don't think there would be any doubt what 'deleteBy (<= 5) [1..10]'
>> would do. And I just don't see what the requirement for an equivalence
>> relation buys you.
>
> Your
On Tuesday 29 June 2010 11:46:47, Ketil Malde wrote:
>
> An important point of a powerful type system is to model your program so
> that only sensible code is legal.
That would be an awesomely powerful type system :)
> This makes me wonder why deleteBy is
> defined so loosely, instead of e.g.
>
>
On Tue, Jun 29, 2010 at 11:46 AM, Ketil Malde wrote:
> deleteBy :: (a -> Bool) -> [a] -> [a]
>
> I don't think there would be any doubt what 'deleteBy (<= 5) [1..10]'
> would do. And I just don't see what the requirement for an equivalence
> relation buys you.
Your deleteBy is (filter . not), is
Daniel Fischer writes:
>> Maybe it is because deleteBy is defined wrongly? i.e. it is not logical,
>> doesn't follow the common sense user might expect. It accepts any
>> predicate but narrows requirements only in docs.
> Unfortunately, you can't easily encode the requirement that it ought to be
On Tuesday 29 June 2010 10:47:40, Zura_ wrote:
> Maybe it is because deleteBy is defined wrongly? i.e. it is not logical,
> doesn't follow the common sense user might expect. It accepts any
> predicate but narrows requirements only in docs.
Unfortunately, you can't easily encode the requirement th
Maybe it is because deleteBy is defined wrongly? i.e. it is not logical,
doesn't follow the common sense user might expect. It accepts any predicate
but narrows requirements only in docs.
Maybe best could be to just take a value for comparison and use "==" against
it? ("overloaded" or "built-in"
On Mon, Jun 28, 2010 at 07:44:34PM +, Albert Y.C.Lai wrote:
> I propose that at each minor version of base, someone picks an implementation
> randomly.
>
> Here is a more radical, less labour-intensive solution, if you don't mind a
> judicious, correctness-preserving use of unsafePerformIO: at
Excerpts from Albert Y.C.Lai's message of Mon Jun 28 15:44:34 -0400 2010:
> I propose that at each minor version of base, someone picks an implementation
> randomly.
This has actually been done, in a legitimate language implementation.
Check out:
http://web.mit.edu/~axch/www/scheme/choices/non-as
Albert Y.C.Lai writes:
> The doc of deleteBy states: "The deleteBy function behaves like delete, but
> takes a user-supplied equality predicate." A precondition is that the
> user-supplied predicate is an equality predicate. (>=) is not an equality
> predicate, be it in the layperson sense of "it
On Jun 28, 2010, at 2:29 PM, Luke Palmer wrote:
> I proposed the following solution:
>
> http://lukepalmer.wordpress.com/2009/07/01/on-the-by-functions/
Seconded! I always want xxxOn and I almost never (perhaps never*) want xxxBy
for xxx in sort, maximum, group and nub.
- Mark
(*) A
In the case of 'deleteBy' we can improve an API.
deleteBy eq x xs == deletePred (eq x) xs
@deletePred pred xs@ removes the first element of @xs@ which satisfies a
predicate @p...@.
Your solution is more general. :)
On 28.06.10 22:44, Albert Y.C.Lai wrote:
And then some programmers are in a
On Mon, Jun 28, 2010 at 1:44 PM, Albert Y.C.Lai wrote:
> Why should anyone expect
>
> deleteBy (>=) 5 [0..10]
>
> to accomplish anything meaningful, if he/she respects the written docs?
I proposed the following solution:
http://lukepalmer.wordpress.com/2009/07/01/on-the-by-functions/
>
> Tod
Some docs are in a miserable state of being incomplete.
And then some programmers are in a miserable state of not respecting docs
when the docs are complete.
Why should anyone expect
deleteBy (>=) 5 [0..10]
to accomplish anything meaningful, if he/she respects the written docs?
Today someone
22 matches
Mail list logo