Talk:M-expression
Template:Talkheader Template:WikiProject banner shell
Mathematica
It is perhaps notable that the computer algebra system Mathematica uses the M-Expression syntax as its "generic" representation of data and functions. —Preceding unsigned comment added by JasticE (talk • contribs) 22:08, 17 November 2004
What is an M-expression
This page doesn't say what an M-expression is. — Preceding unsigned comment added by 81.164.106.200 (talk) 18:42, 14 February 2013 (UTC)
M-expressions are homoiconic
Given that Lisp encoded as S-expressions is homoiconic, and that M-expressions form a one-to-one, invertible correspondence with their equivalent S-expressions, it should then be obvious that M-expressions are thus also homoiconic. Therefore, no expressive power is lost by the utilization of M-expression syntax compared to S-expression syntax.
External links modified
Hello fellow Wikipedians,
I have just modified one external link on M-expression. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
- Added archive https://web.archive.org/web/20080516210916/http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf to http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
Cheers.—InternetArchiveBot (Report bug) 14:22, 28 May 2017 (UTC)
why 'T' or 't'?
in the table example...
[lessp[x;0] → minus[x]; T → x] (cond ((< x 0) (- x)) (t x))
... why e.g. "(t x)" instead of just 'x' or "(x)"?
(I'm a noob re Lisp.) Abe149 (talk) 04:02, 26 July 2023 (UTC)
- COND clauses starts with a condition. Anything that isn't NIL is true, but the symbol T is used as the canonical value for truth. So `(t x)` is a clause that is always selected if we reach it (because its condition is just T) and whose result is the value of X.
- X by itself is a syntax error (at least in Common Lisp and Scheme) because COND clauses need to be lists. `(X)` would work here: X is used as the condition, and if it's true, its value will be returned since we don't give an explicit value for that clause, and if X is NIL, then we run out of COND clauses, so the result of the COND will be NIL. The difference is that `(X)` is selected or not based off whether X is NIL, and if it's not selected, we only get NIL because no clauses were selected; if you put another clause after `(t x)`, it would never be selected (because T is always true), but if you put one after `(x)`, it would be selected in the cases where X is NIL.
- `(t x)` also matches the mexpr syntax which needs something on the left of the arrow. 204.83.110.176 (talk) 16:19, 30 December 2023 (UTC)