(I had to take wraping pre in <code;>
to get title acceptible)
Display of <pre>
is rather ugly with all the extra white space. It really needs some CSS styling.
(LETS SEE If I can directly put in a <style>
block and change it)
(ANY BETTER?)
o = {a: 1, b: 2 }
The Javascript syntax coloring is the same but only colored. (I recall that I had to put in a “The” at the start of this pgh so I wouldn’t get a parse error.)
o = {a: 1,
b: 2
}
Example showing correct ampersand escaping in ID attribute, td as textnode, td containg XML. Note that spaces are INCORRECTLY stripped from around QUOT APOS and the code
item.
“,”!AsXML“:{”junkX“:”1“},”junk“:”a ' b " c < d > e & f“,”junkX“:”a ' b " c <code>XxX</code> d & e“}‘>
<!-- 2c -->XxX
d & e
Giving table captions example. A caption property can be plain text (!Caption) where the characters “<” and “>” can appear but wind up being escaped, or XML (!XMLCaption) where those brackets if they appear are assumed to delimit XHTML entities such as <code>
.
{"!Caption": "top caption",
id: "test1",
a: "x",
b: {c: {d: "y", e: "z", "!XMLCaption": "internal XML
caption"},
f: "w"},
}
{"!Caption":"top caption","id":"test1","a":"x","b":{"c":{"d":"y","e":"z","!XMLCaption":"internal <code>XML</code> caption"},"f":"w"}}
(THE jso shown above may not have been correctly updated to reflect this example that works)
!Caption | top caption | ||||||||||||||||
id | test1 | ||||||||||||||||
a | x | ||||||||||||||||
b |
|
3) 2 column vs 1 column-with-header display examples.
{a: "x", b: {c: {d: "y", e: "z"}, f: "w"}, } {"a":"x","b":{"c":{"d":"y","e":"z"},"f":"w"}}
a | x | |||||||||||||
b |
|
Example with some internal objects displayed in 1 column-with-header (full display)
{a: "x", b: {"!Columns": 1, c: {"!Columns": 1, d: "y", e: "z"}, f: "w"}, } {"a":"x","b":{"!Columns":1,"c":{"!Columns":1,"d":"y","e":"z"},"f":"w"}}
a | x | |||||||||||||||||||||||||
b |
|
3c) 1 column-with-header with top level !NoBang: 1
that suppresses property names that start with bang (!).
{"!NoBang": 1, a: "x", b: {"!Columns": 1, c: {"!Columns": 1, d: "y", e: "z"}, f: "w"}, } {"!NoBang":1,"a":"x","b":{"!Columns":1,"c":{"!Columns":1,"d":"y","e":"z"},"f":"w"}}
a | x | |||||||||||||||||
b |
|
{"a":"x","b":{"!Label":"pp","c":{"d":"y","e":{"!Atom":"z", "!Label":"qq"},"f":"w"}}}
a | x | ||||||||||||||||||||||
b | pp |
|
{"!NoBang":"1","a":"x","b":{"!Label":"pp","c":{"d":"y","e":{"!Atom":"z", "!Label":"qq"},"f":"w"}}}
a | x | |||||||||||||
b | pp |
|
{"!Columns":"1","a":"x","b":{"!Label":"pp","c":{"d":"y","e":{"!Atom":"z", "!Label":"qq"},"f":"w"}}}
| |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
|
{"!Columns":"1","!NoBang":"1","a":"x","b":{"!Label":"pp","c":{"d":"y","e":{"!Atom":"z", "!Label":"qq"},"f":"w"}}}
| |||||||||||||||||||
|
It looks here that JSON.stringify and JSON.parse really don’t know how to handle arrays.
x = {a: 'b', 'c'], ['d', 'e'?}; x.a[0]; => b,c s = JSON.stringify(x) => {"a":"\"b\", \"c\"], [\"d\", \"e\"?"} os = JSON.parse(s) => [object Object] uneval(os) => ({a:"\"b\", \"c\"], [\"d\", \"e\"?"}) os.a[0] => [
“}‘>
<!-- 2c -->
x = {a: 'b', 'c'], ['d', 'e'?};
genEntry(x) =>
a |
|
Define “pair”.
p = {Type: {"!Atom": "pair structure", "!Label": "t"}, "!Label": "pair", part: {1: {"!Label": "p1", Type: " structure"}, 2: {"!Label": "p2", Type: " structure"}, }, swapped: {Type: {}, part: {}, swapped: {}, }, Notes: "See ordered pair.", }; p.swapped.Type = p.Type; p.swapped.part[1] = p.part[2]; p.swapped.part[2] = p.part[1]; p.swapped.swapped = p; pn = eval(uneval(p)); // clone it pn['!NoBang'] = 1;
Generated ID for pn:
rEsc(pn) => #4={Type:#1={'!Atom':"pair < structure", '!Label':"t"}, '!NoBang':1, '!Label':"pair", part:{1:#3={'!Label':"p1", Type:"< structure"}, 2:#2={'!Label':"p2", Type:"< structure"}}, swapped:{Type:#1#, part:{1:#2#, 2:#3#}, swapped:#4#}, Notes:"See ordered pair."}
Generated table for p:
.“, '!Seen':1}‘
?pair |
|
</table>
Generated table for pn:
.“}‘
?pair |
|
</table>
A pair has two parts. The map “swapped” (aka. “transpose”) switches the parts, and .
.“}‘
?pair |
|
</table>
A twin is a pair in which both components are the same.
t = eval(uneval(p)) // clone "pair" t.Type['!Atom'] = "twin pair structure"; t.part[2] = t.part[1]; t.swapped = t;
Essentially , though this formulation doesn’t notice that “swapped” is now an identity.
.“, '!Seen':1}‘
?pair |
|
</table>
A small definition of this is:
?s |
|
Then with type inference from “twin”, essentially , this becomes:
s1 = eval(uneval(s0)); // clone s1.twinned.part[2] = s1.twinned.part[1]; s1.twinned.swapped = s1.twinned;
as
?s |
|
c1.from.part[1].generic_member.in = c1.from.part[1]; c1.from.part[2].generic_member.in = c1.from.part[2]; c1.to.generic_member.in = c1.to; c1.to.generic_member.part[1] = c1.from.part[1].generic_member; c1.to.generic_member.part[2] = c1.from.part[2].generic_member; c1.projection[1].from = c1.to; c1.projection[1].to = c1.from.part[1]; c1.projection[2].from = c1.to; c1.projection[2].to = c1.from.part[2];
.“})‘
|
</table>
The END.
Last revised on May 25, 2014 at 05:08:23. See the history of this page for a list of all contributions to it.