Closed oubiwann closed 9 years ago
Issue #6 has been closed (completed).
The predicates are now available for use:
> (defun get-env-funcs ()
(lists:sort
(lists:map
(lambda (x)
(element 1 x))
(element 3 $ENV))))))
> (set before (sets:from_list (get-env-funcs)))
#(set 11 16 16 8 80 48
...)
> (include-lib "lutil/include/predicates.lfe")
loaded
> (set after (sets:from_list (get-env-funcs)))
#(set 49 16 16 8 80 48
...
> (set loaded-funcs (lists:sort (sets:to_list (sets:subtract after before)))))
...
Now we can see the functions available in our REPL environment that were brought in from include-lib
:
> (lfe_io:format "~p~n" (list loaded-funcs))
(all? any? atom? binary? bitstring? bool? dict? element? empty? even?
every? false? float? func? function? identical? in? int? integer?
list? loaded neg? nil? not-any? not-in? number? odd? pos? record?
reference? set? string? true? tuple? undef? undefined? unicode?
zero?)
ok
You can use the predicates include from the REPL or in modules:
> (include-lib "lutil/include/predicates.lfe")
loaded
> (zero? 0)
true
> (zero? 1)
false
etc. ;-)
As a convenience, we should offer a predicates include that can be pulled in with
(include-lib ...)
.Depends upon issue #6.