Jump to content

Talk:S-expression: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
Natecull (talk | contribs)
No edit summary
Line 19: Line 19:


The diagram is incorrect - it's missing terminating NILs. I've replaced it with a rough PNG that shows the actual cons cell structure as trees (though this is not the ideal visualisation for cons cells). But at least the NILs are visible now. [[User:Natecull|Natecull]] ([[User talk:Natecull|talk]]) 03:47, 17 February 2014 (UTC)
The diagram is incorrect - it's missing terminating NILs. I've replaced it with a rough PNG that shows the actual cons cell structure as trees (though this is not the ideal visualisation for cons cells). But at least the NILs are visible now. [[User:Natecull|Natecull]] ([[User talk:Natecull|talk]]) 03:47, 17 February 2014 (UTC)

== Python parsing code example ==

The parser function is beautiful, but it has some errors. If the input is "1" the result is []. "1 1" gives ['1'], but "1 1 ()" gives ['1', '1', []]. Also, it lacks error handling to deal with mismatched (missing or extraneous) parentheses. Although I realize that code examples can't be expected to be complete, I think it would be nice if this was fixed. Alas, I am not a Python programmer... --[[User:Lasse Hillerøe Petersen|Lasse Hillerøe Petersen]] ([[User talk:Lasse Hillerøe Petersen|talk]]) 22:14, 28 June 2017 (UTC)

Revision as of 22:14, 28 June 2017

WikiProject iconComputing: CompSci Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computer science (assessed as Mid-importance).
Things you can help WikiProject Computer science with:

Are s-exprs data structures, or a notation for them?

The article presents an (somewhat implicit) definition of s-exprs as binary trees with atoms as the leaves, but McCarthy himself defined them as notation that translates to these structures:

We shall now define the S-expressions (S stands for symbolic). They are formed by using the special characters
.
)
(
and an infinite set of distinguishable atomic symbols.

I think the article should be changed to reflect this. The whole point of s-exprs is to convey lists, not to represent them in memory as cons cells or in any other way. Qwertyus (talk) 11:19, 16 February 2012 (UTC)[reply]

True, it is the first time I see sexps described as pairs, and it is all the more misleading with the illustration, which also shows a binary tree, but not the same as pairs. The article needs a serious rewrite. Nowhere man (talk) 13:54, 7 August 2013 (UTC)[reply]


The diagram is incorrect - it's missing terminating NILs. I've replaced it with a rough PNG that shows the actual cons cell structure as trees (though this is not the ideal visualisation for cons cells). But at least the NILs are visible now. Natecull (talk) 03:47, 17 February 2014 (UTC)[reply]

Python parsing code example

The parser function is beautiful, but it has some errors. If the input is "1" the result is []. "1 1" gives ['1'], but "1 1 ()" gives ['1', '1', []]. Also, it lacks error handling to deal with mismatched (missing or extraneous) parentheses. Although I realize that code examples can't be expected to be complete, I think it would be nice if this was fixed. Alas, I am not a Python programmer... --Lasse Hillerøe Petersen (talk) 22:14, 28 June 2017 (UTC)[reply]