efficient, because you're using lists, and
attempting to index into them and measure their lengths. Perhaps a different
data structure is in order.
Thanks
Tom Davie
On 3 Apr 2013, at 17:38, Lone Wolf wrote:
> http://stackoverflow.com/questions/8940470/algorithm-for-finding-numerical-per
Prelude> import Data.Ratio
Prelude Data.Ratio> 93 % 10 - (2 * 9 % 2)
3 % 10
Floating point sucks, avoid it if you can.
Thanks
Tom Davie
On 16 Jan 2013, at 13:25, ivan dragolov wrote:
>
> 9.3 - (2 * 4.5) => 0.3007
>
> I expected 0.3
>
> ?
>
> -
Aside from Neil's point about rank-2 polymorphism, you can of course just
parameterise your NumHolder type...
data Num a => NumHolder a = NumHolder a
instance Show a => Show NumHolder a where
show (NumHolder x) = show x
instance Functor NumHolder where
fmap f (NumHolder a) = NumHolder (f a)
On Tue, Dec 29, 2009 at 2:47 PM, pbrowne wrote:
> Hi,
> I am studying the underlying semantics behind Haskell and to what degree
> those semantics are actually implemented. I need to clarify what a *type
> synonym* actual means in relation to Haskell's logic (or formal
> semantics). I used the fo
Lazy evaluation is an evaluation strategy that gives non-strict semantics.
A lazy function I'm not sure how to define. It may be lazy language meaning
a function which is non-strict in one of it's arguments.
Bob
On Sun, Dec 27, 2009 at 1:16 PM, michael rice wrote:
> I've seen the terms "lazy
This isn't quite what you're asking for, but by using the applicative
interface to parsers, you need do little more than spell out what your AST
looks like:
import Control.Applicative
import Control.Applicative.Infix
data Equation = String :=: Expression
data Expression = EApp fun arg | EInt Int
Non-strictness is not necessary for purity, but it sure gives you some nice
properties... Take for example
const x y = x
It would be really nice for this function to have the property "always
results in x no matter what you give it as it's second argument". But for a
language which is strict, al
I have to admit, it's just one criterion too much for me. I can manage to
satisfy all of them except for willing to work in Manhattan.
Bob
On Tue, Dec 8, 2009 at 5:54 PM, Tom Tobin wrote:
> On Tue, Dec 8, 2009 at 11:09 AM, siki wrote:
> > I've posted this before but did not get a whole lot of
On 10/31/09, Magicloud Magiclouds wrote:
> After all, I never think OO as an oppsite way to all other things. The
> idea is so general that if you say I cannot use it in Haskell at all,
> that would make me feel weird. The only difference between languages
> is, some are easy to be in OO style, so
On 10/31/09, Heinrich Apfelmus wrote:
> The only possible monad instance would be
>
>return x = Const mempty
>fmap f (Const b) = Const b
>join (Const b) = Const b
Your join doesn't seem to have the right type... Unless I'm missing something.
Bob
On Fri, Oct 30, 2009 at 5:59 PM, Luke Palmer wrote:
> On Fri, Oct 30, 2009 at 10:39 AM, Tom Davie wrote:
> > Of note, there is a sensible monad instance for zip lists which I *think*
> > agrees with the Applicative one, I don't know why they're not monads:
> > i
Of note, there is a sensible monad instance for zip lists which I *think*
agrees with the Applicative one, I don't know why they're not monads:
instance Monad (ZipList a) where
return = Ziplist . return
join (ZipList []) = ZipList []
join (ZipList (a:as)) = zlHead a `zlCons` join (map zlTail
install happily on tiger, you can then use port
install ghc to install ghc and it's dependancies.
Hope this helps anyone digging in the archives for a solution.
Tom Davie
On Thu, 2 Sep 2004 22:59:59 -0400, Gregory Wright <[EMAIL PROTECTED]> wrote:
>
> Hi Tom,
>
> You might
Any Mac/Haskell gurus able to help I would much appreciate it.
Thanks
Tom Davie
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
14 matches
Mail list logo