Thank you for your explanation. So I should use fns1.lambda to bind the variable $area within "context". But, if i like to use $area outside of "context" then I have to resort to the symbols in prog1 like prog1.assignment and prog1.local_var.
So if I like to have a global reference to a function named area like http://openmath.org/fns/area then this is only supported by structural sharing using the id and href mechanisms of OpenMath? Best regards, Ken ________________________________________ Von: James Davenport [[email protected]] Gesendet: Montag, 4. Mai 2015 11:45 An: Wenzel, Ken Cc: [email protected] Betreff: Re: [Om] Named functions in OpenMath 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. Have you looked at the prog1 CD, which might be what you want. James Quoting "Wenzel, Ken" <[email protected]>: > 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 > [email protected] > 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 [email protected] http://openmath.org/mailman/listinfo/om
