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)
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
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
> > 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
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
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
> 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
___
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.
___
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
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
10 matches
Mail list logo