-
Notifications
You must be signed in to change notification settings - Fork 37
List
Lists are immutable and singly linked. A list literal looks like:
[1,2,3,4,5]
Note: work on List methods is ongoing.
- Ruby equivalent: Array#[]
- Erlang equivalent: lists:nth/2, lists:seq/2
- Implemented: partial (Currently only supports simple index lookups)
Retrieve the nth element of a list.
- Ruby equivalent: Enumerable#all?
- Erlang equivalent: lists:all/2
- Implemented: partial (Currently only supports lists:all/2 behavior)
Passes each element of the collection to the given block. The method returns true if the block never returns false or nil. If the block is not given, an implicit block of {|obj| obj} is used (that is all? will return true only if none of the collection members are false or nil.)
- Ruby equivalent: Enumerable#any?
- Erlang equivalent: lists:any/2
- Implemented: partial (Currently only supports lists:any/2 behavior)
Passes each element of the collection to the given block. The method returns true if the block ever returns a value other than false or nil. If the block is not given, an implicit block of {|obj| obj} is used (that is any? will return true if at least one of the collection members is not false or nil.
- Ruby equivalent: Array#concat
- Erlang equivalent: lists:append/2
- Implemented: complete
Appends the elements of other_list to self, returning a new list.
- Ruby equivalent: Array#each
- Erlang equivalent: lists:each/2
- Implemented: partial (lacks Enumerator support)
Calls block once for each element in self, passing that element as a parameter.