[Haskell-cafe] Re: defining last using foldr

2007-08-15 Thread Jon Fairbairn
Alexteslin [EMAIL PROTECTED] writes: I am really sorry, but i still can't define the function. The chapter the exercise is in precedes algebraic types or Maybe a types. And is seems that must being easy to define. I answered some exercises on using foldr such as summing for example, but

[Haskell-cafe] Re: defining last using foldr

2007-08-16 Thread Jon Fairbairn
Chaddaï Fouché [EMAIL PROTECTED] writes: so you need an f so that c `f` x is c (for any c and x) and yet (b `f` c) is c for any c and b -- this is impossible (or I'm asleep). Well, it isn't impossible but quite hard (and not even standard H98 if I'm not mistaken) If it is possible, I'm

[Haskell-cafe] Re: Hints for Euler Problem 11

2007-08-17 Thread Jon Fairbairn
Kim-Ee Yeoh [EMAIL PROTECTED] writes: Aaron Denney wrote: I find the first far more readable. The compiler should be able to assemble it all at compile time, right? 'Course not. The (++) function like all Haskell functions is only a /promise/ to do its job. I find this comment

[Haskell-cafe] Compile-time v run-time

2007-08-17 Thread Jon Fairbairn
I wrote: the compile-time/run-time dichotomy is only relevant when a value depends on data only available at run-time. Something I've wanted to experiment with for a long time and never got round to is writing CAFs back to the load module at the end of a run (if they're small enough or took a

[Haskell-cafe] Re: help understanding lazy evaluation

2007-08-23 Thread Jon Fairbairn
Stefan O'Rear [EMAIL PROTECTED] writes: Indeed, you've caught on an important technical distinction. Lazy: Always evaluating left-outermost-first. I think most people would rather use the term normal order¨ for that; lazy means evaluating in normal order /and/ not evaluating the same

[Haskell-cafe] Re: Newbie terminology for partial application

2007-08-27 Thread Jon Fairbairn
Peter Verswyvelen [EMAIL PROTECTED] writes: A while ago I confused currying with partial application, which was pointed out by members of this community, and the wiki pages got adapted so that newbies like me don't make the same mistake twice ;) That's great. Anyway, at the risk of making

[Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-04 Thread Jon Fairbairn
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes: On Sep 4, 2007, at 5:02 , Miguel Mitrofanov wrote: It depends on arbitrary restrictions on what constitutes an (boolean) expression, something that is anathema to functional programmers :-) Spot the language: while if E then S; F

[Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-05 Thread Jon Fairbairn
Sterling Clover [EMAIL PROTECTED] writes: of course you could rewrite this in a while loop too although you'd have to use an assignment, but at least still not one with a silly done variable. People seem to have overlooked the bit of Algol68 I posted, so I'll repeat it While If E

[Haskell-cafe] Re: isWHNF :: a - IO Bool ?

2007-09-27 Thread Jon Fairbairn
apfelmus [EMAIL PROTECTED] writes: Tristan Allwood wrote: Does anyone know if there is a function that tells you if a haskell value has been forced or not? e.g. isWHNF :: a - IO Bool let x = (map succ [0..]) in do putStrLn . show (isWHNF x)-- False putStrLn . show .

[Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Jon Fairbairn
Lihn, Steve [EMAIL PROTECTED] writes: Hi, I have been hacking the Haskell installation a few days on Redhat Linux. GHC 6.6 - 6.6.1 - Lambdabot does not work. [...] Anyway, now my question is, how do I thoroughly clean up Haskell? (And maybe try again after a few days of rest.) Is

[Haskell-cafe] Re: Strange subtract operator behavior - and lazy naturals

2007-10-18 Thread Jon Fairbairn
David Benbennick [EMAIL PROTECTED] writes: On 10/17/07, John Meacham [EMAIL PROTECTED] wrote: Oops, sorry, the version I posted was an intermediate one that had a different addition algorithm. here is a better one that fixes that issue: Zero + y = y Sum x n1 + y = Sum x (y + n1) note that

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-20 Thread Jon Fairbairn
Simon Peyton-Jones [EMAIL PROTECTED] writes: I realise belatedly that my message might have sounded dismissive. My apologies; it wasn't intended to be. Good ideas are just that: good. Reinventing them is a sign of good taste. As to documenting GHC, we try to do that by writing papers.

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-21 Thread Jon Fairbairn
Peter Hercek [EMAIL PROTECTED] writes: Jon Fairbairn wrote: A hyperlink of the form a href=http://.../long-research-paper.html#interesting-paragraph; interesting bit/a is far more useful than one of the form a href=http://.../long-research-paper.pdf;look for section 49.7.3/a. It may

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-23 Thread Jon Fairbairn
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes: On Oct 21, 2007, at 6:29 , Jon Fairbairn wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids

[Haskell-cafe] Re: Tutorial: Curry-Howard Correspondence

2007-10-23 Thread Jon Fairbairn
Derek Elkins [EMAIL PROTECTED] writes: On Mon, 2007-10-22 at 01:12 +0100, Lennart Augustsson wrote: There's nothing wrong with Haskell types. It's the terms that make Haskell types an inconsistent logic. Logics are what are consistent or not, so saying the logic Haskell's type system

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-11-01 Thread Jon Fairbairn
Hugh Perkins [EMAIL PROTECTED] writes: On 10/26/07, John Meacham [EMAIL PROTECTED] wrote: Heh, the plethora of pdf papers on Haskell is part of what originally brought me to respect it. Something about that metafont painted cmr just makes me giddy as a grad student. A beautifully rendered

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-11-02 Thread Jon Fairbairn
Cale Gibbard [EMAIL PROTECTED] writes: On 21/10/2007, Jon Fairbairn [EMAIL PROTECTED] wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids, pdfs

[Haskell-cafe] Re: Sinus in Haskell

2007-11-09 Thread Jon Fairbairn
Hans van Thiel [EMAIL PROTECTED] writes: On Fri, 2007-11-09 at 14:30 -0500, Brent Yorgey wrote: On Nov 9, 2007 2:08 PM, Hans van Thiel [EMAIL PROTECTED] wrote: Hello All, Can anybody explain the results for 1.0, 2.0 and 3.0 times pi below? GHCi yields the

[Haskell-cafe] Re: Editorial error or something meaningful?

2007-12-01 Thread Jon Fairbairn
PR Stanley [EMAIL PROTECTED] writes: Hi taken from ch.8.3 in the Hutton book: Whereas return v always succeeds, the dual parser failure always fails regardless of the contents of the input string: The dual parser failure? It's a question of how you parse the phrase dual parser failure.

[Haskell-cafe] Re: class default method proposal

2007-12-13 Thread Jon Fairbairn
Duncan Coutts [EMAIL PROTECTED] writes: We all know that Functor should have been a superclass of Monad, and indeed we now know that Applicative should be too. Making such a change would break lots of things however so the change does not happen. However in this case the Monad operations can

[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: What I should have been told about upfront: - the syntax for an expression Since there are only declarations and expressions, the syntax of an expression involves pretty much all of the language, so it would be difficult to tell it upfront. - the

[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: On Tue, 18 Dec 2007 11:56:36 +0200, Jon Fairbairn [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] writes: - the syntax for a block Not sure what you mean by block. do a - [1..10] b - [3,4] return (a,b) is an expression... you

[Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Jon Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: Hi, Are CAF's specified in the Haskell report? I couldn't find them mentioned. CAF is a term of art. If you define fred = 2 + 2 that's a CAF. If not, why do all Haskell compilers support them? How could they not? I'm not sure I understand your

[Haskell-cafe] Re: CAF's in Haskell

2007-12-27 Thread Jon Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: I should have been more precise with my question. Given the code: fred = 2 + 2 bob = fred + fred In a Haskell implementation fred would be evaluated once to 4, then used twice. The 2+2 would only happen once (ignore defaulting and overloaded

[Haskell-cafe] Re: Are there any female Haskellers?

2010-03-28 Thread Jon Fairbairn
Leon Smith leon.p.sm...@gmail.com writes: On Sat, Mar 27, 2010 at 1:56 PM, Jason Dagit da...@codersbase.com wrote:  For some reason it started out as a male dominated field.  Let's assume for cultural reasons.  Once it became a male dominated field, us males  unknowingly made the work and

[Haskell-cafe] Re: Integers v ints

2010-04-02 Thread Jon Fairbairn
Jens Blanck jens.bla...@gmail.com writes: On 1 April 2010 10:53, Ivan Lazar Miljenovic ivan.miljeno...@gmail.comwrote: Jens Blanck jens.bla...@gmail.com writes: I was wondering if someone could give me some references to when and why the choice was made to default integral numerical

[Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Jon Fairbairn
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Daryoush Mehrtash dmehrt...@gmail.com writes: Is there a way to persist a [IO ()] to say a file then retrieve it later and execute it using a sequence function? I'm not sure I understand what you're wanting... you can pass around

[Haskell-cafe] Re: The instability of Haskell libraries

2010-04-24 Thread Jon Fairbairn
John Goerzen jgoer...@complete.org writes: It is somewhat of a surprise to me that I'm making this post, given that there was a day when I thought Haskell was moving too slow ;-) My problem here is that it has become rather difficult to write software in Haskell that will still work with

[Haskell-cafe] Re: Announcement: Data.ISO3166_CountryCodes version 0.1

2010-04-25 Thread Jon Fairbairn
John Millikin jmilli...@gmail.com writes: Thanks for the library! I'm sure it will be very useful for people dealing with internationalized applications / libraries. I have a few suggestions, which might make your library easier to use and maintain. First, it's very common to include

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-22 Thread Jon Fairbairn
R J rj248...@hotmail.com writes: I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==):: Bool - Bool - Bool x == y = (x y) || (not x not y) Since Bool is a type, and all Haskell types include ⊥, you need to add conditions in

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-23 Thread Jon Fairbairn
Alexander Solla a...@2piix.com writes: On May 22, 2010, at 1:32 AM, Jon Fairbairn wrote: Since Bool is a type, and all Haskell types include ⊥, you need to add conditions in your proofs to exclude it. Not really. Bottom isn't a value, so much as an expression for computations that don't

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Jon Fairbairn
Alexander Solla a...@2piix.com writes: On May 23, 2010, at 1:35 AM, Jon Fairbairn wrote: It seems to me relevant here, because one of the uses to which one might put the symmetry rule is to replace an expression “e1 == e2” with “e2 == e1”, which can turn a programme that terminates

[Haskell-cafe] Re: Function to find a substring

2010-06-08 Thread Jon Fairbairn
R J rj248...@hotmail.com writes: What's an elegant definition of a Haskell function that takes two strings and returns Nothing in case the first string isn't a substring of the first, or Just i, where i is the index number of the position within the first string where the second string

Re: [Haskell-cafe] Fibonacci numbers generator in Haskell

2006-06-16 Thread Jon Fairbairn
On 2006-06-15 at 17:33BST Vladimir Portnykh wrote: Fibonacci numbers implementations in Haskell one of the classical examples. An example I found is the following: fibs :: [Int] fibs = 0 : 1 : [ a + b | (a, b) - zip fibs (tail fibs)] Can we do better? Well, you've had various variously

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-06-19 Thread Jon Fairbairn
On 2006-06-19 at 15:24- C Rodrigues wrote: Here's a puzzle I haven't been able to solve. Is it possible to write the initlast function? There are functions init and last that take constant stack space and traverse the list at most once. You can think of traversing the list as

Re: [Haskell-cafe] Functional progr., images, laziness and all therest

2006-06-22 Thread Jon Fairbairn
On 2006-06-22 at 15:16BST Brian Hulley wrote: minh thu wrote: y and yq are infinite... But how does this change the fact that y still has 1 more element than yq? yq is after all, not a circular list. infinity+1 = infinity I don't see why induction can't just be applied infinitely to

Re: [Haskell-cafe] Functional progr., images, laziness and all therest

2006-06-22 Thread Jon Fairbairn
On 2006-06-22 at 15:45BST Brian Hulley wrote: Jon Fairbairn wrote: infinity+1 = infinity Surely this is just a mathematical convention, not reality! :-) I'm not sure how to answer that. The only equality worth talking about on numbers (and lists) is the mathematical one, and it's

Re: [Haskell-cafe] Comma in the front

2006-07-13 Thread Jon Fairbairn
On 2006-07-13 at 02:29BST Neil Mitchell wrote: Hi, Are cool kids supposed to put the comma in front like this? Some cool kids do, some cool kids don't. Some do both, depending on their mood. The advantage of a leading , is that now the comma's line up, and if you want to add an item on

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-13 Thread Jon Fairbairn
On 2006-07-12 at 23:24BST Brian Hulley wrote: Christian Maeder wrote: Donald Bruce Stewart schrieb: Question over whether it should be: splitBy (=='a') aabbaca == [,,bb,c,] or splitBy (=='a') aabbaca == [bb,c] I argue the second form is what people usually want. Yes,

Re: [Haskell-cafe] Comma in the front

2006-07-13 Thread Jon Fairbairn
On 2006-07-13 at 11:15+0200 Henning Thielemann wrote: Optimal notation of lists, because of most easiest editing, is a: b: c: [] That made me smile. In Ponder I had used up : for types, and lists could be a:: b:: c:. but when I suggested this at a Haskell meeting, Simon PJ complained

Re: [Haskell-cafe] Comma in the front

2006-07-13 Thread Jon Fairbairn
On 2006-07-13 at 09:35EDT [EMAIL PROTECTED] (Mark T.B. Carroll) wrote: Jon Fairbairn [EMAIL PROTECTED] writes: a:: b:: c:. but when I suggested this at a Haskell meeting, Simon PJ complained that it looks like hopscotch. I've never quite understood that complaint! http

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-20 Thread Jon Fairbairn
On 2006-07-13 at 10:16BST I wrote: Hooray! I've been waiting to ask Why aren't we asking what laws hold for these operations? Having thought about this for a bit, I've come up with the below. This is intended to give the general idea -- it's not polished code, and I'm not at all wedded to the

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-21 Thread Jon Fairbairn
On 2006-07-20 at 18:31BST I wrote: On 2006-07-13 at 10:16BST I wrote: Hooray! I've been waiting to ask Why aren't we asking what laws hold for these operations? Having thought about this for a bit, I've come up with the below. This is intended to give the general idea -- it's not

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-27 Thread Jon Fairbairn
On 2006-07-27 at 01:33EDT Paul Hudak wrote: Thanks for asking about this -- it probably should be in the paper. Dan Doel's answer is closest to the truth: I imagine the answer is that having the syntax for it looks nicer/is clearer. if a b c could be more cryptic than if a then b

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-27 Thread Jon Fairbairn
On 2006-07-27 at 13:01+0200 Tomasz Zielonka wrote: But because if-then-else is an expression, there is another problem. That was exactly my point when I made the muttering about self-bracketing (if ... fi, like everything else, is an expression in Algol68) all those years ago. I really regret

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

2006-11-07 Thread Jon Fairbairn
On 2006-11-07 at 18:30+0100 Henning Thielemann wrote: On Tue, 7 Nov 2006, Simon Marlow wrote: This is a much more heavyweight change, and its not a clear win. Haskell 2 ? :-) If you'd like to make a concrete proposal, then feel free to do so and I'll make sure it gets onto the wiki.

[Haskell-cafe] Re: Newbie question

2008-01-21 Thread Jon Fairbairn
Alexander Seliverstov [EMAIL PROTECTED] writes: How does caller choose which particular instance of Num they want? They specify the type... or just pass the result to something that specifies the type. Try it in ghci: Prelude let f:: Integral i = Integer - i; f = fromIntegral Prelude let g ::

[Haskell-cafe] Re: Newbie question

2008-01-22 Thread Jon Fairbairn
Bulat Ziganshin [EMAIL PROTECTED] writes: Hello Jon, Monday, January 21, 2008, 9:28:09 PM, you wrote: Ok. I have a my own class class A a and want to write function like this f:: (A a)=Integer-a. Can I do it? But in general you are going to want something a bit more useful, which means

[Haskell-cafe] Re: anybody can tell me the pronuncation of haskell?

2008-01-29 Thread Jon Fairbairn
[EMAIL PROTECTED] writes: Jerzy Karczmarczuk (pronounced as written) Do you mean you don't care, or are you assuming that we know whether the convention is to read it as Polish orthography, English, or French? Jón (invariably mispronounced) -- Jón Fairbairn

[Haskell-cafe] Yi, or Gtk2hs or fedora rpm problem?

2008-02-03 Thread Jon Fairbairn
This was mentioned on the yi-devel list http://groups.google.com/group/yi-devel/browse_frm/thread/392c3cd612490b1a/c304d54ffc000e4a?lnk=gstq=HSgtk.o%3A+unknown+symbol# but didn't cause much excitement as it's not clear whose problem it is, so I'll ask here as well: I recently downloaded yi-0.3

[Haskell-cafe] Re: Datatypes - Haskell

2008-02-12 Thread Jon Fairbairn
Richard A. O'Keefe [EMAIL PROTECTED] writes: On the subject of data types, I've recently seen Haskell code using data Foo ... = Foo { ... } where I would have used newtype instead of data. When is it a good idea to avoid newtype? When the code was written before newtype was introduced

[Haskell-cafe] Re: coerce (safe!)

2008-03-02 Thread Jon Fairbairn
Krzysztof Skrzętnicki [EMAIL PROTECTED] writes: Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to write a function of type (a-b). Well, possibly I didn't write anything particularly new, but please excuse me for I'm

[Haskell-cafe] Re: working with Random.randoms

2008-06-14 Thread Jon Fairbairn
Stephen Howard [EMAIL PROTECTED] writes: I am a newcomer doing my obligatory struggling with Haskell's type system, That's your mistake. Don't struggle with the type system, the type system is your friend; when it tells you you are doing something wrong, it's usually right. and I've got a

[Haskell-cafe] Re: working with Random.randoms

2008-06-15 Thread Jon Fairbairn
Robert Vollmert [EMAIL PROTECTED] writes: Great reply! Thanks. One minor point: If real_programme is to be pure, you should use let: Whoops! I was thinking let but wrote the wrong thing. If my email had been through a type-checker, it would have spotted the mistake. -- Jón Fairbairn

[Haskell-cafe] Re: Fixed-Point Combinators

2008-07-17 Thread Jon Fairbairn
Adrian Neumann [EMAIL PROTECTED] writes: Hello, while studying for a exam I came across this little pearl: Y = (L L L L L L L L L L L L L L L L L L L L L L L L L L L L) where L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r)) posted by Cale

[Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread Jon Fairbairn
michael rice nowg...@yahoo.com writes: This is from Learn You A Haskell: == Curried functions Every function in Haskell officially only takes one parameter. So how is it possible that we defined and used several functions that take more than one parameter so far? Well, it's a

[Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread Jon Fairbairn
David Virebayre dav.vire+hask...@gmail.com writes: On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: [1] A pet peeve of mine is x supports y being used backwards (as in our application supports windows Vista, which would only make sense if it were something

[Haskell-cafe] Re: Fwd: Is () a 0-length tuple?

2009-11-08 Thread Jon Fairbairn
Pasqualino \Titto\ Assini tittoass...@gmail.com writes: The syntax is similar, but what else is? What would you expect from an empty tuple? (a,b,c) has a constructor function p3 a b c = (a,b,c) and three destructor functions s3_1 (a,b,c) = a, s3_2 (a,b,c) = b and s3_3 (a,b,c)=c (a,b) has a

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-08 Thread Jon Fairbairn
Deniz Dogan deniz.a.m.do...@gmail.com writes: Has there been any serious suggestion or attempt to change the syntax of Haskell to allow hyphens in identifiers, much like in Lisp languages? E.g. hello-world would be a valid function name. I (among others) suggested it right at the beginning

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-09 Thread Jon Fairbairn
Deniz Dogan deniz.a.m.do...@gmail.com writes: 2009/12/8 Jon Fairbairn jon.fairba...@cl.cam.ac.uk: Deniz Dogan deniz.a.m.do...@gmail.com writes: [...] allow hyphens in identifiers, much like in Lisp languages? E.g. hello-world would be a valid function name. I (among others) suggested

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Jon Fairbairn
Daniel Fischer daniel.is.fisc...@web.de writes: Am Dienstag 15 Dezember 2009 03:04:43 schrieb Richard O'Keefe: On Dec 14, 2009, at 5:11 PM, Daniel Fischer wrote: 1. I wasn't playing in the under_score vs. camelCase game, just proposing a possible reason why the camelCase may have been

Re: [Haskell-cafe] Can't explain this error

2005-07-12 Thread Jon Fairbairn
On 2005-07-12 at 12:39- Dinh Tien Tuan Anh wrote: i have just encountered another type error. This program tries to print out partitions of a positive integer (i guess) parts 0 = [[]] parts x = [concat (map (y:) parts(x-y) | y-[1..(x `div` 2)]] ^

Re: [Haskell-cafe] Memoization

2005-10-08 Thread Jon Fairbairn
On 2005-10-07 at 22:42- Gerd M wrote: As (memory) is a function, it cannot be memoized (the function can be, but not its result, which is what you're after). How can a funcion be memoized but not it's result (what does this mean)!? Since there are no side effects in Haskell why is it

[Haskell-cafe] Re: Interest in helping w/ Haskell standard

2005-10-14 Thread Jon Fairbairn
On 2005-10-14 at 16:56+0200 Stephane Bortzmeyer wrote: On Fri, Oct 14, 2005 at 03:34:33PM +0100, Jon Fairbairn [EMAIL PROTECTED] wrote: Because the language used inside these strings is standard, multi-language, widely used and documented? 10,000 lemmings can't be wrong? Right

Re: [Haskell-cafe] Nice way to calculate character frequency in a string

2005-10-25 Thread Jon Fairbairn
On 2005-10-25 at 12:20+0200 Lemmih wrote: On 10/25/05, Charles SDudu [EMAIL PROTECTED] wrote: Hello, I need to calculate the frequency of each character in a String. And if I can do this really well in C, I dont find a nice (and fast) answer in haskell. I tried several functions, listed

Re: [Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

2005-11-17 Thread Jon Fairbairn
On 2005-11-17 at 13:21EST Cale Gibbard wrote: Sebastian Sylvan wrote: Personally I think that the dot is way to good of a symbol to be wasted on function composition. I mean, how often do you really use function composition in a way which doesn't obfuscate your code? I use ($) way more

Re: [Haskell-cafe] getCPUTime ??

2005-11-21 Thread Jon Fairbairn
On 2005-11-21 at 15:14EST Michael Benfield wrote: I'm new to Haskell. I'm apparently misunderstanding something here. When I run this program: - module Main where import System.Posix import System.CPUTime printTime = getCPUTime = putStrLn . show main = printTime sleep 5

Re: [Haskell-cafe] Problems with square root...

2005-12-21 Thread Jon Fairbairn
On 2005-12-21 at 18:10GMT Daniel Carrera wrote: Daniel Carrera wrote: Hey, The sqrt function is not doing what I want. This is what I want: round sqrt(2) Sigh... never fails. Spend an hour trying to solve a problem, and a minute after you write to the list you find the solution.

Re: [Haskell-cafe] Splitting a string into chunks

2006-01-13 Thread Jon Fairbairn
On 2006-01-13 at 13:32PST Jared Updike wrote: That works except it loses single newline characters. let s = 1234\n5678\n\nabcdefghijklmnopq\n\n,,.,.,. Prelude blocks s [12345678,abcdefghijklmnopq,,,.,.,.] Also the argument to groupBy ought to be some sort of equivalence relation. blocks =

Re: [Haskell-cafe] Why is $ right associative instead of leftassociative?

2006-02-05 Thread Jon Fairbairn
On 2006-02-04 at 21:15GMT Brian Hulley wrote: Stefan Holdermans wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Brian wrote: I think the mystery surrounding :: and : might have been that originally people thought type annotations would hardly ever be needed whereas list cons

Re: [Haskell-cafe] Infinite loop?

2006-02-17 Thread Jon Fairbairn
On 2006-02-17 at 20:12GMT rgo wrote: Hi all, my program probably goes into infinite loop... But i cannot understand where and why. getDirectoryContents will include . and .., so if you follow those, you're bound to loop. -- Jón Fairbairn Jon.Fairbairn at

Re: [Haskell-cafe] Infinite loop?

2006-02-17 Thread Jon Fairbairn
On 2006-02-17 at 09:22PST Jared Updike wrote: Yep. change one line to: entry - if isdir name /= . name /= .. and it does in fact work. Only if no-one has been tricky with symbolic links. -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk

Pragmatic concurrency Re: [Haskell-cafe] multiple computations, same input

2006-03-29 Thread Jon Fairbairn
On 2006-03-28 at 08:02+0200 Tomasz Zielonka wrote: I wonder if it would be possible to remove the space-leak by running both branches concurrently, and scheduling threads in a way that would minimise the space-leak. I proposed this before

[Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-05 Thread Jon Fairbairn
On 2006-04-05 at 12:35EDT Michael Goodrich wrote: Greetings All: GHC gives: Fail: loop Hugs gives: [(ERROR - C stack overflow Nowt's up wi' ' runtime error message. GHC's perfectly lucid. It says your programme went into an infinite loop. This sort of thing belongs on

[Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-05 Thread Jon Fairbairn
On 2006-04-05 at 14:03EDT Michael Goodrich wrote: BTW, I can't seem to locate 'haskell-cafe'. http://www.haskell.org/mailman/listinfo/haskell-cafe The message responding to my sign-up said nothing about haskell-cafe. Perhaps it should. It's so long since I signed up to haskell that I've

Re: [Haskell-cafe] Re: [Haskell] What's up with this Haskell runtime error message:

2006-04-06 Thread Jon Fairbairn
On 2006-04-06 at 11:25EDT Michael Goodrich wrote: Thanks so much for your help. I should have made clear that I was aware that the definitions were mutually dependent. What I was hoping was that Haskell could solve this for me without my having to resort to effectively finessing any

Re: [Haskell-cafe] OT - lamba calculus definition - alpha reduction

2006-05-29 Thread Jon Fairbairn
On 2006-05-29 at 15:46+0200 =?UTF-8?B?RHXFoWFuIEtvbMOhxZk=?= wrote: OK. If we have these two expressions: 1) (\x.x b x) 2) (\x.x c x) The question is, are they equal? (They are not identical, of course.) For answer no, there is a strong argument - there is no reduction sequence

Re: [Haskell-cafe] Re: [Haskell] (.) . (.)

2006-05-29 Thread Jon Fairbairn
On 2006-05-29 at 19:03BST Brian Hulley wrote: Dominic Steinitz wrote: I think it's fascinating that already with ((.).(.)) there is something that can be used practically and proved equivalent to something easily comprehensible, Well, it is compose composed with compose, so you can start

[Haskell-cafe] Re: Mysterious fact

2010-11-02 Thread Jon Fairbairn
Andrew Coppin andrewcop...@btinternet.com writes: The other day, I accidentally came up with this: |{-# LANGUAGE RankNTypes #-} type Either x y= forall r. (x - r) - (y - r) - r left :: x - Either x y left x f g= f x right :: y - Either x y right y f g= g y | This is

[Haskell-cafe] Re: Mysterious fact

2010-11-03 Thread Jon Fairbairn
Lennart Augustsson lenn...@augustsson.net writes: Jon, you beat me to it. I was going to mention Ponder. Strange chance; yesterday was the first time I read haskell café for something like half a year. But Ponder did have a builtin type, it had the function type built in. :) Well, to use

[Haskell-cafe] Catching up on Time and Directory

2010-11-16 Thread Jon Fairbairn
I'm probably terribly out of date with this, so I wonder if anyone can save me the bother of working out what the /preferred/ libraries are for (a) determining the last-modified-time of a file or directory and (b) manipulating the resulting time datum. I can find

[Haskell-cafe] Re: a simple question about types

2010-11-18 Thread Jon Fairbairn
Daniel Fischer daniel.is.fisc...@web.de writes: On Wednesday 17 November 2010 19:09:16, Jerzy M wrote: Hallo, let me take this simple function: (2*). If I check its type :t (2*) I'll obtain (2*) :: (Num a) = a - a But now it suffices to write g = (2*) and check :t g to obtain g

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Jon Fairbairn
a...@cs.uu.nl writes: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first public release of the Utrecht Haskell Compiler (UHC). UHC supports almost all Haskell98

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-20 Thread Jon Fairbairn
Achim Schneider bars...@web.de writes: Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: a...@cs.uu.nl writes: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-22 Thread Jon Fairbairn
Miguel Mitrofanov miguelim...@yandex.ru writes: Well, the problem is that every implementor does choose a subset of standart to implement. That's what I'm complaining about. It's much worse in JavaScript - essential features working differently in Internet Explorer, Firefox, Opera, and

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Jon Fairbairn
Colin Paul Adams co...@colina.demon.co.uk writes: Lennart == Lennart Augustsson lenn...@augustsson.net writes: Lennart Of course, n+k will be missed by Haskell obfuscators. I Lennart mean, what will we do without (+) + 1 + 1 = (+) ? I think what would be missed would you be having

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) --first release

2009-04-23 Thread Jon Fairbairn
Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com writes: Jon Fairbairn wrote: But we can remove them in future language versions. The point I was trying to make at the beginning of this subthread was that implementations should follow the definition, because having a core language

[Haskell-cafe] Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-23 Thread Jon Fairbairn
John A. De Goes j...@n-brain.net writes: That's absurd. You have no way to access private source code, so any decision on what features to exclude from future versions of Haskell must necessarily look at publicly accessible source code. This is all entirely beside the point. The question

[Haskell-cafe] Re: chr/ord?

2009-04-29 Thread Jon Fairbairn
Tim Wawrzynczak inforichl...@gmail.com writes: On Tue, Apr 28, 2009 at 8:08 PM, michael rice [1]nowg...@yahoo.com wrote: Hi, My Prelude docs must be out of date because chr and ord don't seem to be there. How do I access these functions? Michael, those functions are not in the

[Haskell-cafe] Re: fromInteger for Lists

2009-05-02 Thread Jon Fairbairn
Henning Thielemann schlepp...@henning-thielemann.de writes: Paul Keir schrieb: There's nothing better than making a data type an instance of Num. In particular, fromInteger is a joy. But how about lists? http://www.haskell.org/haskellwiki/Num_instance_for_functions

[Haskell-cafe] Re: Haskell philosophy question

2009-05-17 Thread Jon Fairbairn
Vasili I. Galchin vigalc...@gmail.com writes: Hello, I am confused between Haskell as delineated in the Haskell Report VS ghc pragmas which extend Haskell beyond the Haskell Report. Pragmas are part of the report, and while I agree that using them for extensions is stretching the

[Haskell-cafe] Re: (fwd) Haskell logo fail

2009-06-18 Thread Jon Fairbairn
Jason Dusek jason.du...@gmail.com writes: Why don't we have a picture of a cool dinosaur instead? Something cool because the last heat of life went out of it 65 million years ago? -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk

[Haskell-cafe] golf, predicate check function for MonadPlus (was Re: How to read safely?)

2009-07-02 Thread Jon Fairbairn
Dan Doel dan.d...@gmail.com writes: There was talk of adding a readMaybe a while ago, but apparently it never happened. As it is, you can use reads, read s becomes: case reads s of [(a, rest)] | all isSpace rest - code using a _ - error case

[Haskell-cafe] Re: golf, predicate check function for MonadPlus

2009-07-07 Thread Jon Fairbairn
Dan Doel dan.d...@gmail.com writes: On Thursday 02 July 2009 6:36:09 am Jon Fairbairn wrote: check :: (MonadPlus m) = (a - Bool) - a - m a check p a | p a = return a | otherwise = mzero I've often noticed the need for a similar function in conjunction with unfoldr

[Haskell-cafe] Re: ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-11 Thread Jon Fairbairn
Wolfgang Jeltsch g9ks1...@acme.softbase.org writes: Am Freitag, 10. Juli 2009 05:26 schrieb rocon...@theorem.ca: I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice. I have to admit that it makes me unhappy. :-( Why do we use

[Haskell-cafe] Re: Haskell Zippers on Wikibooks: teasing! :)

2009-07-15 Thread Jon Fairbairn
Matthias Görgens matthias.goerg...@googlemail.com writes: doesn't make much sense to me yet, although I suspect I can read the mu as a lambda on types? Not really. The mu has more to do with recursion. I'd say it's entirely to do with recursion. It's like the Y combinator (or fix) for

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large This is not very informative. It did not give me a hint which function was causing this. In C adding a few printf would have

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: On Thu, Jul 16, 2009 at 4:10 PM, Jon Fairbairnjon.fairba...@cl.cam.ac.uk wrote: I wonder if your code has to use !! at all? I took a look at a random module from the above link, and (without making much attempt at understanding it), I'd guess

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread Jon Fairbairn
Henning Thielemann lemm...@henning-thielemann.de writes: On Thu, 16 Jul 2009, Fernan Bolando wrote: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large A good way to avoid such problems is to avoid partial functions at

[Haskell-cafe] Re: was: Debugging methods for haskell structured data types the right way in haskell

2009-07-20 Thread Jon Fairbairn
Fernan Bolando fernanbola...@mailc.net writes: On Sun, Jul 19, 2009 at 7:40 AM, wren ng thorntonw...@freegeek.org wrote: Fernan Bolando wrote: The intention is z0 is a system parameter and database, it contains a set of info needed to define a particular simulation A single-constructor

  1   2   3   >