-
Notifications
You must be signed in to change notification settings - Fork 6
/
logic.cljc
45 lines (36 loc) · 1.46 KB
/
logic.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(ns axel-f.functions.logic
(:require [axel-f.functions.core :refer [def-excel-fn]]))
(defn and*
[& args]
(every? identity args))
(def and*-meta
{:desc "Returns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false."
:args [{:desc "Returns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false."}
{:desc "An expression or reference to some logical value, i.e. TRUE or FALSE, or can be coerced to a logical value."
:opt true
:repeatable true}]})
(defn not*
[logical-expression]
(not logical-expression))
(def not*-meta
{:desc "Returns the opposite of a logical value - `NOT(TRUE)` returns `FALSE`; `NOT(FALSE)` returns `TRUE`."
:args [{:desc "An expression or reference holding an expression that represents some logical value, i.e. TRUE or FALSE."}]})
(defn or*
[& args]
(boolean (some identity args)))
(def or*-meta
{:desc "Returns true if any of the provided arguments are logically true, and false if all of the provided arguments are logically false."
:args [{:desc "An expression or reference to some logical value, i.e. TRUE or FALSE, or can be coerced to a logical value."}
{:desc "More expressions that evaluate to logical values."
:opt true
:repeatable true}]})
(def-excel-fn
"AND"
and*
and*-meta
"OR"
or*
or*-meta
"NOT"
not*
not*-meta)