summaryrefslogtreecommitdiff
path: root/dot_config/nvim/fnl/toast
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dot_config/nvim/fnl/toast/core.fnl8
-rw-r--r--dot_config/nvim/fnl/toast/nvim.fnl7
2 files changed, 15 insertions, 0 deletions
diff --git a/dot_config/nvim/fnl/toast/core.fnl b/dot_config/nvim/fnl/toast/core.fnl
index 2a426d1..82b0c40 100644
--- a/dot_config/nvim/fnl/toast/core.fnl
+++ b/dot_config/nvim/fnl/toast/core.fnl
@@ -19,6 +19,13 @@
"Returns true if the argument is a number."
(= :number (type n)))
+(fn every? [pred xs]
+ "Returns true if (pred x) is logical true for every x in xs, else false."
+ (accumulate [pass true
+ _ x (ipairs xs)
+ &until (not pass)]
+ (pred x)))
+
; sequences
(fn drop [n xs]
"Returns a table of all but the first n elements in xs."
@@ -81,6 +88,7 @@
: empty?
: nil?
: number?
+ : every?
; sequences
: drop
: first
diff --git a/dot_config/nvim/fnl/toast/nvim.fnl b/dot_config/nvim/fnl/toast/nvim.fnl
new file mode 100644
index 0000000..fddc0e7
--- /dev/null
+++ b/dot_config/nvim/fnl/toast/nvim.fnl
@@ -0,0 +1,7 @@
+(local {: every?} (require :toast.core))
+
+(fn executable? [& paths]
+ "Check if every argument specified is an executable that neovim can resolve."
+ (every? #(not= 0 (vim.fn.executable $)) paths))
+
+{: executable?}