Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-03 Thread Jules Bean
PR Stanley wrote: Yes and thanks for the reply. When a function is declared in C the argument variable has an address somewhere in the memory: int f ( int x ) { return x * x; } any value passed to f() is assigned to x. x is the identifier for a real slot in the memory (the stack most likely)

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-02 Thread ok
On 3 Oct 2007, at 1:42 pm, PR Stanley wrote: When a function is declared in C the argument variable has an address somewhere in the memory: int f ( int x ) { return x * x; } Wrong. On the machines I use, x will be passed in registers and will never ever have an address in memory. In fact, u

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-02 Thread Derek Elkins
On Wed, 2007-10-03 at 01:42 +0100, PR Stanley wrote: > > > > f x = x + x > > > > Is the "x" use to create a pattern in the definition and when f is > > > > called it's replaced by a value? > > > > > >Those equation-like definitions are syntactic sugar for lambda > > >abstractions. f could as well b

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-02 Thread PR Stanley
> > f x = x + x > > Is the "x" use to create a pattern in the definition and when f is > > called it's replaced by a value? > >Those equation-like definitions are syntactic sugar for lambda >abstractions. f could as well be defined as f = \x -> x + x. Please elaborate First, the f x = part

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Brent Yorgey
On 10/1/07, PR Stanley <[EMAIL PROTECTED]> wrote: > > > > > f x = x + x > > > Is the "x" use to create a pattern in the definition and when f is > > > called it's replaced by a value? > > > >Those equation-like definitions are syntactic sugar for lambda > >abstractions. f could as well be defined a

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Dan Weston
If you've never been exposed to lambda calculus, then you're in for a real treat! There is no shortage of tutorials on this. If Greek letters and symbol manipulations are not your thing, take a look at http://worrydream.com/AlligatorEggs/ which describes a game that teaches children about lam

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread PR Stanley
> f x = x + x > Is the "x" use to create a pattern in the definition and when f is > called it's replaced by a value? Those equation-like definitions are syntactic sugar for lambda abstractions. f could as well be defined as f = \x -> x + x. Please elaborate ___

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Malte Milatz
PR Stanley: > f x = x + x > Is the "x" use to create a pattern in the definition and when f is > called it's replaced by a value? Those equation-like definitions are syntactic sugar for lambda abstractions. f could as well be defined as f = \x -> x + x. ___

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Andrew Coppin
PR Stanley wrote: Hi f x = x + x Is the "x" use to create a pattern in the definition and when f is called it's replaced by a value? Basically, uh, yeah. If you say "f 5", this is basically equivilent to "5 + 5" by the above definition. (I'm sure a huge number of others will chime in on th

[Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread PR Stanley
Hi f x = x + x Is the "x" use to create a pattern in the definition and when f is called it's replaced by a value? What's actually happening here? Thanks, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi