Module | Prelude |
In: |
lib/prelude.rb
lib/prelude/list.rb lib/prelude/monad.rb lib/prelude/tuple.rb |
VERSION | = | '0.0.3' | ||
Id | = | lambda { |x| x } | Returns function that returns its argument |
This is used to handle empty list errors in this library. Re-define to fit.
# File lib/prelude.rb, line 39 39: def empty_list_error 40: raise EmptyListError, 'Illegal operation on an empty list.' 41: end
A utility to determine if a function was passed
# File lib/prelude.rb, line 52 52: def get_proc(f=nil, &block) 53: # Has to be either function 'f' or block 54: f = block_given? ? block : missing_function_error if f.nil? 55: f.to_proc 56: end