VList: Difference between revisions

No change in size ,  1 year ago
m
m (→‎{{header|Component Pascal}}: Fix "Cdr" comment)
Line 382:
<lang oberon2>
MODULE RosettaVLists;
(** In 2002, Phil Bagwell published "Fast Functional Lists" which introduced VLists as alternatives to Functional Programming's ubiquitous linked lists and described Visp (a dialect of Common Lisp) using VLists, but including a "foldr" function, optimized to use VLists. VLists have the same properties as immutable functional linked lists (including full persistence); but, unlike a linked list, with O(1) random access time. The VLists implemented here is based on section 2.1 of that article but has been modified to retain the safety features of Component Pascal.
ubiquitous linked lists and described Visp (a dialect of Common Lisp) using VLists, but including a "foldr" function, optimized to use VLists. VLists have the same properties as immutable functional linked lists (including full persistence); but, unlike a linked list, with O(1) random access time. The VLists implemented here is based on section 2.1 of that article but has been modified to retain the safety features of Component Pascal.
 
VLists are referenced through 2 fields: "base" and "offset". A third field "length" reduces the time to determine its length to O(1).
Anonymous user