AI prompts
base on homoiconic dynamic programming language with some new ideas # Rye language 🌾
[](https://github.com/refaktor/rye/actions/workflows/build.yml)
[](https://github.com/refaktor/rye/actions/workflows/golangci-lint.yml)
[](https://securityscorecards.dev/viewer/?uri=github.com/refaktor/rye)
[](https://pkg.go.dev/github.com/refaktor/rye)
[](https://goreportcard.com/report/github.com/refaktor/rye)
[](https://github.com/refaktor/rye/releases/latest)
[](https://formulae.brew.sh/formula/ryelang)
**For comprehensive documentation, tutorials, and examples, visit [ryelang.org](https://ryelang.org/)**
## What is Rye?
Rye is a high-level, dynamic programming language inspired by Rebol, Factor, Linux shells, and Go. It features a Go-based interpreter and interactive console, making it an excellent scripting companion for Go programs. Rye can also be embedded into Go applications as a scripting or configuration language.
Key characteristics:
- **Homoiconic**: Code is data, data is code
- **Function-oriented**: No keywords, everything is a function call
- **Expression-based**: Everything returns a value
- **First-class functions**: Functions and code blocks are values
- **Multiple dialects**: Specialized interpreters for different tasks
- **Safety-focused**: Explicit state changes, pure/impure function separation, validation dialect
**Status**: Alpha - Core language design is stable, focus is on improving runtime, documentation, and usability.
## Quick Examples
```red
print "Hello World"
"Hello World" .replace "World" "Mars" |print
; prints: Hello Mars
"12 8 12 16 8 6" .load .unique .sum
; returns: 42
{ "Anne" "Joan" "Adam" } |filter { .first = "A" } |for { .print }
; prints:
; Anne
; Adam
fac: fn { x } { either x = 1 { 1 } { x * fac x - 1 } }
; function that calculates factorial
range 1 10 |map { .fac } |print\csv
; prints: 1,2,6,24,120,720,5040,40320,362880,3628800
kind: "admin"
open sqlite://data.db |query { select * from user where kind = ?kind }
; returns: Table of admins
read %name.txt |fix { "Anonymous" } |post* https://example.com/postname 'text
; makes HTTP post of the name read from a file, or "Anonymous" if file failed to be read
```
For more examples and interactive demos, visit [ryelang.org/meet_rye/](https://ryelang.org/meet_rye/)
## Building Rye from Source
### Prerequisites
1. Install Go 1.21.5 or later:
```bash
# Example for Linux
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
```
2. For packages requiring cgo (like SQLite):
```bash
# For Debian/Ubuntu
sudo apt install build-essential
# For macOS
xcode-select --install
# For Windows
# Install MinGW or MSYS2
```
### Clone and Build
1. Clone the repository:
```bash
git clone https://github.com/refaktor/rye.git
cd rye
```
2. Build options:
- **Minimal build** (fewer modules, smaller binary):
```bash
go build -tags "b_tiny" -o bin/rye
```
- **Standard build** (most modules included):
```bash
go build -o bin/rye
# or simply
./build
```
- **Custom build** (select specific modules):
```bash
go build -tags "b_tiny,b_sqlite,b_http,b_json" -o bin/rye
```
3. Run Rye:
```bash
# Run the REPL
bin/rye
# Run a script
bin/rye script.rye
```
### Building WASM Version
Rye can run in browsers and other WASM environments:
```bash
GOOS=js GOARCH=wasm go build -tags "b_tiny" -o wasm/rye.wasm main_wasm.go
# or use the helper script
./buildwasm
# Then visit http://localhost:8085/ryeshell/
```
### Running Tests
```bash
cd tests
../bin/rye main.rye test
# Generate function reference
../bin/rye main.rye doc
```
## Getting Rye (Pre-built)
If you prefer not to build from source, you have several options:
### Binaries
Pre-compiled binaries for **Linux**, **macOS**, **Windows**, and **WASM** are available under [Releases](https://github.com/refaktor/rye/releases).
### Package Managers
- **Homebrew** (macOS/Linux):
```bash
brew install ryelang
```
### Docker Images
- **Binary image** (includes Rye and Emacs-nox):
```bash
docker run -ti ghcr.io/refaktor/rye
```
- **Development image** (build from repository):
```bash
docker build -t refaktor/rye -f .docker/Dockerfile .
docker run -ti refaktor/rye
```
## Resources
- **[ryelang.org](https://ryelang.org/)** - Official documentation, tutorials, and examples
- **[Blog](https://ryelang.org/blog/)** - Latest updates and development news
- **[Examples folder](./examples/)** - Code examples and demos
- **[Asciinema demos](https://asciinema.org/a/647708)** - Interactive terminal demos
## Extensions and Related Projects
- **[Rye-fyne](https://github.com/refaktor/rye-fyne)** - GUI toolkit binding
- **[Rye-gio](https://github.com/refaktor/rye-gio)** - Gioui toolkit binding (WIP)
- **[Rye-ebitengine](https://github.com/refaktor/rye-ebitengine)** - 2D game engine binding (WIP)
- **[ryegen](https://github.com/refaktor/ryegen)** - Binding generation toolkit (WIP)
## Editor Support
- **VS Code**: Search for "ryelang" in the Extension marketplace
- **Emacs**: Syntax highlighting available soon
## Community and Contact
- **[GitHub Discussions](https://github.com/refaktor/rye/discussions)**
- **[Reddit](https://reddit.com/r/ryelang/)**
- **[Issues](https://github.com/refaktor/rye/issues)**
- **Email**: janko.itm+rye[at]gmail.com
- **Twitter**: [@refaktor](https://twitter.com/refaktor)
", Assign "at most 3 tags" to the expected json: {"id":"8814","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"