Sha256: bcd7e265d0099bcb322b335112483a4478a57e16e06704239131efa707cd9e6a
Contents?: true
Size: 830 Bytes
Versions: 69
Compression:
Stored size: 830 Bytes
Contents
defmodule ListOps do # Please don't use any external modules (especially List) in your # implementation. The point of this exercise is to create these basic functions # yourself. # # Note that `++` is a function from an external module (Kernel, which is # automatically imported) and so shouldn't be used either. @spec count(list) :: non_neg_integer def count(l) do end @spec reverse(list) :: list def reverse(l) do end @spec map(list, (any -> any)) :: list def map(l, f) do end @spec filter(list, (any -> as_boolean(term))) :: list def filter(l, f) do end @type acc :: any @spec reduce(list, acc, (any, acc -> acc)) :: acc def reduce(l, acc, f) do end @spec append(list, list) :: list def append(a, b) do end @spec concat([[any]]) :: [any] def concat(ll) do end end
Version data entries
69 entries across 69 versions & 1 rubygems