This is sort of like a Zip-List data structure - but instead of focusing on a speicific list item - it retains the focuson the same item and moves that item around in the list.
Initializes an ArrageableList given a list before (pre), list after (post), and the selected (focused) item.
initialize [] ["Batman", "Superman", "Green Lantern"] "Wonder Woman"Create an ArrangeableList from an Array and an integer that specifies an index in the array which should be the selected item. This returns a Maybe Arrageablelist. A Nothing is returned if the index is invalid/out of bounds.
myArray =
Array.fromList ["Superman", "Batman", "Green Lantern"]
fromArray myArray 1Create an ArrangeableList from a List and an integer that specifies an index in the list which should be the selected item. This returns a Maybe Arrageablelist. A Nothing is returned if the index is invalid/out of bounds.
fromArray ["Superman", "Batman", "Green Lantern"] 0Creates an ArrangeableList from a supplied List and a value - placing value at the head of the list.
fromListAtHead ["Superman", "Batman", "Green Lantern"] "WonderWoman"Creates and ArrangeableList from a supplied list and a value - placing the value at the tail of the list.
fromListAtHead ["Superman", "Batman", "Green Lantern"] "WonderWoman"Returns the currently selected value
Returns the items in the list before the selected value.
Returns the items in the list after the selected value.
Uses equality check (==) to check if the given value is the currently selected item in the list
Moves the selected item forward in the list.
myList =
fromListAtHead ["Superman", "Batman", "Green Lantern"] "WonderWoman"
progress myList
|> toList -- ["Superman", "WonderWoman", "Batman", "Green Lantern"]Moves the selected item backward in the list.
myList =
fromListAtTail ["Superman", "Batman", "Green Lantern"] "WonderWoman"
retrogress myList
|> toList -- ["Superman", "Batman", "WonderWoman", "Green Lantern"]Returns a regular List of the items that compose the ArrangeableList.
Returns an Array of the items that compose the ArrangeableList.
Apply a function to each item of the arrangeable list