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 Haskell allow a
what-he-wanted
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
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 How do I
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-wanted solution? 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, June 29, 2002 12:58 PM
Subject: Re: Writing a counter function
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 question as
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 allocating
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
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 alternative to
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, 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 the new
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 numbers
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].
Here's
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].
Here's
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
15 matches
Mail list logo