Jump to content

Talk:M-expression

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Mathematica

[edit]

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 (talkcontribs) 22:08, 17 November 2004

What is an M-expression

[edit]

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)[reply]

M-expressions are homoiconic

[edit]

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.

[edit]

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:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 14:22, 28 May 2017 (UTC)[reply]

why 'T' or 't'?

[edit]

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)[reply]

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)[reply]