In the following example, please assume that we are using time-to-seconds
to convert each times-stamp into a decimal representation. I have already converted the time-stamps to seconds in this example. Each node has at least one time-stamp, but there might be more than one time-stamp per node. The current node with corresponding time-stamp is represented by a cons
cell with the cdr
being t
. The time-stamps will always be unique. The nodes are vectors with multiple elements.
(defun goto-node (time-stamp n)
"Go to the desired node commencing from an existing TIME-STAMP.
If N is positive, then go forwards in time by that number of N time-stamps.
If N is negative, then backwards in time by that number of N time-stamps.
If node does not exist, return nil; otherwise, return node and corresponding time-stamp."
INSERT MAGIC HERE)
BEGIN WITH:
'(([node1] ((5.6) (3.7) (11.7) (8.2)))
([node2] ((4.4) (9.9) (6.1 . t)))
([node3] ((7.5) (2.3) (1.5)))
([node4] ((10.3))))
EXAMAPLES:
(goto-node 6.1 -1)
=> '([node1] (5.6))
(goto-node 6.1 -4)
=> '([node3] (2.3))
(goto-node 6.1 1)
=> '([node3] (7.5))
(goto-node 6.1 4)
=> '([node4] (10.3))