[Haskell-cafe] Re: global variables

2007-05-17 Thread Jón Fairbairn
for a constant¹), to avoid the problems caused by global variables is one of the reasons for using a functional language. [1] as in e = exp 1 -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe

[Haskell-cafe] Re: The Functional Pearls

2007-05-05 Thread Jón Fairbairn
CUP to make them freely accessible after a year or two? -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Writing guards shorthand

2007-04-19 Thread Jón Fairbairn
the different types of the Ops in different types in their representations. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: toClockTime

2007-03-20 Thread Jón Fairbairn
the other day and didn't find it. I'm glad it's there in 6.6 -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: what I learnt from my first serious haskell programm

2007-03-19 Thread Jón Fairbairn
different names for the same concept on different types. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

[Haskell-cafe] Re: speeding up fibonacci with memoizing

2007-02-20 Thread Jón Fairbairn
advantage of the pseudo O(n) lookup time of arrays, you could use a NaturalTree of arrays of some fixed size -- but arrays are O(log n) really... -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell

[Haskell-cafe] Re: How did you stumble on Haskell?

2007-02-03 Thread Jón Fairbairn
at that same 1987 meeting. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: How did you stumble on Haskell?

2007-02-03 Thread Jón Fairbairn
Paul Johnson [EMAIL PROTECTED] writes: I'd read Eric Raymond's piece about being a hacker, where he said to learn Lisp for the side effects. Much better to learn Haskell for the side effects! ;-) -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: basic field questions

2007-01-24 Thread Jón Fairbairn
, Sure, but it's not obvious to me that we're looking at one of the warts here, unless the problem is that my Furniture above isn't extensible in the appropriate sense or someone wants the different coulour fields to have different types (confusing, surely?). -- Jón Fairbairn

[Haskell-cafe] Re: Idiomatic Haskell equivalent of keyword arguments to functions

2006-12-30 Thread Jón Fairbairn
= localhost, port = 25} which would save having a defaultFoo for every Foo (at the possible expense of occasional explicit types). -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Aim Of Haskell

2006-12-12 Thread Jón Fairbairn
and hijack the phrase functional programming I think we should call it Abstraction Oriented Programming. It's got the oriented buzzword in it, and we don't need to tell folk that abstraction means more than one thing to us until we're sure they're OK. -- Jón Fairbairn

[Haskell-cafe] Re: Cannot understand liftM2

2006-12-11 Thread Jón Fairbairn
into ghc enlighten you at all? -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Would someone explain this code to me?

2006-12-06 Thread Jón Fairbairn
statement: T _ a y b = ins s Here it's a pattern match. So if ins s returns (T x a' y' b'), then a = a'; y = y'; b = b' are used in the expresion covered by the where clause. -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: Generalizing zip

2006-11-17 Thread Jón Fairbairn
Jón Fairbairn [EMAIL PROTECTED] writes: Jason Dagit [EMAIL PROTECTED] writes: Well, this is basically just a zip with a special base case. But you [...] I wonder if there is mileage to be had from persuing something like this, rather different (off top of head, very provisional, EOE c

[Haskell-cafe] Friday Afternoon Play: The Burrows Wheeler Transformation

2006-11-17 Thread Jón Fairbairn
-- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Generalizing zip

2006-11-16 Thread Jón Fairbairn
and extend_infinitely might be more generally userful. I've probably missed something better, too. A point free reduction might look like the following and probably isn't worth it: isPrefixOf = (and .) . flip flip False . flip flip True . zipWith'' (==) probably? -- Jón Fairbairn

[Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread Jón Fairbairn
an imposition. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread Jón Fairbairn
. Your headNote is a good approach, but it strikes me that it's a bit redundant. Instead of “headNote foo” just use “headDef (error foo)”. It's a wee bit longer, but having the “error” out there in the open seems more honest somehow, and there would be fewer function names to remember. -- Jón

[Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread Jón Fairbairn
Robert Dockins [EMAIL PROTECTED] writes: On Nov 15, 2006, at 9:48 AM, Jón Fairbairn wrote: But instead of “blah (head [ v | (n,v) - env, n==target ]) blah”, you could write blah the_v_in_scope blah where (the_v_in_scope:_) = [ v | (n,v) - env, n==target ] Or how about

[Haskell-cafe] Re: Fractional/negative fixity?

2006-11-08 Thread Jón Fairbairn
Simon Marlow [EMAIL PROTECTED] writes: Nicolas Frisby wrote: Let's remember that if something is broke, it's only _right_ to _fix_ it. I patiently waited for someone else to make that pun. Understanding the language won't be much harder, but understanding fixity declarations will

[Haskell-cafe] Re: there's a monster in my Haskell!

2006-11-01 Thread Jón Fairbairn
out there? Could we get drawings of these monsters? I'd love to see the 'mysterious and awesome IO' in pictorial form. For that, an image has already (after considerable effort and expense in tracking down the beast) been created: http://tinyurl.com/yddv4z -- Jón Fairbairn

[Haskell-cafe] Re: Why is Haskell not homoiconic?

2006-10-31 Thread Jón Fairbairn
. So there's no need to have a representation of it beyond the source code. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Rank N type tutorial?

2006-10-29 Thread Jón Fairbairn
is what you said, but I think this highlights the source of confusion better. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: split string into n parts

2006-10-24 Thread Jón Fairbairn
) -- in Data.Graph.Inductive.Query.Monad which is a little bit inefficient, but less clunky than checking for the end of list in order to apply padwith just once. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: Solitaire cipher

2006-10-24 Thread Jón Fairbairn
top = fst splt bot = snd splt you can write where (top,bot) = splitAt ... But how about List.break? And if you know that bot is going to have enough elements where (top, card1:card2:rest) = break ... -- Jón Fairbairn

[Haskell-cafe] Re: split string into n parts

2006-10-23 Thread Jón Fairbairn
, but at least they illustrate the use of unfoldr. [aside: One might argue that the prelude ought to provide splitAtMb rather than splitAt.] -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: split string into n parts

2006-10-23 Thread Jón Fairbairn
(splitAtMb n) ... in_fives = groups_of 5 :-) -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Automatic fixity allocation for symbolic operators

2006-10-17 Thread Jón Fairbairn
Nils Anders Danielsson [EMAIL PROTECTED] writes: On Mon, 16 Oct 2006, Jón Fairbairn [EMAIL PROTECTED] wrote: I made a more concrete proposal later and Phil Wadler tidied it up. I think It even got as far as a draft of the language, [...] Do you know where this proposal/draft can

[Haskell-cafe] Re: Automatic fixity allocation for symbolic operators

2006-10-16 Thread Jón Fairbairn
effect... I made a more concrete proposal later and Phil Wadler tidied it up. I think It even got as far as a draft of the language, but I think it was decided that it was just too difficult (both for human and computer) to parse. -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: Debugging Newton's method for square roots

2006-10-15 Thread Jón Fairbairn
) Is it? Is there equivalent code to “my_sqrt :: Float - Float”? (that might be pertinent). -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13) ___ Haskell-Cafe

[Haskell-cafe] Re: Debugging Newton's method for square roots

2006-10-15 Thread Jón Fairbairn
without due consideration of the implications). -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

[Haskell-cafe] Re: Haskell performance (again)!

2006-10-10 Thread Jón Fairbairn
that the compiler can convert cases on LT, EQ and GT into something sensible -- after all, wasn't that the purpose of compare?)? -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13

[Haskell-cafe] Re: Haskell compiler from a USB Stick?

2006-10-03 Thread Jón Fairbairn
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello David, Tuesday, October 3, 2006, 2:17:33 PM, you wrote: Does anyone know of a Haskell compiler that will run from a USB stick? i'm ôäüùûå sure Блым? -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: [newbie] How to test this function?

2006-09-22 Thread Jón Fairbairn
something about it. See http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13) ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: [newbie] How to test this function?

2006-09-22 Thread Jón Fairbairn
, if it doesn't get mended for long enough, Haskell' might accept the present layout. http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13

[Haskell-cafe] Re: Haskore

2006-09-22 Thread Jón Fairbairn
David Curran [EMAIL PROTECTED] writes: Hi I have been trying to learn haskell (tip over the vending machine) Tipping over a vending machine is a real world effect, so you'll have to use the IO Monad. -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: Java or C to Haskell

2006-09-20 Thread Jón Fairbairn
to use to indicate failure... but judicious use of catMaybes . concat. maybeToList might help with that. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

[Haskell-cafe] Re: Problems interpreting

2006-09-18 Thread Jón Fairbairn
where subst_elem x | x == e = l' | otherwise = [x] -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

[Haskell-cafe] Re: Problems interpreting

2006-09-18 Thread Jón Fairbairn
Andrea Rossato [EMAIL PROTECTED] writes: On Mon, Sep 18, 2006 at 12:42:59PM +0100, Jón Fairbairn wrote: And if you do that, you can write it like this: subst e l' = concat . map subst_elem where subst_elem x | x == e = l

[Haskell-cafe] Re: sections of noncommutative operators

2006-09-09 Thread Jón Fairbairn
for them. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-07) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-09 Thread Jón Fairbairn
, as this fails in ghc at the type-checking stage.) I don't think it would complicate mechanical parsing unreasonably. I do think (if done without the parentheses) it might complicate /human/ parsing unreasonably. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-09 Thread Jón Fairbairn
Aaron Denney [EMAIL PROTECTED] writes: Jón Fairbairn [EMAIL PROTECTED] wrote: I think the present design is wrong because we don't have a type for naturals. Meh. Naturals are reasonably useful sometimes, but not often enough, in my opinion. Any sort of numeric hierarchy designed

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-09 Thread Jón Fairbairn
is a nice and reasonable algebraic property that Float and Double don't obey. In fact Float and Double have lots of /un/reasonable algebraic properties, but we still have them in the language. (I think they should be turfed out into a numerical library). -- Jón Fairbairn

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-09 Thread Jón Fairbairn
Brian Hulley [EMAIL PROTECTED] writes: Jón Fairbairn wrote: [1] “-” is a varsym. The logical way of achieving what you suggest (ie -1 -2... as constructors for Integer) would be to make it introduce a consym the way “:” does, but then it couldn't be an infix operator anymore. I don't

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-08 Thread Jón Fairbairn
at the opposite tack of making “-” solely infix and using something else for negate (as in ML), although finding a different token (such as “__”) for don't care and using “_” for unary minus doesn't seem too bad to me. -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: map (-2) [1..5]

2006-09-08 Thread Jón Fairbairn
of syntax, and formerly valid programmes break. So why not just say that varsym varid is in general reserved for future special syntaxes, and require varsym whitespace varid everywhere? -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
understand. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-07-14) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
is that if you proceed by debugging rather than rewriting, you are likely to end up with this sort of mess. Personally, I don't mind too much if that kind of programmer finds Haskell too hard. Elitist? Certainly! Immorally so? No. -- Jón Fairbairn [EMAIL PROTECTED] http

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
“+” And there's always Hoogle (and the documentation it links to) if you want to find something of a particular type. Kudos to Neil for producing this, by the way (though I do hope his remarks about the readability of his code were a more self deprecating than accurate). -- Jón Fairbairn

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
of “head” in my code seem to be applied to infinite lists, or commented out, or rebindings of head to something else, sloppy bits of nonce programming or references in comments to the top of my own noddle. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf

[Haskell-cafe] head c Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
be empty, but I can't prove it. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
that steps through the execution of the code. Such a debugger is inappropriate for Haskell programmers, and doubly so for beginners. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
): we define a C preprocessor macro fromJust. Curiously, the only bug in darcs that has bitten me so far was a use of fromJust. Perhaps that indicates a weakness in the style, rather than the tools? -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: [Parsec] No identEnd in ParsecToken?

2006-09-05 Thread Jón Fairbairn
-minuses preceded by a minus. Or have I lost the plot somewhere? Aside: Is there already name for `chThen`? ie (liftM2 (:)); I had a feeling we were avoiding liftM friends for some reason. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont

[Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread Jón Fairbairn
0x002d for unary minus, 0x2010 in identifiers and 0x2212 for infix minus... and spend many a happy hour trying to tell which of the three was intended by some short horizontal line. -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont

[Haskell-cafe] Re: Int-[Char] conversion

2006-08-16 Thread Jón Fairbairn
'show' as the second hit, and that's the function you want. -- Jón Fairbairn [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Why Not Haskell?

2006-08-07 Thread Jón Fairbairn
-- especially if there's a large concern on your case (we want to use your patented idea. Oh, it looks like your code uses one of our patented ideas; you'll be hearing from our lawyers). -- Jón Fairbairn [EMAIL PROTECTED] http://www.chaos.org.uk/~jf/Stuff-I-dont

[Haskell-cafe] Re: Is id strict?

2006-07-30 Thread Jón Fairbairn
to be evaluating f on an argument before f can force the argument. If you evaluate id x, you necessarily evaluate x. I don't think (2) is a very good definition, since I don't know what forces means here. -- Jón Fairbairn [EMAIL PROTECTED

[Haskell-cafe] Re: Is id strict?

2006-07-30 Thread Jón Fairbairn
Duncan Coutts [EMAIL PROTECTED] writes: On Sun, 2006-07-30 at 10:56 +0100, Jón Fairbairn wrote: David House [EMAIL PROTECTED] writes: 1) f is strict iff f _|_ = _|_. 2) f is strict iff it forces evaluation of its arguments. In (2), you have to be evaluating f on an argument before f