Hi All,
I got up this morning {after not much sleep} to find these very
helpful suggestions/comments:
from Scott Turner:
{... See: http://www.haskell.org/hawiki/ExistentialTypes ...}
From Bulat Ziganshin:
{...
you can read recent discussion on this in this topic, or look at
http://haskell.org
I don't know exactly what types you have as base types in your
implementation, but here's a small code fragment that of what I had
in mind.
data Value = D Double | S String | B Bool
type Stack = [Value]
-- Add top stack elements
plus :: Stack -> Stack
plus (D x : D y : vs) = D (x+y) : vs
pl
Hello Gene,
Monday, August 21, 2006, 12:42:17 PM, you wrote:
> being able to use +,* on any of the numeric types... but can you have
> a list of type [Num] ?? I thought that it had to be the base types of
> Int, Integer, Float, Double etc.. No?
you can, using existentials:
data Number = foral
On 2006 August 21 Monday 04:42, Gene A wrote:
> but can you have
> a list of type [Num] ?? I thought that it had to be the base types of
> Int, Integer, Float, Double etc.. No?
See http://www.haskell.org/hawiki/ExistentialTypes
___
Haskell-Cafe mailing
Lennart and all,
On 8/19/06, Lennart Augustsson <[EMAIL PROTECTED]> wrote:
There are much better ways than storing strings on the stack.
Like using a data type with constructors for the different types that
you can store.
-- Lennart
Off topic, but this is important info for me!
O
There are much better ways than storing strings on the stack.
Like using a data type with constructors for the different types that
you can store.
-- Lennart
On Aug 19, 2006, at 11:51 , Gene A wrote:
Hi Lennart,
This morning when I posted..it was about 2:30am and had been up a
long t
Hi Lennart,
This morning when I posted..it was about 2:30am and had been up a
long time... bad habits.. I sent a message to Henk-Jan to that effect,
but didn't send to the entire list.. anyway thanks to both for the
followups... I still tend to sometimes do things the hard way in
Haskell. Start
On Aug 19, 2006, at 05:14 , Henk-Jan van Tuyl wrote:
[...]
*Iteration> fromtoby 12 42 3 (flip (**) 0.33)
fromtoby 12 42 3 (**0.33)
And why approximate so much?
fromtoby 12 42 3 (** (1/3))
___
Haskell-Cafe mailing list
Haskell-
On Sat, 19 Aug 2006 10:28:33 +0200, Gene A <[EMAIL PROTECTED]> wrote:
*Iteration> fromtoby 1 12 2 (flip (^) 3) -- cubing of the base list
above..
An easier way to write this:
fromtoby 1 12 2 (^3)
[...]
*Iteration> fromtoby 12 42 3 (flip (**) 0.33)
fromtoby 12 42 3 (**0.
Hi,
Here is a little thing I came up with to simulate the construct "for
x:= n1 to n2" and "for x:=n1 to n2 by n3" from purely imperative
world to use in Haskell, I call the functions fromto and fromtoby..
they also take a function which consumes the x component and uses it
in the computation.
You might use the Prelude function until:
until :: (a -> Bool) -> (a -> a) -> a -> a
until (> 3) (+ 2) 0 = 4
or for your purpose:
until (\ a -> not (goOn(a, f(a))) f ainit
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3Auntil
http://www.haskell.org/onlinere
11 matches
Mail list logo