Re: [Haskell-cafe] algorithm-for-finding-numerical-permutation-given-lexicographic-index

2013-04-03 Thread Tom Davie
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

Re: [Haskell-cafe] 9.3 - (2 * 4.5) => 0.3000000000000007

2013-01-16 Thread Tom Davie
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 > > ? > > -

Re: [Haskell-cafe] Existential Types (I guess)

2010-01-22 Thread Tom Davie
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)

Re: [Haskell-cafe] semantics of type synonym

2009-12-29 Thread Tom Davie
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

Re: [Haskell-cafe] Lazy evaluation/functions

2009-12-27 Thread Tom Davie
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

Re: [Haskell-cafe] Generating AST using Parsec

2009-12-27 Thread Tom Davie
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

Re: [Haskell-cafe] Re: Why?

2009-12-10 Thread Tom Davie
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

Re: [Haskell-cafe] Haskell job opportunity

2009-12-09 Thread Tom Davie
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

Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-31 Thread Tom Davie
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

Re: [Haskell-cafe] Re: Applicative but not Monad

2009-10-31 Thread Tom Davie
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

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Tom Davie
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

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Tom Davie
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

Re: [Haskell-cafe] GHC and OS X (10.4) [SOLVED]

2004-09-28 Thread Tom Davie
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

[Haskell-cafe] GHC and OS X (10.4)

2004-09-02 Thread Tom Davie
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