September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1 @@
?sort(shuffle({5,"oranges",6,"apples",7}))

View file

@ -0,0 +1,39 @@
enum data, left, right
function tmap(sequence tree, integer rid)
tree[data] = call_func(rid,{tree[data]})
if tree[left]!=null then tree[left] = tmap(tree[left],rid) end if
if tree[right]!=null then tree[right] = tmap(tree[right],rid) end if
return tree
end function
function newnode(object v)
return {v,null,null}
end function
function add10(atom x) return x+10 end function
procedure main()
object root = newnode(1.00)
-- Add some nodes.
root[left] = newnode(1.10)
root[left][left] = newnode(1.11)
root[left][right] = newnode(1.12)
root[right] = newnode(1.20)
root[right][left] = newnode(1.21)
root[right][right] = newnode(1.22)
-- Now the tree has seven nodes.
-- Show the whole tree.
ppOpt({pp_Nest,2})
pp(root)
-- Modify the whole tree.
root = tmap(root,routine_id("add10"))
-- Show the whole tree again.
pp(root)
end procedure
main()