Range modifications: Difference between revisions
m
→{{header|Julia}}
(→{{header|Julia}}: Extra spaces.) |
|||
Line 208:
=={{header|Julia}}==
Julia has iterator classes called a type of Range, such as integer UnitRanges, that are like the "10-10" of the task but are stated as 10:10, with a colon not a minus sign. This implementation uses Julia's UnitRange class internally.
<lang julia>import Base.string, Base.parse, Base.print
Line 295 ⟶ 294:
end
print(io::IO, seq::RangeSequence) = print(io, join(map(string, reduce(seq)), ",
Line 342 ⟶ 341:
removeinteger!(seq3, 7)
println(" removed 7 => ", seq3)
</lang>{{out}}
<pre>
Start: ""
added 77 => 77-77
added 79 => 77-77,
added 78 => 77-79
removed 77 => 78-79
Line 353 ⟶ 351:
removed 79 =>
Start: 1-3,
added 1 => 1-3,
removed 4 => 1-3,
added 7 => 1-3,
added 8 => 1-3,
added 6 => 1-3,
removed 7 => 1-3,
Start: 1-5,
added 26 => 1-5,
added 9 => 1-5,
added 7 => 1-5,
removed 26 => 1-5,
removed 9 => 1-5,
removed 7 => 1-5,
</pre>
|