1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-03 07:37:47 +00:00

Port before_v0.60/fun folder (issue #221) (#835)

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>
This commit is contained in:
Igor 2024-05-13 16:55:11 +04:00 committed by GitHub
parent b40ead9ae2
commit 2fe0756df9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 194 additions and 236 deletions

36
sourced/fun/lisp_mode.nu Normal file
View file

@ -0,0 +1,36 @@
# 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 }