[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Question for the Math-oriented people: is an assignment a


math lamda

Roger L. Costello wrote:

> Consider this formula:
>    kilometers = miles * 1.62
> A programmer might interpret it like this:
>     "kilometers is assigned the result of multiplying the
>       value of miles times 1.62."
> That is, the equals symbol is treated as an "assignment operator".
>
> An alternate way of interpreting it is to treat the equals symbol as a
> "relational operator".  Thus, the above formula would be interpreted as:
>    "Does the value of kilometers equal the value of miles
>      times 1.62?"
> [...]
> I would like to devise an expression that would be interpreted along the
> lines of the first way [...]
> If it is true that this interpretation:
>
>     "kilometers is assigned the result of multiplying the
>       value of miles times 1.62."
>
> is a statement of a function then what kind of function is it?


The usual way of dealing with assignment in a functional
setting is to introduce the concept of an "environment"
or a "store".  An environment is a finite map (think
"associative array") that maps identifiers to values.
Assignment statements are then functions that take an
environment as input and return a new environment as
output.

So the denotation of a statement like:

    kilometers = miles * 1.62

might be something like (in pseudocode):

    function f(env) = store(env, "kilometers", lookup(env,"miles") * 1.62);

where 'lookup :: (environment, identifier) -> value'
looks up the value of an identifier in an environment and
'store :: (enviroment, identifier, value) -> environment'
returns a new, modified environment.


> Is it a
> lamda function?  I am not exactly certain what a "lamda function" is,
> but from the description in the MathML book it seems that lamda function
> is appropriate.

ITYM "lambda".  A lambda expression is a way of writing
functions without having to give them a name.  For example,
in Scheme:

    (define (addone x) (+ x 1))

is essentially the same as:

    (define addone (lambda (x) (+ x 1)))

so:

	(addone 3)
    === ((lambda (x) (+ x 1)) 3)
    === (+ 3 1)
    === 4

Google for "lambda calculus introduction" for more information.


--Joe English

  jenglish@f...

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.