34 lines
515 B
Elixir
34 lines
515 B
Elixir
object List
|
|
def +(another)
|
|
Erlang.lists.append(self, another)
|
|
end
|
|
|
|
def foldl(acc, function)
|
|
Erlang.lists.foldl(function, acc, self)
|
|
end
|
|
|
|
def map(function)
|
|
Erlang.lists.map(function, self)
|
|
end
|
|
|
|
def join(string)
|
|
strings = map -> (x) x.to_s.to_char_list
|
|
String.new Erlang.string.join(strings, string.to_char_list)
|
|
end
|
|
|
|
def to_list
|
|
self
|
|
end
|
|
|
|
def to_bin
|
|
Erlang.list_to_binary(self)
|
|
end
|
|
|
|
def to_char_list
|
|
self
|
|
end
|
|
|
|
def length
|
|
Erlang.length(self)
|
|
end
|
|
end |