{"id":16489939,"url":"https://github.com/crowdagger/rscheme","last_synced_at":"2025-06-12T10:07:39.290Z","repository":{"id":32508073,"uuid":"36089065","full_name":"crowdagger/rscheme","owner":"crowdagger","description":"A toy scheme interpreter written in Rust ","archived":false,"fork":false,"pushed_at":"2015-05-27T20:26:08.000Z","size":280,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T19:14:07.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdagger.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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":"2015-05-22T18:37:49.000Z","updated_at":"2015-08-06T20:16:51.000Z","dependencies_parsed_at":"2022-09-05T09:00:50.589Z","dependency_job_id":null,"html_url":"https://github.com/crowdagger/rscheme","commit_stats":null,"previous_names":["crowdagger/rscheme"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Frscheme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Frscheme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Frscheme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Frscheme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdagger","download_url":"https://codeload.github.com/crowdagger/rscheme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241316482,"owners_count":19943081,"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":[],"created_at":"2024-10-11T13:45:55.016Z","updated_at":"2025-03-01T04:25:30.048Z","avatar_url":"https://github.com/crowdagger.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rscheme\n\nA toy scheme interpreter written in Rust.\n\nDependencies\n------------\nYou'll need the Rust compiler and\nCargo. [See there](http://www.rust-lang.org/install.html).\n\nUsage\n-----\n`$ cargo run`\n\nshould build and run rscheme. Running the program just launches a\npseudo-scheme REPL, then you can enter (pseudo-)scheme code.\n\nThe file `data/init.scm` is loaded when `rscheme` is launched. If you\nrun it from another directory, it won't work as well and you'll miss\nsome features.\n\nFeatures\n--------\n\n### Numbers ###\n\nIntegers and Floats only (corresponding to `i64` and `f64`\nrespectively). \n\n`_+`, `_-`, `_*`, `_/`, `_=` are builtin; `init.scm` also provides\nwrappers `+`, `-`, `*`, `/`, `=`. This is so these functions can be\nused as first class functions (which isn't possible for primitives).\n\n### List ###\n\nBuilding a list is possible either with  `cons` or `'`.\n\n`car` and `cdr` are also available.\n\n### Lambdas ###\n\n`(lambda (args) body)`\n\nBody can only be one expression.\n\n### def ###\n\nDef is a builtin primitive allowing to map variables to values: \n\n`(def x 42)`\n\n`(def f (lambda (x) (* 2 x)))`\n\n`(f x) ; returns 84`\n\nThere is also the more standard `(define (name arg1 ... argn) expr1\n... exprn)`, but it is implemented via a macro.\n\n### Macros ###\n\nThere is support for macros. E.g., `if` is a builtin, but `cond`\nisn't. So let's implement it:\n\n```scheme\n(defmacro cond (preds)\n  `(if ,(car (car preds))\n       ,(cadr (car preds))\n       ,(if (nil? (cdr preds))\n            ()\n            `(cond ,(cdr preds)))))\n```\n\n### Let ###\n\nAnother example of macro usage is the definition of `let`, which isn't a\nprimitive but is built as a macro. So\n\n```scheme\n(let ((x 2)\n      (y 3))\n     (+ x y))\n```\n\nwill be expanded to:\n\n```scheme\n((lambda (x y) (+ x y)) 2 3)\n```\n\nVariadic arguments\n-------------------\nIt is possible to define functions taking an arbitrary number of\narguments. Syntax is a bit different than classic Scheme, though it is\nroughly the same principle:\n\n```scheme\n(define (f x1 x2 \u0026xs)\n        (println x1)\n        (println x2)\n        (println xs))\n```\n\n`(f 1 2 3 4 5)` will print `1`, `2`, and `(3 4 5)` (on different\nlines).\n\nIt's the same syntax for declaring as first parameter in lambdas:\n\n`(lambda (\u0026 args) (println args)`\n\nInput/output\n------------\nThere is one print primitive, called `_print`. The function `println`\nuses it, as can other functions do. It simply prints a string to\nstandard output.\n\nThere is not yet support of input.\n\n\nNot implemented (yet?)\n----------------------\n\n* input\n* including another file\n\nWell, it's only a toy project, to learn Rust, right ? You want some\nreal Scheme/Lisp interpreter, there's plenty to find :)\n\nLicense\n--------\nGNU General Public License, 2 or later. [See license.](LICENSE)\n\nChangeLog\n---------\nCurrent version is 1.0.0. [See ChangeLog.](ChangeLog.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Frscheme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdagger%2Frscheme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Frscheme/lists"}