EECS 111 Lecture Notes - Lecture 6: Linked List, London Academy Of Music And Dramatic Art, Mymusic
Document Summary
Different types can be mixed in the same list. Sceme and racket use a particular type of list called a linked list. Simple list constructors (list item1, item 2, itemx) Creates a list containing the specified items, in order (append item1, item 2, itemx) Creates a new list with all the items from the input list, in order. Simple list accessors (first list), (second list), (tenth list) Extracts the specified element of list (rest list) Returns all but the first element of list (list-ref list index) Extracts the element at position index (a number) Mix different types of data: (list a b c 1 2 3) Have other lists inside them (list a (list b c)) The length of a list is the number of elements in it. When a list has a list within it, the sublist only counts as one element. Lists are numbered from 0 (first item = item 0, second item = item 1)