[Om] Named functions in OpenMath

Lars Hellström Lars.Hellstrom at residenset.net
Mon May 4 12:42:43 CEST 2015

James Davenport skrev 2015-05-04 11.45:
> I am not sure that I am familiar enough with Popcorn to understand the
> details, but I'll try.
> What you seem to want is a context in which 'area' is fns1.lambda[$a, $b ->
> $a * $b].
> This is, I claim, conceptually no different from a context in which 'area'
> is 42.
> An old-fashioned function programmer might apply fns1.lambda[$area ->
> context] and apply it to 42 (or fns1.lambda[$a, $b -> $a * $b]) , but this
> is ratehr in need to syntactic sugar.

Syntactic sugar in this case being things like functional programming 'let' 
or 'where' clauses? E.g. the intent is to be able to write something like

   let area = fns1.lambda [$a, $b -> $a * $b] in


   where area = fns1.lambda [$a, $b -> $a * $b]

I am reminded of the 'where clause' example I used in 
https://trac.mathweb.org/OM3/ticket/152 (the point of said proposal was 
rather to discuss how to make STS declarations for these kind of things, 
than to provide the syntactic sugar per se). The hypothetical 
lambdacalc1.erehw symbol used there would allow writing said where clause as

     <OMS cd="lambdacalc1" name="erehw"/>
       <OMS cd="fns1" name="lambda"/>
       <OMBVAR><OMV name="a"/><OMV name="b"/></OMBVAR>
       <OMA><OMS cd="arith1" name="times"/>
         <OMV name="a"/>
         <OMV name="b"/>
   <OMBVAR><OMV name="area"/></OMBVAR>
     <OMV name="area"/>

if I interpreted the intent correctly.

Lars Hellström

> Have you looked at the prog1 CD, which might be what you want.
> James
> Quoting "Wenzel, Ken" <Ken.Wenzel at iwu.fraunhofer.de>:
>> Hello,
>> I wonder what is the correct way to represent a named function in OpenMath.
>> For example, I like to describe a function named "area" that computes the
>> area of a rectangle.
>> The corresponding Popcorn expression for the anonymous function is:
>> fns1.lambda[$a, $b -> $a * $b]
>> What is now the correct method to name this function.
>> I can, for example, just give it an ID like
>> fns1.lambda[$a, $b -> $a * $b] : area
>> and invoke it with #area(3, 4) at an later point.
>> But I think this is some kind of structure sharing since the lambda
>> expression is
>> simply copied into the resulting OpenMath object and not the invocation of
>> a single function named "area".
>> I would be grateful if somebody can help me.
>> Best regards,
>> Ken
>> _______________________________________________
>> Om mailing list
>> Om at openmath.org
>> http://openmath.org/mailman/listinfo/om
> James Davenport
> National Teaching Fellow 2014
> Hebron & Medlock Professor of Information Technology, University of Bath
> OpenMath Content Dictionary Editor
> Director of Studies EPSRC Doctoral Taught Course Centre for HPC
> Chair, IMU Committee on Electronic Information and Communication
> Vice-President and Academy Trustee, British Computer Society
> SW Coordinator, Computing at School Network of Excellence
> _______________________________________________
> Om mailing list
> Om at openmath.org
> http://openmath.org/mailman/listinfo/om

More information about the Om mailing list