mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00

This PR is part of porting all old scripts #221 and ports `fun` folder <details><summary>Summary</summary> ### star.nu ```yaml from: before_v0.60/fun/star.nu to: modules/fun/star.nu ``` ### spark.nu The script has already been ported. I've removed old version. ```yaml from: before_v0.60/fun/spark.nu to: sourced/fun/spark.nu functions: spark: sourced/fun/spark.nu:1:spark ``` ### life.nu ```yaml from: before_v0.60/fun/life.nu to: modules/fun/life.nu ``` ### lisp_mode.nu There is a problem with this module because `-` is not allowed in names anymore, however `def "-"` is a valid syntax, but you will be unable to call this function. ```yaml from: before_v0.60/fun/lisp_mode.nu to: sourced/fun/lisp_mode.nu ``` ### nyancat.nu I also fixed animation frames from https://github.com/klange/nyancat ```yaml from: before_v0.60/fun/nyancat.nu to: modules/fun/nyancat.nu ``` </details>
36 lines
557 B
Text
36 lines
557 B
Text
# 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 }
|
|
|