Cantor set: Difference between revisions

→‎{{header|JavaScript}}: Added headings to distinguish 3 representations
(→‎Dual representation: Adjusted title to `Rational pairs`)
(→‎{{header|JavaScript}}: Added headings to distinguish 3 representations)
Line 1,591:
 
=={{header|JavaScript}}==
===Cantor: (Bool, Int) pairs===
{{Trans|Python}} (Functional version)
{{Trans|Haskell}}
Line 1,596 ⟶ 1,597:
"use strict";
 
// --------------------- CANTOR BOOL--------INT PAIRS --------------
 
// cantor :: [(Bool, Int)] -> [(Bool, Int)]
Line 1,688 ⟶ 1,689:
* * * * * * * * * * * * * * * *</pre>
 
===Cantor: Strings===
Or, usingUsing strings for the model as well as the display:
{{Trans|Haskell}}
<lang javascript>(() => {
Line 1,774 ⟶ 1,776:
 
 
Cantor ternary intervals rendered both as lists of ratiorational pairs, and as graphic bars.
In the case of languages like Javascript which lack a built-in Ratio type, or standard Fraction/Ratio library, rendering stages of the set elaboration as lists of fraction pairs may take more work than rendering them as graphic lines.
 
9,655

edits