- From: Peter Murray-Rust <pm286@cam.ac.uk>
- Date: Tue, 20 Mar 2012 23:07:29 +0000
- To: David Carlisle <davidc@nag.co.uk>
- Cc: "www-math@w3.org" <www-math@w3.org>
- Message-ID: <CAD2k14P-rU37kRb30YTFRspWakqZ-Cbd=wG4mJYFfKXQVKr96w@mail.gmail.com>
On Tue, Mar 20, 2012 at 10:46 PM, David Carlisle <davidc@nag.co.uk> wrote: > > I'd agree with Paul here. Also, expressing the assignments via lambda > binding limits (in most natural encodings) the scope of the assignment > to a single expression, which may be too limiting. > > I agree. I am naturally used to block scope. > While Andreas is right that a term encoding like MathML's (or > equivalently) OpenMath's has its roots in functional encodings and > lambda expressions, I don't see anything wrong with having symbols > denoting imperative assignments and, if necessary other imperative > constructs. > <apply><csymbol>defequal</**csymbol><ci>x</ci><cn>1</cm></**apply> > > is "defequal" an agreed symbol in MathML or would it need to be defined in a CD? can be given a perfectly well defined meaning as > > x := 1 > > and can be defined to have scope a containing element, or the current > math expression, or the entire document, depending on the needs of the > application. > > I agree with this - as long as the semantics are consistent within the application / implementation it works in practice > > > I came across this old article of Gaston Gonnet on a programming CD for > OpenMath > > http://www.inf.ethz.ch/**personal/gonnet/ContDict/**Progr.html<http://www.inf.ethz.ch/personal/gonnet/ContDict/Progr.html> > > (The OpenMath examples are written in an old lispish linear syntax > pre-dating xml and no longer supported in OpenMath, but the basic ideas > are independent of syntax) > > I was actually looking for this one > > http://www.openmath.org/cd/**prog1.xhtml<http://www.openmath.org/cd/prog1.xhtml> > > That encodes assignment as well as for and while loops etc, and is part > of the current xml cd collection (although classed as experimental) > > This seems very close to what I am looking for. The expression: <math xmlns="http://www.w3.org/1998/Math/MathML"><apply><csymbol cd="prog1">assignment</csymbol><ci>a</ci><cn>125</cn></apply></math> works very well for me. If - as I think - I can do what I want with csymbol and my own CDs then it won't break anything that other people do. I am very well used to the idea of dictionaries - we use them extensively in CML and the semantics are essentially identical (CML would use a syntax like: <m:csymbol dictRef="prog1:assignment"/> where the dictionary is indicated by a prefix mapping onto a URI. If nothing else our independent use of dictionaries reinforces our assertion that they are a sufficiently powerful tool in that form (some of my colleagues want OWL ontologies and regard dictionaries as too weak). The problem comes (or will come) when people create engines that make implicit assumptions about this syntax. Since I am implementing my own engine I have consistent syntax for me, but it might not work for others. It is important to avoid such incompatibilities. I shall do some more hacking and let you know how I get on. I can probably do what I want by overloading csymbol! P. -- Peter Murray-Rust Reader in Molecular Informatics Unilever Centre, Dep. Of Chemistry University of Cambridge CB2 1EW, UK +44-1223-763069
Received on Tuesday, 20 March 2012 23:07:58 UTC