{"id":19157648,"url":"https://github.com/shybyte/risp","last_synced_at":"2025-06-11T10:10:32.012Z","repository":{"id":57660979,"uuid":"87770783","full_name":"shybyte/risp","owner":"shybyte","description":"A rusty Lisp inspired by Clojure for usage as simple configuration language","archived":false,"fork":false,"pushed_at":"2017-05-23T05:14:13.000Z","size":54,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T19:54:08.518Z","etag":null,"topics":["clojure","configuration","lisp","programming-language","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shybyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-10T05:40:11.000Z","updated_at":"2024-11-10T18:41:07.000Z","dependencies_parsed_at":"2022-09-06T17:50:53.038Z","dependency_job_id":null,"html_url":"https://github.com/shybyte/risp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Frisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Frisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Frisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Frisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shybyte","download_url":"https://codeload.github.com/shybyte/risp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252843335,"owners_count":21812860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","configuration","lisp","programming-language","rust"],"created_at":"2024-11-09T08:41:46.851Z","updated_at":"2025-05-07T08:34:29.883Z","avatar_url":"https://github.com/shybyte.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Risp [![Build Status](https://travis-ci.org/shybyte/risp.svg?branch=master)](https://travis-ci.org/shybyte/risp) [![codecov](https://codecov.io/gh/shybyte/risp/branch/master/graph/badge.svg)](https://codecov.io/gh/shybyte/risp) [![Crate Version](https://img.shields.io/crates/v/risp.svg)](https://crates.io/crates/risp)\n\nA rusty lisp inspired by Clojure for usage as simple configuration language.\n \n## Usage in Rust\n\n```rust\n  extern crate risp;\n  \n  use risp::eval_risp_script;\n  use risp::types::RispType::Int;\n  use risp::core::create_core_environment;\n  \n  #[test]\n  fn test_minimal_example() {\n     let mut env = create_core_environment();\n     env.set(\"var\", Int(2));\n  \n     let risp_script = \"(+ 40 var)\";\n     let result = eval_risp_script(risp_script, \u0026mut env);\n  \n     assert_eq!(result, Ok(Int(42)));\n  }\n```\n\n## Risp example showing every existing language feature\n\n```clojure\n; The risp kitchen sink - yes this line is a single line comment.\n\n(def my_int 2)\n\n(def my_vector [1 my_int 3])\n\n; repeat [1 2 3] 2 times =\u003e [1 2 3 1 2 3]\n(def repeated (rep 2 1 2 3))\n\n; =\u003e [11 21]\n(def vector_sum1 (+ 1 [10 20]))\n\n; =\u003e [21 22]\n(def vector_sum2 (+ [1 2] [10 20]))\n\n; =\u003e [11 12 21 22] (it wraps!)\n(def vector_sum3 (+ [1 2] [10 10 20 20]))\n\n(comment\n  (this is not evaluated)\n  (it can have multiple lines)\n  (but must have valid risp syntax))\n\n; Define a function\n(defn double [x] (* x 2))\n\n; Function which returns a function (some call it a closure), which adds x1 to its single argument\n(defn create_adder [x1]\n  (fn [x2] (+ x1 x2)))\n\n(def add_20 (create_adder 20))\n\n; variadic function, notes is a vector of all remaining arguments after name\n(defn create_song [name \u0026 notes]\n  {:name name :notes notes})\n\n; This last expression (it's a map in this case) will be returned.\n{:yes          true\n :no           false\n :added        (+ my_int 20)\n :multiplied   (* my_int 20)\n :divided      (* 10 2)\n :substracted  (- 10 2)\n :doubled      (double 21)\n :added_20     (add_20 3)\n :vector_sum1  vector_sum1\n :vector_sum2  vector_sum2\n :vector_sum3  vector_sum3\n :repeated     repeated\n :my_vector    my_vector\n :my_map       {:key my_int}\n :my_string    \"Hello\"\n :my_do_result (do\n                 (def my_int_2 20)\n                 (+ my_int my_int_2))\n :song         (create_song \"Sweet Dreams\" 1 2 3 4)}\n```            \n\n\n## Convert evaluated Risp to Rust \n```rust\nextern crate risp;\n\nuse risp::eval_risp_script;\nuse risp::core::create_core_environment;\n\nstruct SimpleSong {\n    name: String,\n    speed: i64,\n    notes: Vec\u003ci64\u003e\n}\n\n#[test]\nfn test_convert_to_struct_example() {\n    let mut env = create_core_environment();\n\n    let risp_script = r#\"\n    {\n        :name \"Name\"\n        :speed 220\n        :notes [1 2 3]\n    }\"#;\n\n    let result = eval_risp_script(risp_script, \u0026mut env).unwrap();\n\n    let simple_song = SimpleSong {\n        name: result.get(\"name\").unwrap().unwrap(),\n        speed: result.get(\"speed\").unwrap().unwrap(),\n        notes: result.get(\"notes\").unwrap().unwrap()\n    };\n\n    assert_eq!(simple_song.name, \"Name\");\n    assert_eq!(simple_song.speed, 220);\n    assert_eq!(simple_song.notes, vec![1, 2, 3]);\n}\n\n```\n\n## Goals\n* Simple configuration language\n* Subset of Clojure, well... a kind of\n\n## Secret Real Goal\n* Usable for configuring patches in my pet project [https://github.com/shybyte/rust-midi-patcher](https://github.com/shybyte/rust-midi-patcher) \n\n## Non-Goals    \n* Performance\n* Completeness\n \n## License\n\nMIT\n\n## Copyright\n\nCopyright (c) 2017 Marco Stahl\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshybyte%2Frisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshybyte%2Frisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshybyte%2Frisp/lists"}