{"id":13644486,"url":"https://github.com/nukata/lisp-in-cs","last_synced_at":"2026-01-12T15:41:44.195Z","repository":{"id":44630618,"uuid":"138453180","full_name":"nukata/lisp-in-cs","owner":"nukata","description":"A Lisp interpreter in C# 7","archived":false,"fork":false,"pushed_at":"2022-09-29T16:35:34.000Z","size":26,"stargazers_count":89,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-21T10:53:52.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/nukata.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":"2018-06-24T04:25:05.000Z","updated_at":"2025-04-21T10:34:32.000Z","dependencies_parsed_at":"2023-01-18T16:09:32.721Z","dependency_job_id":null,"html_url":"https://github.com/nukata/lisp-in-cs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nukata/lisp-in-cs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukata%2Flisp-in-cs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukata%2Flisp-in-cs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukata%2Flisp-in-cs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukata%2Flisp-in-cs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nukata","download_url":"https://codeload.github.com/nukata/lisp-in-cs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nukata%2Flisp-in-cs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28341339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-08-02T01:02:05.825Z","updated_at":"2026-01-12T15:41:44.179Z","avatar_url":"https://github.com/nukata.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"# Lisp in C# 7\n\nThis is a Lisp interpreter compatible with\n[lisp-in-dart](https://github.com/nukata/lisp-in-dart)\n~~except for numeric types:  all numbers are `double` in C#~~.\nI wrote it in C# 6 and presented it under the MIT License at\n\u003chttp://www.oki-osk.jp/esc/cs/lisp.html\u003e (broken link)\nuntil the spring of 2017 (H29).\nI slightly modified it to match C# 7 in 2018 (H30).\n\nNow in 2019 (R1),\nI implemented a mixed mode arithmetic of `int`, `double` and `BigInteger`\nin the same way as\n[little-scheme-in-cs](https://github.com/nukata/little-scheme-in-cs).\n\n\n\nThe same as lisp-in-dart, [lisp-in-go](https://github.com/nukata/lisp-in-go)\nand [lisp-in-typescript](https://github.com/nukata/lisp-in-typescript),\nthis is a Lisp-1 with tail call optimization\nand partially hygienic macros but being a subset of Common Lisp\nin a loose meaning.\nIt is easy to write a nontrivial script which runs both in this and in\nCommon Lisp (and also in Emacs Lisp).\nExamples are found in the [`examples`](examples) folder.\n\nSee [IMPLEMENTATION-NOTES.md](IMPLEMENTATION-NOTES.md) for the implementation.\n\n\n## How to run\n\nWith [Mono](https://www.mono-project.com) 6.12.0:\n\n```\n$ csc -o -r:System.Numerics.dll lisp.cs arith.cs\n....\n$ mono lisp.exe\n\u003e (+ 5 6)\n11\n\u003e (exit 0)\n$ \n```\n\nWith [.NET](https://github.com/dotnet/core) 6.0:\n\n```\n$ dotnet build -c Release\n....\n$ ./bin/Release/net6.0/lisp\n\u003e (+ 5 6)\n11\n\u003e (exit 0)\n$\n```\n\nYou can give it a file name of your Lisp script.\nIf you put a \"`-`\" after the file name, it will\nbegin an interactive session after running the file.\n\n```\n$ cat examples/fib15.l\n(defun fib (n)\n  (if (\u003c n 2)\n      1\n    (+ (fib (- n 1))\n       (fib (- n 2)))))\n(print (fib 15))\n$ mono lisp.exe examples/fib15.l -\n987\n\u003e (fib 0)\n1\n\u003e (fib 15)\n987\n\u003e (fib 16)\n1597\n\u003e (exit 0)\n$ \n```\n\n\n## Examples\n\nThere are five files ending with `.l` under the `examples` folder.\nThese run also in Emacs Lisp and Common Lisp.\n\n- [`qsort.l`](examples/qsort.l)\n  performs a quick sort.\n\n```\n$ mono lisp.exe examples/qsort.l\n(1 1 2 3 3 4 5 5 5 6 7 8 9 9 9)\n$ \n```\n\n```\n$ emacs -batch -l examples/qsort.l\n\n(1 1 2 3 3 4 5 5 5 6 7 8 9 9 9)\n$ \n```\n\n```\n$ clisp examples/qsort.l\n\n(1 1 2 3 3 4 5 5 5 6 7 8 9 9 9)\n$ \n```\n\n\n- [`fact100.l`](examples/fact100.l)\n  calculates 100!.\n\n```\n$ mono lisp.exe examples/fact100.l \n93326215443944152681699238856266700490715968264381621468592963895217599993229915\n608941463976156518286253697920827223758251185210916864000000000000000000000000\n$\n```\n\n- [`fib15.l`](examples/fib15.l)\n  calculates Fibonacci for 15.\n\n- [`eval-fib15.l`](examples/eval-fib15.l)\n  calculates Fibonacci for 15 on a meta-circular Lisp evaluator.\n\n- [`eval-eval-fib15.l`](examples/eval-eval-fib15.l)\n  calculates Fibonacci for 15 on a meta-circular Lisp evaluator \n  on a meta-circular Lisp evaluator.\n\n\n\nThere is one more example:\n\n- [`interp_in_thread.cs`](examples/interp_in_thread.cs)\n  runs a Lisp interpreter in another thread.\n  You can embed an interpreter within your application in the same way.\n\n```\n$ cd examples\n$ csc -o -t:library -r:System.Numerics.dll ../lisp.cs ../arith.cs\n....\n$ csc -r:lisp.dll interp_in_thread.cs\n...\n$ mono interp_in_thread.exe\n=\u003e (1 . 2)\nReiwa\n=\u003e Reiwa\n$ \n```\n\nThe examples of `eval-fib15.l` and `eval-eval-fib15.l` are inspired \nby \u003chttps://github.com/zick/ZickStandardLisp\u003e.\n\n\n\n## Performance\n\nThe following is a result of a benchmark test: the time to execute [`eval-eval-fib15.l`](examples/eval-eval-fib15.l).\nI used MacBook Pro (15-inch, 2016), 2.6GHz Core i7, 16GB 2133MHz LPDDR3, macOS Mojave 10.14.6.\n\n| Lisp                                                                          | Compiled/Executed on                                            | Executed in   | Executes    | Time [sec] | Rel. Speed  |\n|:------------------------------------------------------------------------------|:----------------------------------------------------------------|:--------------|:------------|-----------:|------------:| \n| GNU CLISP 2.49                                                                |                                                                 | Mach-O        | *.fas       |     4.0    | 8.0\n| GNU Emacs Lisp 26.2                                                           |                                                                 | Mach-O        | *.elc       |     6.4    | 5.0\n| [l2lisp-in-java](https://github.com/nukata/l2lisp-in-java) 1.0.0-9.4          | [AdoptOpenJDK 11.0.5+10 HotSpot](http://adoptopenjdk.net/)      | *.jar         | source file |    12.8    | 2.5\n| GNU Emacs Lisp 26.2                                                           |                                                                 | Mach-O        | source file |    16.2    | 2.0\n| [lisp-in-dart](https://github.com/nukata/lisp-in-dart) 1.0.1                  | Dart VM 2.5.2                                                   | snapshot      | source file |    20.4    | 1.6\n| [lisp-in-dart](https://github.com/nukata/lisp-in-dart) 1.0.1                  | /Dart VM 2.5.2                                                  | source file   | source file |    21.4    | 1.5\n| [lisp-in-typescript](https://github.com/nukata/lisp-in-typescript) 1.0.0-1.27 | TS 3.6.4/Node.js 12.12.0                                        | *.js (ESNEXT) | source file |    23.9    | 1.3\n| [lisp-in-typescript](https://github.com/nukata/lisp-in-typescript) 1.0.0-1.27 | TS 3.6.4/Node.js 12.12.0                                        | *.js (ES5)    | source file |    25.4    | 1.3\n| lisp-in-cs 2.0.0                                                              | .NET Core SDK 3.0.100                                           | *.dll (.NET)  | source file |    31.8    | 1.0\n| [l2lisp-in-python](https://github.com/nukata/l2lisp-in-python) (7.2)          | /PyPy 7.1.1(Python 3.6.1)                                       | source file   | source file |    37.8    | 0.8\n| [l2lisp-in-python](https://github.com/nukata/l2lisp-in-python) (7.2)          | /PyPy 7.1.1(Python 2.7.13)                                      | source file   | source file |    41.7    | 0.8\n| lisp-in-cs 2.0.0                                                              | Mono 6.4.0.198                                                  | *.exe (.NET)  | source file |    43.9    | 0.7\n| [lisp-in-go](https://github.com/nukata/lisp-in-go) 2.0.1                      | Go 1.13.3/                                                      | Mach-O        | source file |    66.6    | 0.5\n| GNU CLISP 2.49                                                                |                                                                 | Mach-O        | source file |   575.8    | 0.1\n| [l2lisp-in-python](https://github.com/nukata/l2lisp-in-python) (7.2)          | /Python 3.7.4                                                   | source file   | source file |  1116.7    | 0.0\n\nI am sorry to say that the performance of this Lisp (lisp-in-cs) is rather mediocre.\nNote that l2lisp-in-java, lisp-in-dart, lisp-in-typescript, lisp-in-cs and lisp-in-go are all written in largely the same way; l2lisp-in-python is a little old-fashioned.\nTherefore, *roughly speaking*, their speeds shown above reflect those of their respective implementation languages: Java, Dart, TypeScript, C# and Go (and Python).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnukata%2Flisp-in-cs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnukata%2Flisp-in-cs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnukata%2Flisp-in-cs/lists"}