3 ms·
Please provide an example of an s-expression that provides more information than can be encoded though a text string that is the same length, and in fact identi
by hjk05 8y ago
Please provide an example of an s-expression that provides more information than can be encoded though a text string that is the same length, and in fact identical to said s-string.
I mean, I get it. Lispers like lisp, and think it’s “better”. But it’s more more expressive than text, and in fact operating on text gives you natural access not just to s-expressions but to any other programming languages or structured and unstructed examples of text.
If you shell operated only on s-expressions that would either have you reduce expresiveness, or just doing tricks to encode the text-stream as a s-expression which hardly qualifies as making it more expressive, that’s just adding extra redundant information around the original information.
- kbutler 8y agoThe lisp interpreter can operate on s-expressions, but it cannot operate on arbitrary text. The specialization of encoding as s-expressions allows the development of the lisp interpreter. Similarly, a C compiler operates on well-formed C programs. Neither one can do its work on arbitrary text or on the other's text. You can argue whether one is better than the other, but while each is a subset of "text" the limitations of the subset enable the expressiveness. "I work on matter" vs "I sculpt" or "I paint" or "I cook".
- Twisol 8y ago> Please provide an example of an s-expression that provides more information than can be encoded though a text string that is the same length, and in fact identical to said s-string. We're talking about a class of strings, not a single individual string. S-expressions are more constrained than arbitrary text, and therefore contain more structure than arbitrary text. Constraints are information. You can't simply impose a tree structure on any arbitrary piece of text.
- TeMPOraL 8y agos/text/unstructured text/ in the OP. S-expressions are serialized by text, but the Lisp approach is more powerful than UNIX approach because Lisp approach works with structured text by default, while UNIX approach assumes unstructured text. UNIX approach forces every program to write its own arbitrary parsing and unparsing, and makes almost every shell one-liner to be half about converting output ad-hoc shapes of text to input ad-hoc shapes of text. The only popular modern incarnation of Lisp philosophy in shells is... PowerShell - where instead of s-expressions, the tools exchange objects. That's AFAIK binary blobs, but if you wanted to retain a text-serializable form, then the most obvious way to do it would be... S-expressions.
- gowld 8y agoOK, we get it. You can embed any language in plain text, so it's "expressive". lisper should have emphasized that "how Unix programmers default to using command-lines text" is less expressive than S-expressions, as history shows that programmers tend to fall into using a language of "records of fields".