mitodl / mitx-grading-library

The MITx Grading Library, a python grading library for edX
https://edge.edx.org/courses/course-v1:MITx+grading-library+examples/
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

Functions to implement in asciimath javascript #95

Closed jolyonb closed 6 years ago

jolyonb commented 6 years ago

These are the new functions that we've introduced that don't have a corresponding function in AsciiMath:

jolyonb commented 6 years ago

Here's some of the replacements we want:

Here's the dagger symbol definition:

// Add the dagger symbol, used in Hermitian conjugate/adjoint
AM.newsymbol({input:"dagger", tag:"mi", output:"\u2020", tex:null, ttype:AM.TOKEN.CONST});

In all cases, single character entries should not have parentheses. That includes all entries in this list:

['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'alpha', 'beta', 'chi', 'delta', 'Delta', 'epsi', 'varepsilon', 'eta', 'gamma', 'Gamma', 'iota', 'kappa', 'lambda', 'Lambda', 'lamda', 'Lamda', 'mu', 'nu', 'omega', 'Omega', 'phi', 'varphi', 'Phi', 'pi', 'Pi', 'psi', 'Psi', 'rho', 'sigma', 'Sigma', 'tau', 'theta', 'vartheta', 'Theta', 'upsilon', 'xi', 'Xi', 'zeta']

Note that we should also let hat or vec prepend any item in this list.

jolyonb commented 6 years ago

After #116, the only features I don't have a good way to implement are the following two:

Both of these need splitList to work.

ChristopherChudzicki commented 6 years ago

I'll work on splitList. Another thing I have been thinking about is some minor validation. In particular, I think that the callback actions toreplaceFunctionCall should verify that they have received the correct number of arguments.

This isn't an issue now (since with splitList not implemented, args is always a list of length 1). But once we have splitList, our current implementation of factorial would render fact(3, 4) as 3! (completely ignoring the 4). So I want to throw errors unless the correct number of arguments has been received. That way:

fact(5) ---> 5! fact(5, 6) ---> fact(5, 6)

jolyonb commented 6 years ago

That sounds look a good idea.

jolyonb commented 6 years ago

Resolved by #116 and #118.