On Fri, Apr 23, 2004 at 10:11:40AM +0100, Malcolm Wallace wrote:
If the pattern is very common, how about just naming it?
perhaps cond f field = if cond then f field else field
foo { bar = perhaps cond0 f (bar foo)
, wib = perhaps cond1 g (wib foo) }
Good idea, but I think
Malcolm Wallace wrote:
perhaps cond f field = if cond then f field else field
foo { bar = perhaps cond0 f (bar foo)
, wib = perhaps cond1 g (wib foo) }
I tend to write functions:
upd_bar f x = x { bar = f (bar x) }
upd_wib f x = x { wib = f (wib x) }
in order to avoid mentioning
I would just do:
f' = if cond0 then f else id
g' = if cond1 then g else id
foo { bar = f' (bar foo) , wib = g' (wib foo) }
I like seeing the record updated, rather than hiding it
in a function.
Regards,
Keean.
At 18:18 22/04/04 -0400, Mark Carroll wrote:
I have data objects where each component is a labelled field through which
I access or modify it.
Wading into the labelled field debate...
I have found that using the labelled field update syntax can lead to
difficulties in changing the underlying
On Wed, 21 Apr 2004 14:57:57 +0100, you wrote:
How about implementing a directly recursive solution? Simply
accumulate the sum so far, together with the list elements you have
already peeled off. Once the sum plus the next element would exceed
the threshold, emit the accumulated elements, and
Graham Klyne [EMAIL PROTECTED] writes:
At 18:18 22/04/04 -0400, Mark Carroll wrote:
I have data objects where each component is a labelled
field through which I access or modify it.
Wading into the labelled field debate...
I have found that using the labelled field update syntax
can lead
Here's a really elementary question:
Why does the library have [FiniteMap and Set] instead of [FiniteMap and
FiniteSet] or just [Map and Set]? Is there some reason for this
inconsistency?
Thanks,
James
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
On Fri, Apr 23, 2004 at 08:02:47PM -0500, [EMAIL PROTECTED] wrote:
Why does the library have [FiniteMap and Set] instead of [FiniteMap and
FiniteSet] or just [Map and Set]? Is there some reason for this
inconsistency?
Historical accident mainly.
There is discussion going on in the haskell