[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 function?


lamda function
Assignment in your case is a special case of an "update" operation, which
takes an object and returns a new object, some properties of which have new
values.

From the book of Simon J. Thomson ""Haskell: The Craft of Functional
Programming":

update (Sto sto) v n
  = Sto (\w -> if v == w then n else sto w)

This is the definition of an update function of a calculator store, which
keeps track of user-defined variables names and values using a lookup
function sto.

This creates a new store (Sto is the constructor, which takes a lookup
function) with a new lookup function, which is identical to the lookup
function of the store that is being updated with the only exception of the
variable name "v", for which it will return the newly specified value "n".

To be clear, here's the definition (in Haskell) of all the functions
implementing this data type:


newtype Store = Sto (Var -> Int)

initial :: Store
initial =  Sto (\v -> 0)

value   :: Store -> Var -> Int
value (Sto sto) v = sto v

update  :: Store -> Var -> Int -> Store
update (Sto sto) v n
  = Sto (\w -> if v == w then n else sto w)=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

"Roger L. Costello" <costello@m...> wrote in message
3F1593E6.A57FC302@m...">news:3F1593E6.A57FC302@m......
> Hi Folks,
>
> 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?"
>
> The particular technology that I am looking at (MathML) interprets the
> equal symbol the later way (as a relational operator).
>
> I would like to devise an expression that would be interpreted along the
>
> lines of the first way (that is, I'd like the expression to be a
> statement of a
> "formula" that I can plug in a value for miles to compute the
> kilometer's value).
>
> MathML has the ability to express "functions".  From a mathematician's
> point-of-view is this interpretation:
>
>     "kilometers is assigned the result of multiplying the
>       value of miles times 1.62."
>
> considered a statement of a function?  For example,
>
>      kilometers = f(miles)
>
> where the function, f, multiplies miles times 1.62?
>
> 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?  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.
>
> /Roger
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>




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.