Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
At 18:17 18/06/2008, you wrote: PR Stanley wrote: > > >>PR Stanley wrote: >> > >> > [...] >> > >> > Paul: I rest my case! :-) >> > you cowardly hypocrit! > > Paul: Why did you remove Jonathan Cast's messa

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
> PR Stanley wrote: > > With respect, do you not think it'd be wiser for the community > > [snip] > > *disgusted* > > This is exactly the sort of message that haskell-cafe does not normally > contain. Let's not start now. > > This is a civi

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
PR Stanley wrote: > > [...] > > Paul: I rest my case! :-) > you cowardly hypocrit! Paul: Why did you remove Jonathan Cast's message? Afraid somebody might understand why I responded the way I did? > Please take your own advice now, and rest your case. Like it or n

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
anguage sucks rocks" strikes me as unwise. > > > >Not necessarily. It can be that they'd implement closures in PHP, make > >a dog's dinner of it (as they always do), and then we would be blamed > >for giving them bad advice. > > > >Anyway, it seems that P

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
sarily. It can be that they'd implement closures in PHP, make a dog's dinner of it (as they always do), and then we would be blamed for giving them bad advice. Anyway, it seems that PR Stanley was forced to use PHP, no wonder he's a little mad at it. Paul: How did you know? :-) You

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
It seems to me that if a PHP developer sees the Haskell community as a resource for advice on programming language implementation, we should take this as a compliment to the Haskell community. Repaying that compliment with "your language sucks rocks" strikes me as unwise. I'm familiar w

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
> Now, if you, Jules, Alex or some other wannabe Hitler have a problem with > my freedom of expression then your best solution is to saddle up and get the > hell out yourselves. This is the wrong place for setting up your tinpot > dictatorship, Doctor! Just more evidence... http://en.wikipe

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
PR Stanley wrote: With respect, do you not think it'd be wiser for the community [snip] *disgusted* This is exactly the sort of message that haskell-cafe does not normally contain. Let's not start now. This is a civilized mailing list. Either comment on the nice gentlemen

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread PR Stanley
With respect, do you not think it'd be wiser for the community [snip] *disgusted* This is exactly the sort of message that haskell-cafe does not normally contain. Let's not start now. This is a civilized mailing list. Either comment on the nice gentlemen's PHP closure proposal from a lan

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-17 Thread PR Stanley
asier simpler faster than the stupid traps. They are after all /their/ deckchairs to play with. Yes, playing with deckchairs while the ship sinks with that bloody woman singing "my Heart Will Go on". -ljr PR Stanley wrote: > Blimey! Talk about rearranging the dec

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-17 Thread PR Stanley
Blimey! Talk about rearranging the deckchairs :-) With respect, do you not think it'd be wiser for the community to deal with a total lack of proper type checking, the lack of any notion of the general concept of a function, or a whole range of other fundamental issues in PHP first before worry

[Haskell-cafe] Type Coercion

2008-05-28 Thread PR Stanley
Hi (16 :: Float) is a perfectly legitimate statement although I'm surprised that it's allowed in a type strong language such as Haskell. It's a bit like casting in good old C. What's going on here? Paul ___ Haskell-Cafe mailing list Haskell-Cafe@hask

[Haskell-cafe] What's NaN?

2008-05-28 Thread PR Stanley
Hello Why does sqrt (-16) return NaN? What is NaN? Thanks Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-13 Thread PR Stanley
Paul: What is the underlying rationale for the Maybe data type? It is the equivalent of a database field that can be NULL. Paul: shock, horror! the null value or the absence of any value denoted by null is not really in harmony with the relational model. > is it the saf

Re: [Haskell-cafe] saner shootout programs

2008-05-11 Thread PR Stanley
I don't know Haskell very well, but Paul: "I'm not racist but . . ." :-) even I can tell, looking at, for example, the N-body benchmark, that the Haskell code is probably not type-safe, and the tricks used in it would not be usable in a larger program (see below). The task is esse

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread PR Stanley
Um, I was encountering and recognizing times when I really needed an out-of-band "null", and the pain of representing such in C, shortly after I started serious programming in C (call it 1984-5). Is this really difficult? Paul: Hmm, I'm not quite sure what you're driving at.

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-10 Thread PR Stanley
Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion. :-) Bob: Pure and simple -- it allows you to

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-10 Thread PR Stanley
Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion. :-) Bob: Pure and simple -- it allows

[Haskell-cafe] Maybe a, The Rationale

2008-05-10 Thread PR Stanley
Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a lengthy discussion. :-) Cheers, Paul _

Re: [Haskell-cafe] inserting values in a binary tree

2008-05-09 Thread PR Stanley
Are there any invariants you wish to maintain when inserting? If not, it's rather trivial. Paul: The idea is to find a value in the tree greater than the new value and then placing the new value before it on the tree. duplicates are ignored and if no value greater than he new value

Re: [Haskell-cafe] Re: inserting values in a binary tree

2008-05-09 Thread PR Stanley
Actually, you've touched an important point there. It's balancing that I'm having difficulty with. Paul At 23:46 09/05/2008, you wrote: PR Stanley <[EMAIL PROTECTED]> wrote: > Hi > data Ord a => Tree a = Nil | Node (Tree a) a (Tree a) > How would one go ab

[Haskell-cafe] inserting values in a binary tree

2008-05-09 Thread PR Stanley
Hi data Ord a => Tree a = Nil | Node (Tree a) a (Tree a) How would one go about inserting a value in a binary search tree of the above description? Cheers Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/list

[Haskell-cafe] (Num t) => [t] or [Int]

2008-05-09 Thread PR Stanley
Hi I thought [1, 2, 3] :: [Int] GHC says it's (Num t) > [t] Okay, when it comes to 3.3:[1,2,3] (Num t) => [t] makes more sense. Is that the only reason? Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] Order of Evaluation

2008-05-09 Thread PR Stanley
Hi (take 4 . map (>0)) (f s t) where s = 2 : t t = 3 : s f = zipWith (-) What would be the order of evaluation for the above code? How would I illustrate the evaluation step-by-step? What do you need it for, really? Pure functional programs are not about evaluation order, but a

[Haskell-cafe] Order of Evaluation

2008-05-09 Thread PR Stanley
Hi (take 4 . map (>0)) (f s t) where s = 2 : t t = 3 : s f = zipWith (-) What would be the order of evaluation for the above code? How would I illustrate the evaluation step-by-step? I'm guessing that the code necessitates lazy evaluation and as such it starts with take then

Re: [Haskell-cafe] Induction (help!)

2008-05-09 Thread PR Stanley
Paul: okay, da capo: We prove/test through case analysis > that the predicate p holds true for the first/starting case/element > in the sequence. When dealing with natural numbers this could be 0 or > 1. We try the formula with 0 and if it returns the desired result we > move onto the next

Re: [Haskell-cafe] Induction (help!)

2008-05-08 Thread PR Stanley
You've got the right idea. Paul: At long last! :-) I should point out that it doesn't make sense to say p(Succ n) = Succ(p(n)), p(x) represents some statement that is either true or false, so it doesn't make sense to say Succ(p(n)). . Paul: okay, da capo: We prove/test through

Re: [Haskell-cafe] Induction (help!)

2008-05-07 Thread PR Stanley
. If pn+1) = p(n) + p(1) then we have liftoff! I'm not going to go any further in case I'm once again on the wrong track. Cheers Paul At 22:43 07/05/2008, you wrote: On Wed, May 7, 2008 at 9:27 PM, PR Stanley <[EMAIL PROTECTED]> wrote: > Hi > One of you chaps mentioned t

Re: [Haskell-cafe] Induction (help!)

2008-05-07 Thread PR Stanley
Hi One of you chaps mentioned the Nat data type data Nat = Zero | Succ Nat Let's have add :: Nat -> Nat -> Nat add Zero n = n add (Succ m)n = Succ (add m n) Prove add m Zero = m I'm on the verge of giving up on this. :-( Cheers Paul ___ Haskell-Cafe

Re: [Haskell-cafe] Induction (help!)

2008-05-06 Thread PR Stanley
After you grok induction over the naturals, you can start to think about structural induction, which is usually what we use in programming. They are related, and understanding one will help you understand the other (structural induction actually made more sense to me when I was learning, because

Re: [Haskell-cafe] Re: Induction (help!)

2008-05-06 Thread PR Stanley
> Hi > I don't know what it is that I'm not getting where mathematical > induction is concerned. This is relevant to Haskell so I wonder if > any of you gents could explain in unambiguous terms the concept > please. The wikipedia article offers perhaps the least obfuscated > definition I've foun

[Haskell-cafe] Induction (help!)

2008-05-06 Thread PR Stanley
Hi I don't know what it is that I'm not getting where mathematical induction is concerned. This is relevant to Haskell so I wonder if any of you gents could explain in unambiguous terms the concept please. The wikipedia article offers perhaps the least obfuscated definition I've found so far bu

[Haskell-cafe] Non-Overlapping Patterns

2008-05-05 Thread PR Stanley
Hi isZero :: Int -> Bool isZero 0 = True isZero n | n /= 0 = False The order in which the above equations appear makes no difference to the application of isZero. Does the Haskell interpreter rewrite patterns into one single definition using some sort of switch or if construct? Why does an equ

Re: [Haskell-cafe] unapplying function definitions?

2008-05-04 Thread PR Stanley
Hi What on earth is unapplying function definitions? The following is taken from chapter 13 of the Hutton book: "...when reasoning about programs, function definitions can be both applied from left to right and unapplied from right to left." Well, because of referential transparency, we can sa

[Haskell-cafe] unapplying function definitions?

2008-05-04 Thread PR Stanley
Hi What on earth is unapplying function definitions? The following is taken from chapter 13 of the Hutton book: "...when reasoning about programs, function definitions can be both applied from left to right and unapplied from right to left." Cheers Paul

[Haskell-cafe] Re: Function Type Calculation (Take 2)

2008-05-02 Thread PR Stanley
Just in case anyone missed this: [1] funk f x = f (funk f) x f :: a x :: b funk f x :: c therefore funk :: a -> b -> c RHS f (funk f) x :: c f (funk f) :: d -> c x :: d f :: e -> d -> c fun

Re: [Haskell-cafe] Function Type Calculation (Take 2)

2008-04-30 Thread PR Stanley
[1] funk f x = f (funk f) x f :: a x :: b funk f x :: c therefore funk :: a -> b -> c RHS f (funk f) x :: c f (funk f) :: d -> c x :: d f :: e -> d -> c funk :: h -> e f :: h

[Haskell-cafe] Function Type Calculation (Take 2)

2008-04-27 Thread PR Stanley
In case you missed it the first time here is my query again: Hi I know we've already looked at the topic of function type calculation though last time I didn't have the chance to go through it thoroughly. So here it is again. Apologies for the repetition. I've had a try at calculating function

[Haskell-cafe] Function Type Calculation (revisited)

2008-04-26 Thread PR Stanley
Hi I know we've already looked at the topic of function type calculation though last time I didn't have the chance to go through it thoroughly. So here it is again. Apologies for the repetition. I've had a try at calculating function types for two examples below. So to start with I'd be gratef

Re: [Haskell-cafe] What's the difference?

2008-04-08 Thread PR Stanley
What is the difference between data T0 f a = MkT0 a instance Eq (T0 f a) where ... and data T0 f a = MkT0 a instance Eq a => Eq (T0 f a) where ... The second one says that "TO f a" is only an instance of "Eq" if "a" is, while the first says that "TO f a" is an instanc

[Haskell-cafe] What's the difference?

2008-04-08 Thread PR Stanley
Hi What is the difference between data T0 f a = MkT0 a instance Eq (T0 f a) where ... and data T0 f a = MkT0 a instance Eq a => Eq (T0 f a) where ... I've only seen the "=>" operator used for declaring extended classes but never with class insta

Re[4]: [Haskell-cafe] deriving

2008-04-08 Thread PR Stanley
Hello Hans, Tuesday, April 8, 2008, 12:17:38 PM, you wrote: > "deriving" which I think is not used elsewhere. It will break a lot > of code, but it is easy to change, and also easy to make a > compatibility mode. it's also easy to replace all the books, update all code repositories and reteac

Re: [Haskell-cafe] deriving

2008-04-07 Thread PR Stanley
Hi, Thank you very much for your helpful replies. So, we define (or is it declare) a class with a polymorphic value(s which will be used in defining function types or functions associated with that class. The data types are then used for deriving instances of that class specific to each data ty

Re: [Haskell-cafe] deriving

2008-04-07 Thread PR Stanley
> Hi > data Bool = False | True > deriving (Eq, Or, Show, Read) > > Bool is an instance of Eq, Ord, Show and Read. It is derived form > these classes. No. "deriving ..." here does not mean that Bool is derived from those classes; it's not a statement about inheritance or anything similar. "

Re: [Haskell-cafe] deriving

2008-04-07 Thread PR Stanley
Hi data Bool = False | True deriving (Eq, Or, Show, Read) Bool is an instance of Eq, Ord, Show and Read. It is derived form these classes. If that is the meaning of the keyword deriving then wouldn't a different keyword such as from or derivative or even derivation be closer to the semantics

[Haskell-cafe] deriving

2008-04-07 Thread PR Stanley
Hi data Bool = False | True deriving (Eq, Or, Show, Read) Bool is an instance of Eq, Ord, Show and Read. It is derived form these classes. If that is the meaning of the keyword deriving then wouldn't a different keyword such as from or derivative or even derivation be closer to the semantics

Re: [Haskell-cafe] The range operator

2008-04-07 Thread PR Stanley
At 12:28 07/04/2008, you wrote: On Fri, Apr 4, 2008 at 10:49 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > More to the point, the range y..z goes in steps of y-z. ;-) [x,y..z] goes in steps of y-x ;-), [y..z] goes in steps of 1 (depending on the type). Could you elaborate please?

[Haskell-cafe] The range operator

2008-04-04 Thread PR Stanley
Hi folks [x, y..z] What's the role of x? Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Windows CE, Xscale Compiler?

2008-04-04 Thread PR Stanley
At 14:37 04/04/2008, you wrote: And how would I cross compile something for that platform with ghc? (There seems to be no port, which is fine) Don't look at me mate. :-) PR Stanley schrieb: I'm surprised you can't use the Glasgow implementation on CE. At 13:55

Re: [Haskell-cafe] Windows CE, Xscale Compiler?

2008-04-04 Thread PR Stanley
I'm surprised you can't use the Glasgow implementation on CE. At 13:55 04/04/2008, you wrote: Is there any Haskell compiler for Windows CE on a XScale platform? I googled around a bit and found references to a Hugs implementation but couldn't find any place to download it. I have the opportuni

Re: [Haskell-cafe] Precedence (Part 2)

2008-04-03 Thread PR Stanley
Hi folks > let f = sum.map (^2).filter even > f [1..4] 20 So far so good! > sum.map (^2).filter even [1..4] returns an error. How is it that the composition above as part of a function equation doesn't return any errors while on its own it requires parentheses? You seem to have expression eva

[Haskell-cafe] Precedence (Part 2)

2008-04-03 Thread PR Stanley
Hi folks > let f = sum.map (^2).filter even > f [1..4] 20 So far so good! > sum.map (^2).filter even [1..4] returns an error. How is it that the composition above as part of a function equation doesn't return any errors while on its own it requires parentheses? I can understand the need for

Re: [Haskell-cafe] function type def

2008-04-01 Thread PR Stanley
Try putting this through your GHCI: :t twice f x = f (f x) I'd presume that based on the inference of (f x) f is (t -> t) and x :: t Yes, Maybe I should get the right associativity rule cleared first. Cheers, Paul At 20:35 01/04/2008, you wrote: PR Stanley: I know sort of instinctivel

Re: [Haskell-cafe] Re: Function Precedence

2008-04-01 Thread PR Stanley
Are you asking why one doesn't change the rules for all functions? Or are you asking why Haskell doesn't include a system of user-defined precedence and associativity for function application so that one could declare that g binds more tightly than f? I see good reasons for both questions, but I

Re: [Haskell-cafe] Function Precedence

2008-04-01 Thread PR Stanley
Think about this: map (+1) [1..10] What should it do? take (+1) and return a function which takes a list as its argument and finally return a list. How about: f 1 2 3 Should that be f (1 (2 3)), or ((f 1) 2) 3? The latter, of course, but that's not really what I'm drivi

[Haskell-cafe] function type def

2008-04-01 Thread PR Stanley
HI It's one of those things - I know sort of instinctively why it is so but can't think of the formal rationale for it: f g x = g (g x) :: (t -> t) -> (t -> t) Why not (t -> t) -> t -> (t -> t) to take account of the argument x for g? Cheers Paul ___

[Haskell-cafe] Function Precedence

2008-04-01 Thread PR Stanley
Hi If f x = x and g y = y then f g x returns an error because f takes only one argument. Why can't we have function application implemented outwardly (inside-out). So f g x would be applied with gx first followed by its return value passed to f instead of putting g x in brackets. Cheers, Paul

Re: [Haskell-cafe] Bay Area talk tomorrow, on concurrent/parallel Haskell

2008-02-28 Thread PR Stanley
At 13:23 28/02/2008, you wrote: Hello, I wish I could be there, but I'm in Kentucky. ;) It would be great if someone could have this talk recorded and posted on youtube, or something similar. Thank you. Now, there's an idea which could be extended to all Haskell related gatherings. __

Re: [Haskell-cafe] Designing a Parser

2008-02-16 Thread PR Stanley
Actually, I haven't sent this question to the list before. So you're in no danger of repeating yourself. Thanks for your kind reply anyway Paul At 07:03 17/02/2008, you wrote: On Feb 17, 2008 6:20 AM, PR Stanley <[EMAIL PROTECTED]> wrote: > I can't think of an eleg

[Haskell-cafe] Designing a Parser

2008-02-16 Thread PR Stanley
Hi friends I'm in the process of designing a series of functions which you might collectively call a parser. The idea is to evaluate an input string for a proof software. So a typical input string would be something like "(P & Q) -> q". There are a number of things to consider here, for example

[Haskell-cafe] set terminology

2008-02-15 Thread PR Stanley
Hi domain, source --- are the two different things? I'm sure I read somewhere that the source \subseteq domain in mappings. The same was said about range and target -- target \subseteq range. Any ideas? Thanks, Paul ___ Haskell-Cafe mailing list Hask

[Haskell-cafe] Slightly Offtopic in Part

2008-02-08 Thread PR Stanley
Hi folks The disjunction elimination rule: I've been trying to make sense of it and I think I have had some success; however, it's far from adequate. I wonder, is there a way of demonstrating it in Haskell? A code frag with a jargon-free explanation would be mucho appreciated. Cheers, Paul __

Re: [Haskell-cafe] User groups meeting all over the world

2008-02-07 Thread PR Stanley
I will only consider events where they serve free tea and sandwiches, plus if there's a landing pad for the chopper nearby. :-) At 23:11 07/02/2008, you wrote: The community might be interested to know that there are (at least) 7 Haskell/FP user groups meeting across the world in the next two

Re: [Haskell-cafe] FP and Quality

2008-02-04 Thread PR Stanley
Thanks, keep the tips coming. I like the ones about the type safety and line counts. Cheers, Paul At 23:33 04/02/2008, you wrote: Good luck with this - I'd love to see the outcome. My experience is that FP tends to result in a lot less code, so if there are x bugs per line of code, FP has les

[Haskell-cafe] FP and Quality

2008-02-04 Thread PR Stanley
Hi folks I'm thinking of writing a little essay arguing the case for the advantages of FP for producing quality software. Can the list recommend any papers/articles which I can use as sources of my argument? I have access to the IEEE database too although earlier I couldn't find anything on th

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

2008-01-29 Thread PR Stanley
At 16:16 29/01/2008, you wrote: Am Dienstag, 29. Januar 2008 02:25 schrieb Tim Chevalier: > On 1/28/08, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > Well, unless you are French. Then you don't pronounce "H". The remaining > > letters are pronounced according to the Règlements de l'Acadé

[Haskell-cafe] Evolutionary Computing

2008-01-24 Thread PR Stanley
Hi What does the list think of EC? Genetic algorithm is apparently the latest thing. Is EC mathematically reasonable? Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Computer Science Books using Haskell

2008-01-13 Thread PR Stanley
Hi Can the list recommend books that use Haskell - or any FP language but preferably Haskell - to illustrate the principles of compilers and/or algorithms? I think most of you would understand if I said that I'd prefer FP code instead of funny math symbols that don't translate into ANSI chara

[Haskell-cafe] The Opposite of $

2007-12-03 Thread PR Stanley
Hi According to the Haskell Wikibook the € is the opposite of $. The text also oints out that the "|>" can be used as a substitute. I tried using |> but to no avail. Is the list au fait with the |> operator? Thanks, Paul ___ Haskell-Cafe mailing lis

[Haskell-cafe] do

2007-12-03 Thread PR Stanley
Hi I've probably asked about the do construct, if that's the right label. Unfortunately I'm still not quite sure of its role and more specifically its syntax. Something to do with generators perhaps? A description plus some examples would be most gratefully received. Thanks, Paul

[Haskell-cafe] Monads

2007-12-03 Thread PR Stanley
Hi Does the list consider http://en.wikibooks.org/w/index.php?title=Haskell/Understanding_monads&oldid=933545 a reliable tutorial on monads and, if not, could you recommend an onlien alternative please? Thanks, Paul ___ Haskell-Cafe mailing list Haske

Re: [Haskell-cafe] Possible Improvements

2007-12-03 Thread PR Stanley
That's a very good point. Yes, let's have some detailed explanations accompanied by some good examples. Cheers, Paul At 08:43 03/12/2007, you wrote: > I agree that (in this context, beginning learning Haskell) it is a > somewhat minor issue. But I disagree that this is something you should > ig

[Haskell-cafe] Possible Improvements

2007-12-02 Thread PR Stanley
Hi data Tree = Leaf Int | Node Tree Int Tree occurs :: Int -> Tree -> Bool occurs m (Leaf n) = m == n occurs m (Node l n r) = m == n || occurs m l || occurs m r It works but I'd like to know if it can be improved in any way. Thanks, Paul ___ Haskell-C

[Haskell-cafe] Illegal type def

2007-12-01 Thread PR Stanley
Hi > type assoc k v = [(k, v)] works beautifully and everything makes sense. > type Assoc v = (Ord k) => [(k, v)] This doesn't work. Is there any wayof defining k as an element of type Ordinal. I could redefine k by putting Char or Int in its place. Why can't I be more general? Thanks, Paul

Re: [Haskell-cafe] Sequencing Parsers: a Simple Example

2007-12-01 Thread PR Stanley
> PRS: (>>=) :: Parser a -> Parser b -> Parser b > p >>= f = \inp -> >case p inp of > [] -> [] > [(v, out)] -> parse (f v) out You probably want: (>>=) :: Parser a -> (a -> Parser b) -> Parser b p >>= f = \inp -> case parse p inp of [] -> []

[Haskell-cafe] Sequencing Parsers: a Simple Example

2007-12-01 Thread PR Stanley
Hi (>>=) :: Parser a -> Parser b -> Parser b p >>= f = \inp -> case p inp of [] -> [] [(v, out)] -> parse (f v) out based on a lot of guesswork, after the mess created by the OCR, I managed to get the above example to work syntactically but is it semantically correct? Thanks, Paul __

[Haskell-cafe] Editorial error or something meaningful?

2007-11-30 Thread PR Stanley
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? Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.

Re: [Haskell-cafe] What is the role of $!?

2007-11-28 Thread PR Stanley
Hi Thanks for the response. JCC: In most languages, if you have some expression E, and when the computer attempts to evaluate E it goes in to an infinite loop, then when the computer attempts to evaluate the expression f(E), it also goes into an infinite loop, regardless of what f is. That's

Re: [Haskell-cafe] What is the role of $!?

2007-11-28 Thread PR Stanley
Hi Thanks for the explanation. I would be grateful for some examples accompanying the text. I will indicate the right places for real life (Haskell code) examples in the paragraphs below: PJ: As I understand it, the distinction is between the mathematical term "non-strict" and the implementa

Re: [Haskell-cafe] More accessible papers

2007-11-21 Thread PR Stanley
also, Latex source code is 100% accessible to screen reader users. Paul You are completely right, 99% of the people will read the PDF, in exactly the same sense that Windows users prefer to download an installable EXE instead of building from source. But nobody here will argue that the *opti

Re: [Haskell-cafe] More accessible papers

2007-11-21 Thread PR Stanley
Hi Peter, > Yes, but why don't researchers just publish their TEX file? You can > regard that as the "source code" for generating PDF/PS whatever no? Building a .tex file can be rather hard with packages and what-not, plus quite a few of us use lhst2tex as a preprocessor. It's not impossible,

Re: [Haskell-cafe] More accessible papers

2007-11-19 Thread PR Stanley
Why don't you typeset the whole thing in Latex. That way you'll definitely ensure accessibility. Cheers Paul At 19:43 19/11/2007, you wrote: Most research papers have the same layout: two columns per A4 page. They mostly come as PDF or PS. Although this is standard, it is not really accessible

Re: [Haskell-cafe] What is the role of $!?

2007-11-17 Thread PR Stanley
Hi okay, so $! is a bit like $ i.e. the equivalent of putting parentheses around the righthand expression. I'm still not sure of the difference between $ and $!. Maybe it's because I don't understand the meaning of "strict application". While we're on the subject, what's meant by Haskell being

[Haskell-cafe] The percent operator

2007-11-16 Thread PR Stanley
Hi I understand 2%4 will construct a fraction in Haskell. I've tried this in GHCI but got an error message. Is there such an operator in Prelude and if so how is it applied? Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://w

Re: [Haskell-cafe] Haskell and html input elements

2007-11-15 Thread PR Stanley
ed in the idea of a straightahead MS Windows GUI for my program but dont' really know where to start. Any advice would be most appreciated. Cheers Paul At 17:13 12/11/2007, you wrote: On Nov 12, 2007, at 8:38 AM, PR Stanley wrote: Hi back again! How easy/hard is it to control a haske

[Haskell-cafe] What is the role of $!?

2007-11-14 Thread PR Stanley
Hi What is the role of $! ? As far as I can gather it's something to do with strict application. Could someone explain what it is meant by the term strict application please? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://w

Re: [Haskell-cafe] Brazilian Haskellers ?

2007-11-14 Thread PR Stanley
> Hi brazilian haskellers, Wow! I knew the Haskell community has been growing... but there's a brazillian of us? -- Rich A mini UN, that's us. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-c

[Haskell-cafe] Haskell and html input elements

2007-11-12 Thread PR Stanley
Hi back again! How easy/hard is it to control a haskell program through a web browser? Cheers Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Slightly off-topic

2007-11-01 Thread PR Stanley
Hi folks Apologies for the off-topic post. If anyone knows anything about the rules of proof by deduction and quantifiers I'd be grateful for some assistance. Much obliged, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell

Re: [Haskell-cafe] Function Types

2007-10-22 Thread PR Stanley
f x = x x :: a f x :: b therefore f :: a -> b x = a and x = b therefore a = b therefore f :: a -> a Simple mappings are easy to work out. It's the more detailed stuff I'm not sure about. f g x y = g x (y x) Cheers, Paul At 03:15 23/10/2007, you wrote: On 10/22/07, PR Stanley

[Haskell-cafe] Function Types

2007-10-22 Thread PR Stanley
Hi What are the rules for calculating function types? Is there a set procedure ? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] data Bin = Zero | One

2007-10-18 Thread PR Stanley
Hi data Bin = Zero | One As suggested by someone on this list. It's a really neat idea although I'm wondering how I can apply this to my int to binary function. The Zero or One declaration is saying that Bin is a data type that can hold either a one or a zero. I tried testing this with a

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-18 Thread PR Stanley
At 01:48 19/10/2007, you wrote: On Fri, Oct 19, 2007 at 02:45:45AM +0200, [EMAIL PROTECTED] wrote: > PR Stanley writes: >> One of the reasons I'm interested in Wikipedia and Wikibook is because >> you're more likely to find Latex source code used for typesetting the

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-18 Thread PR Stanley
Hi thank you for all your replies. One of the reasons I'm interested in Wikipedia and Wikibook is because you're more likely to find Latex source code used for typesetting the maths. Latex is the one and only 100% tool right now. A lot of publishers use Latex but try to get anything from them i

[Haskell-cafe] Do you trust Wikipedia?

2007-10-17 Thread PR Stanley
Hi Do you trust mathematical materials on Wikipedia? Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Equality Question

2007-10-15 Thread PR Stanley
Hi is const = id? const 'x' 'y' 'x' id 'x' 'x' Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] do

2007-10-13 Thread PR Stanley
Thanks for the very clear explanation. More questions: What is the role of ">>"? How is ">>" different to ">>="? I am aware that ">>=" is used for sequencing parsers but that's all I know about it. Thanks, Paul At 22:28 13/1

[Haskell-cafe] do

2007-10-13 Thread PR Stanley
Hi "do", what's its role? I know a few uses for it but can't quite understand the semantics - e.g. do putStrLn "bla bla" So, what does do, do? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/

[Haskell-cafe] Defining Tree

2007-10-12 Thread PR Stanley
Hi I'm reading the chapter on parsers in the Hutton book. The text refers to the data type tree which doesn't seem to be in prelude. So, I was wondering, what would be asuitable tree for a parser? A binary tree perhaps? Are there different types of tree for different parsers? Thanks, Paul ___

[Haskell-cafe] Dual Parser Failure???

2007-10-12 Thread PR Stanley
Hi failure :: (Parser a) failure = \inp -> [] The code might contain some syntax errors and I'd be grateful for any corrections. What is a "dual parser failure"? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

  1   2   >