Re: [Haskell-cafe] let and fixed point operator

2007-09-01 Thread Mitar
Hi! I did once try to learn Prolog. And failed. Miserably. You should backtrack at this point and try again differently. :-) Mitar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] let and fixed point operator

2007-09-01 Thread Albert Y. C. Lai
Mitar wrote: I did once try to learn Prolog. And failed. Miserably. You should backtrack at this point and try again differently. :-) There is likely a problem if he has inadvently walked past a cut. XD ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Paul Hudak
ok wrote: What is so bad about f x = g x'' where x'' = x' + transform x' = x * scale (if you really hate inventing temporary names, that is). There's nothing at all wrong with this, assuming it's what you meant to type :-), and it might even correspond perfectly to the

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Andrew Coppin
[EMAIL PROTECTED] wrote: Anyway, I believe strongly that ALL people who have problems with the Haskell protocole, and they are numerous, I teach a good sample of them, should be encouraged to learn Prolog. IN DEPTH, and I mean it, Andrew Coppin and Peter Hercek ! In Prolog A=B is the

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Andrew Coppin
Paul Hudak wrote: ok wrote: What is so bad about f x = g x'' where x'' = x' + transform x' = x * scale (if you really hate inventing temporary names, that is). There's nothing at all wrong with this, assuming it's what you meant to type :-), and it might even

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Brandon S. Allbery KF8NH
On Aug 31, 2007, at 16:01 , Sterling Clover wrote: In particular for a function -- n, m, etc or x, y, etc? What about for f' defined in a let block of f? If I use x y at the top level I need to use another set below -- is that where x' y' are more appropriate, or x1, y1? Usual style is

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Dan Piponi
On 8/30/07, Peter Hercek [EMAIL PROTECTED] wrote: f x = let x = x * scale in let x = x + transform in g x Why are you trying to call three different things by the same name 'x' in one tiny block of code? That's very confusing and makes it hard to reason equationally about the code.

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
On 8/30/07, Peter Hercek [EMAIL PROTECTED] wrote: Hi, I find the feature that the construct let x = f x in expr assigns fixed point of f to x annoying. The reason is that I can not simply chain mofifications a variable like e.g. this: f x = let x = x * scale in let x = x +

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Ketil Malde
On Thu, 2007-08-30 at 18:17 +0200, Peter Hercek wrote: I find the feature that the construct let x = f x in expr assigns fixed point of f to x annoying. Any alternative? Non-recursive assignments? f x = let x = x * scale in let x = x + transform in g x I think it is often it

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
On 8/30/07, Brent Yorgey [EMAIL PROTECTED] wrote: The way to combine functions into a pipeline is by using function concatenation: Oops, of course I meant function composition instead of function concatenation. -Brent ___ Haskell-Cafe mailing

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Derek Elkins
On Thu, 2007-08-30 at 18:17 +0200, Peter Hercek wrote: Hi, I find the feature that the construct let x = f x in expr assigns fixed point of f to x annoying. The reason is that I can not simply chain mofifications a variable like e.g. this: f x = let x = x * scale in let x = x

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
OK, so it's only tangentally related, but... do you have *any idea* how many times I've written something like let x = (some complex function of x) in (some other complex function of x) when in fact what I *meant* to do was type x' instead of x?! It's really maddening to write 50,000 lines

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
It's really maddening to write 50,000 lines of code, eventually get it to compile, run it, and have the program lock up and start consuming so much virtual memory that the entire PC becomes unstable within seconds. (This isn't helped by the fact that Ctrl+C doesn't seem to make either GHCi

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread David Roundy
On Thu, Aug 30, 2007 at 06:16:12PM +0100, Andrew Coppin wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? It can be a nightmare trying to track down where you made the

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Dan Piponi
On 8/30/07, Andrew Coppin [EMAIL PROTECTED] wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? The thing that convinced me to learn Haskell in the first place was the fact that you

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Paul Hudak
Andrew Coppin wrote: OK, so it's only tangentally related, but... do you have *any idea* how many times I've written something like let x = (some complex function of x) in (some other complex function of x) when in fact what I *meant* to do was type x' instead of x?! I try not to use

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Chaddaï Fouché
Another interesting example of the x = f x use : coins = [1,2,5,10,20,50,100,200] beautiful = foldl (\without p - let (poor,rich) = splitAt p without with = poor ++ zipWith (++) (map (map (p:)) with)

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Albert Y. C. Lai
Peter Hercek wrote: So the question is what am I missing? Any nice use cases where fixed point search is so good that it is worth the trouble with figuring out new and new variable names for essentially the same stuff? When I write functional code, I do find myself writing recursions much

RE: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Peter Verswyvelen
F# and Concurrent Clean introduced special syntax for doing this. Basically they just invent new names for you. In Haskell (warning: I'm a newbie, so take this with a grain of salt), I guess you just use monads if you want to pass a value from one function to another under some context, or you

RE: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Henning Thielemann
On Thu, 30 Aug 2007, Peter Verswyvelen wrote: infixl 0 \ -- I just took the first weird symbol combination that came to mind, this does not mean anything (I hope ;-) x \ fx = fx x f x = x * scale \ \x - x + transform \ \x - g x like this you don't have to invent new names,

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
Brent Yorgey wrote: It's really maddening to write 50,000 lines of code, eventually get it to compile, run it, and have the program lock up and start consuming so much virtual memory that the entire PC becomes unstable within seconds. (This isn't helped by the fact

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
David Roundy wrote: On Thu, Aug 30, 2007 at 06:16:12PM +0100, Andrew Coppin wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? It can be a nightmare trying to track down where

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Andrew Coppin
Dan Piponi wrote: On 8/30/07, Andrew Coppin [EMAIL PROTECTED] wrote: Obviously you might very well have *meant* to write x = f x. But would it be possible to add some kind of optional compiler warning to find such assignments? The thing that convinced me to learn Haskell in the first

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Dan Piponi
On 8/30/07, Andrew Coppin [EMAIL PROTECTED] wrote: Yeah, but... programs aren't like mathematics. I know people claim that they are, but they aren't. But the raison d'etre of Haskell is to make programming more like mathematics. That motivates everything from the fact that it's a declarative

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread jerzy . karczmarczuk
Dan Piponi writes: In mathematics, if you write x = f y you mean that these two expressions are equal. In Haskell, if you say x = f y you mean *make* then equal! Haskell is a declarative language, not an imperative language. When you write x = f x in Haskell, you're declaring to the

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Dan Piponi
On 8/30/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dan Piponi writes: In Haskell, there is no box. Well, there are boxes... But there also thunks and latent, yet-unevaluated graphs... But the point of Haskell is to provide an abstraction that hides these details from you. (Though

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Derek Elkins
On Thu, 2007-08-30 at 23:58 +0200, [EMAIL PROTECTED] wrote: Dan Piponi writes: In mathematics, if you write x = f y you mean that these two expressions are equal. In Haskell, if you say x = f y you mean *make* then equal! Haskell is a declarative language, not an imperative

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread ok
What is so bad about f x = g x'' where x'' = x' + transform x' = x * scale (if you really hate inventing temporary names, that is). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org