Unicon extends delete(x1, x2, ...) to allow deletion of items from lists.
According to the Unicon book, p. 312, ‘If x1 is a list... elements xi are
integer indices of the element to be deleted.’
Negative indices into lists are allowed in other contexts, e.g. if L is a
list, L[-1] returns the same element as L[*L]. But negative indices do not
work with delete(). The following code produces the output listed below:
procedure main()
write(&version)
write()
H := []
every put(H, 1 to 10)
write("Size of H is ", *H)
delete(H, -1)
write("delete(H, -1)")
write("Size of H is ", *H)
delete(H, *H)
write("delete(H, *H)")
write("Size of H is ", *H)
end
Unicon Version 12.1. April 13, 2013
Size of H is 10
delete(H, -1)
Size of H is 10
delete(H, *H)
Size of H is 9
I would expect the statement
delete(H, -1)
to delete the last element of H. But it does nothing at all.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group