From 17f8db920b775e163d3ae2902815d51e81f34cfa Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 10 Jun 2021 07:08:37 +1200 Subject: [PATCH] Add a lisp mode --- fun/lisp_mode.nu | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 fun/lisp_mode.nu diff --git a/fun/lisp_mode.nu b/fun/lisp_mode.nu new file mode 100644 index 0000000..b3eef19 --- /dev/null +++ b/fun/lisp_mode.nu @@ -0,0 +1,35 @@ +# Note: this requires the latest 0.32.1 or later +# +# usage: +# > source lisp_mode.nu +# > (echo (+ 1 (* 3 2))) + +def + [x, y] { $x + $y } + +def - [x, y] { $x - $y } + +def * [x, y] { $x * $y } + +def / [x, y] { $x / $y } + +def in [x, y] { $x in $y } + +def not-in [x, y] { $x not-in $y} + +def < [x, y] { $x < $y } + +def <= [x, y] { $x <= $y } + +def > [x, y] { $x > $y } + +def >= [x, y] { $x >= $y } + +def == [x, y] { $x == $y } + +def != [x, y] { $x != $y } + +def =~ [x, y] { $x =~ $y } + +def !~ [x, y] { $x !~ $y } + +def array [...rest] { echo $rest }