version 0.7.0
This commit is contained in:
parent
972c510861
commit
8b2a9401a1
185 changed files with 21451 additions and 24296 deletions
|
|
@ -1,4 +1,7 @@
|
|||
# Test the &= operator for sequences and strings
|
||||
# Test the add proc for sequences and strings
|
||||
|
||||
const
|
||||
nestedFixed = true
|
||||
|
||||
type
|
||||
TRec {.final.} = object
|
||||
|
|
@ -8,36 +11,35 @@ type
|
|||
TRecSeq = seq[TRec]
|
||||
|
||||
proc test() =
|
||||
var seq, b: seq[string]
|
||||
seq = []
|
||||
add(seq, "Hi")
|
||||
add(seq, "there, ")
|
||||
add(seq, "what's your name?")
|
||||
var s, b: seq[string]
|
||||
s = @[]
|
||||
add(s, "Hi")
|
||||
add(s, "there, ")
|
||||
add(s, "what's your name?")
|
||||
|
||||
b = seq # deep copying here!
|
||||
b = s # deep copying here!
|
||||
b[0][1] = 'a'
|
||||
|
||||
for i in 0 .. length(seq)-1:
|
||||
write(stdout, seq[i])
|
||||
for i in 0 .. length(b)-1:
|
||||
for i in 0 .. len(s)-1:
|
||||
write(stdout, s[i])
|
||||
for i in 0 .. len(b)-1:
|
||||
write(stdout, b[i])
|
||||
|
||||
|
||||
when defined(nestedFixed):
|
||||
when nestedFixed:
|
||||
proc nested() =
|
||||
var
|
||||
seq: seq[seq[string]]
|
||||
s: seq[seq[string]]
|
||||
for i in 0..10_000: # test if the garbage collector
|
||||
# now works with sequences
|
||||
seq = [
|
||||
["A", "B", "C", "D"],
|
||||
["E", "F", "G", "H"],
|
||||
["I", "J", "K", "L"],
|
||||
["M", "N", "O", "P"]
|
||||
]
|
||||
s = @[
|
||||
@["A", "B", "C", "D"],
|
||||
@["E", "F", "G", "H"],
|
||||
@["I", "J", "K", "L"],
|
||||
@["M", "N", "O", "P"]]
|
||||
|
||||
test()
|
||||
when defined(nestedFixed):
|
||||
when nestedFixed:
|
||||
nested()
|
||||
|
||||
#OUT Hithere, what's your name?Hathere, what's your name?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue