Singly-linked list/Element definition: Difference between revisions
Content deleted Content added
Added PicoLisp |
|||
Line 198: | Line 198: | ||
Now list contains one item, with index of the next item and value. |
Now list contains one item, with index of the next item and value. |
||
Note: this solution exploits the fact that, in this numeric case, data types for index and for node content are the same. If we need to store, for example, strings in the nodes, we should do something different, for example: |
|||
<lang J> list=: 0 2$a: NB. creates list with 0 items |
<lang J> list=: 0 2$a: NB. creates list with 0 items |