September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,12 @@
|
|||
say "Manual list traversal"
|
||||
index = list~first -- demonstrate traversal
|
||||
loop while index \== .nil
|
||||
say index~value
|
||||
index = index~next
|
||||
end
|
||||
|
||||
say
|
||||
say "Do ... Over traversal"
|
||||
do value over list
|
||||
say value
|
||||
end
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
enum NEXT,DATA
|
||||
constant empty_sll = {{1}}
|
||||
sequence sll = empty_sll
|
||||
|
||||
procedure insert_after(object data, integer pos=length(sll))
|
||||
sll = append(sll,{sll[pos][NEXT],data})
|
||||
sll[pos][NEXT] = length(sll)
|
||||
end procedure
|
||||
|
||||
insert_after("ONE")
|
||||
insert_after("TWO")
|
||||
insert_after("THREE")
|
||||
|
||||
?sll
|
||||
|
||||
procedure show()
|
||||
integer idx = sll[1][NEXT]
|
||||
while idx!=1 do
|
||||
?sll[idx][DATA]
|
||||
idx = sll[idx][NEXT]
|
||||
end while
|
||||
end procedure
|
||||
show()
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<@ LETCNSLSTLIT>public holidays|開國紀念日^和平紀念日^婦女節、兒童節合併假期^清明節^國慶日^春節^端午節^中秋節^農曆除夕</@>
|
||||
<@ OMT>From First to Last</@>
|
||||
<@ ITEFORSZELSTLIT>public holidays|
|
||||
<@ SAYLST>...</@><@ ACTMOVFWDLST>...</@>
|
||||
</@>
|
||||
<@ OMT>From Last to First (pointer is still at end of list)</@>
|
||||
<@ ITEFORSZELSTLIT>public holidays|
|
||||
<@ SAYLST>...</@><@ ACTMOVBKWLST>...</@>
|
||||
</@>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<# 指定构造列表字串>public holidays|開國紀念日^和平紀念日^婦女節、兒童節合併假期^清明節^國慶日^春節^端午節^中秋節^農曆除夕</#>
|
||||
<# 忽略>From First to Last</#>
|
||||
<# 迭代迭代次数结构大小列表字串>public holidays|
|
||||
<# 显示列表>...</#><# 运行移位指针向前列表>...</#>
|
||||
</#>
|
||||
<# 忽略>From Last to First (pointer is still at end of list)</#>
|
||||
<# 迭代迭代次数结构大小列表字串>public holidays|
|
||||
<# 显示列表>...</#><# 运行移位指针向后列表>...</#>
|
||||
</#>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
foreach n in (List(1,2,3) {...}
|
||||
List(1,2,3).pump(...) // traverse and munge elements, generalized apply/map
|
||||
List(1,2,3).filter(...)
|
||||
List(1,2,3).filter22(...) // partition list
|
||||
List(1,2,3).reduce(...)
|
||||
List(1,2,3).apply(...)
|
||||
List(1,2,3).sum()
|
||||
List(1,2,3).run() // treat each element as f, perform f()
|
||||
List(1,2,3).enumerate()
|
||||
List(1,2,3).reverse()
|
||||
List(1,2,3).concat()
|
||||
List(1,2,3).shuffle()
|
||||
Loading…
Add table
Add a link
Reference in a new issue