# NOT RUN {
### create a new instance
# to create a new instance of the class
dll <- RDLL$new()
# the previous RDLL instance will be removed if you run
dll <- RDLL$new(0, 1, 2, collapse=list(3, 4))
# the following sentence is equivalent to the above
dll <- RDLL$new(0, 1, 2, 3, 4)
# where the numbers 0, 1, 2, 3, 4 are appended into the DLL
### immutable methods
# show
dll$show()
# elem_at
dll$elem_at(1)
# toList
tmp <- dll$toList
### mutable methods
# insert_at
dll$insert_at(1, -1)
dll$insert_at(dll$size+1, "end")
# remove_at
for(iter in 1:dll$size) dll$remove_at(1)
# }
Run the code above in your browser using DataLab