File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11defmodule LanguageList do
2+ @ spec new :: [ ]
23 def new ( ) do
3- # Please implement the new/0 function
4+ [ ]
45 end
56
7+ @ spec add ( nonempty_maybe_improper_list , any ) :: nonempty_maybe_improper_list
68 def add ( list , language ) do
7- # Please implement the add/2 function
9+ [ language | list ]
810 end
911
10- def remove ( list ) do
11- # Please implement the remove/1 function
12+ @ spec remove ( nonempty_maybe_improper_list ) :: any
13+ def remove ( [ _ | t ] ) do
14+ t
1215 end
1316
14- def first ( list ) do
15- # Please implement the first/1 function
17+ @ spec first ( nonempty_maybe_improper_list ) :: any
18+ def first ( [ h | _ ] ) do
19+ h
1620 end
1721
22+ @ spec count ( list ) :: non_neg_integer
1823 def count ( list ) do
19- # Please implement the count/1 function
24+ length list
2025 end
2126
27+ @ spec functional_list? ( any ) :: boolean
2228 def functional_list? ( list ) do
23- # Please implement the functional_list?/1 function
29+ "Elixir" in list
2430 end
2531end
You can’t perform that action at this time.
0 commit comments