John Hughes wrote:
> On Sun, 30 Jun 2002, Jon Cast wrote:
>
>>Mark Carroll <[EMAIL PROTECTED]> wrote:
>>
>>>On Sat, 29 Jun 2002, Samuel E. Moelius III wrote:
>>>(snip)
>>>
Here's another not-exactly-what-you-wanted solution. :)
>>>
>>>(snip)
>>
>>>Do any of the experimental extensions to Ha
Mark Carroll <[EMAIL PROTECTED]> wrote:
> On Sun, 30 Jun 2002, Jon Fairbairn wrote:
> (snip)
> > But there's the rub. It's not beautiful and it doesn't make
> > much sense. I really wish we could get away from the "How do
> > I convert this imperative code snippet into Haskell"
> > questions into
Shlomi Fish wrote (on 29-06-02 17:30 +0300):
>
> I'm trying to write a counter function that would return a tuple whose
> first element is the current value and whose second element is a new
> counter.
John Hughes showed how to do this. Here is a closely related, more abstract
solution which emp
G'day all.
On Sun, Jun 30, 2002 at 01:51:56PM +0100, Peter G. Hancock wrote:
> Why not have a monad m a = Int -> (a,Int) which is a state monad plus
> the operation bump : Int -> m Int
>
> bump k n = (n,n+k)
Oh, ye of insufficient genericity. We can do better than that...
import Mo
> lmichele wrote (on Sun, 30 Jun 2002 at 09:26):
> By the way, what's the purpose of this coding? (this is the type of
> question: "ok, I have a hammer, now, for what kind of nail it is useful?")
I would guess that something like the asked-for counter could be
useful if one is allo
On Sun, 30 Jun 2002, Jon Fairbairn wrote:
(snip)
> But there's the rub. It's not beautiful and it doesn't make
> much sense. I really wish we could get away from the "How do
> I convert this imperative code snippet into Haskell"
> questions into "How do I solve this abstract problem?"
The questio
Mark Carrol wrote:
> The beauty of his request was that it was so simple and seemed to make
> sense;
But there's the rub. It's not beautiful and it doesn't make
much sense. I really wish we could get away from the "How do
I convert this imperative code snippet into Haskell"
questions into "How do
s is the type of
question: "ok, I have a hammer, now, for what kind of nail it is useful?")
Cheers,
Luis Michelena
- Original Message -
From: Shlomi Fish <[EMAIL PROTECTED]>
To: Hannah Schroeter <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday,
G'day all.
On Sat, Jun 29, 2002 at 05:26:46PM -0500, Mark Carroll wrote:
> Do any of the experimental extensions to Haskell allow a what-he-wanted
> solution? I couldn't arrange one in H98 without something having an
> infinitely-recursive type signature. I'm sure it would have been easy in
> Li
On Sun, 30 Jun 2002, Jon Cast wrote:
>
> Mark Carroll <[EMAIL PROTECTED]> wrote:
> > On Sat, 29 Jun 2002, Samuel E. Moelius III wrote:
> > (snip)
> > > Here's another not-exactly-what-you-wanted solution. :)
> > (snip)
>
> > Do any of the experimental extensions to Haskell allow a
> > what-he-wa
Mark Carroll <[EMAIL PROTECTED]> wrote:
> On Sat, 29 Jun 2002, Samuel E. Moelius III wrote:
> (snip)
> > Here's another not-exactly-what-you-wanted solution. :)
> (snip)
> Do any of the experimental extensions to Haskell allow a
> what-he-wanted solution? I couldn't arrange one in H98 without
>
On Sat, 2002-06-29 at 15:26, Mark Carroll wrote:
> On Sat, 29 Jun 2002, Samuel E. Moelius III wrote:
> (snip)
> > Here's another not-exactly-what-you-wanted solution. :)
> (snip)
>
> Do any of the experimental extensions to Haskell allow a what-he-wanted
> solution? I couldn't arrange one in H98
On Sat, 29 Jun 2002, Samuel E. Moelius III wrote:
(snip)
> Here's another not-exactly-what-you-wanted solution. :)
(snip)
Do any of the experimental extensions to Haskell allow a what-he-wanted
solution? I couldn't arrange one in H98 without something having an
infinitely-recursive type signatur
> No. But I want to generate an irregular series, which I determine the
> intervals between two consecutive numbers myself. E.g:
>
> let (num1, next1) = (counter 5)
> (num2, next2) = (next1 100)
> (num3, next3) = (next2 50) in
> [num1,num2,num3]
>
> Will have the numbers [5, 105, 155].
> No. But I want to generate an irregular series, which I determine the
> intervals between two consecutive numbers myself. E.g:
>
> let (num1, next1) = (counter 5)
> (num2, next2) = (next1 100)
> (num3, next3) = (next2 50) in
> [num1,num2,num3]
>
> Will have the numbers [5, 105, 155].
On Sat, 29 Jun 2002, Shlomi Fish wrote:
>
> No. But I want to generate an irregular series, which I determine the
> intervals between two consecutive numbers myself. E.g:
>
> let (num1, next1) = (counter 5)
> (num2, next2) = (next1 100)
> (num3, next3) = (next2 50) in
> [num1,num2,num3
Just for the record, here is a Perl function that does this:
###
sub counter
{
my $a = shift;
my $next = sub {
my $to_add = shift ;
return counter($to_add+$a);
};
return ($a, $next);
}
my ($result,$next) = counter(5);
my ($result2, $next2) = $next->
On Sat, 29 Jun 2002, Jon Fairbairn wrote:
> Shlomi Fish wrote:
> > No. But I want to generate an irregular series, which I determine the
> > intervals between two consecutive numbers myself. E.g:
> >
> > let (num1, next1) = (counter 5)
> > (num2, next2) = (next1 100)
> > (num3, next3) = (
Shlomi Fish wrote:
> No. But I want to generate an irregular series, which I determine the
> intervals between two consecutive numbers myself. E.g:
>
> let (num1, next1) = (counter 5)
> (num2, next2) = (next1 100)
> (num3, next3) = (next2 50) in
> [num1,num2,num3]
>
> Will have the n
On Sat, 29 Jun 2002, Hannah Schroeter wrote:
> Hello!
>
> On Sat, Jun 29, 2002 at 06:23:27PM +0300, Shlomi Fish wrote:
> > [...]
>
> > Actually, I'd like a more generalized counter. Something that would return
> > both the number and a handler to add another number, which in turn would
> > return
Hello!
On Sat, Jun 29, 2002 at 06:23:27PM +0300, Shlomi Fish wrote:
> [...]
> Actually, I'd like a more generalized counter. Something that would return
> both the number and a handler to add another number, which in turn would
> return the new sum and a new handler, etc.
That's just what lazy
On Sat, 29 Jun 2002, Mark Carroll wrote:
> On Sat, 29 Jun 2002, Shlomi Fish wrote:
> (snip)
> > counter n = (n,(counter (n+1)))
> (snip)
>
> This doesn't work because you seem to be defining an infinitely deep tuple
> (1,(2,(3,(4,() which is naughty.
>
> I'm not really sure what alternati
On Sat, 29 Jun 2002, Shlomi Fish wrote:
(snip)
> counter n = (n,(counter (n+1)))
(snip)
This doesn't work because you seem to be defining an infinitely deep tuple
(1,(2,(3,(4,() which is naughty.
I'm not really sure what alternative to suggest beyond [n .. ] without
knowing more about wh
23 matches
Mail list logo