{"id":13782968,"url":"https://github.com/wongsingfo/SimpleLisp","last_synced_at":"2025-05-11T17:30:33.554Z","repository":{"id":101554442,"uuid":"59830900","full_name":"wongsingfo/SimpleLisp","owner":"wongsingfo","description":"A dirty implement of scheme interpreter :)","archived":false,"fork":false,"pushed_at":"2016-09-15T02:19:30.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T18:18:04.790Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wongsingfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-27T11:51:57.000Z","updated_at":"2023-01-14T22:27:29.000Z","dependencies_parsed_at":"2023-06-05T15:00:22.369Z","dependency_job_id":null,"html_url":"https://github.com/wongsingfo/SimpleLisp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wongsingfo%2FSimpleLisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wongsingfo%2FSimpleLisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wongsingfo%2FSimpleLisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wongsingfo%2FSimpleLisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wongsingfo","download_url":"https://codeload.github.com/wongsingfo/SimpleLisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604379,"owners_count":21934851,"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-08-03T18:01:49.639Z","updated_at":"2025-05-11T17:30:33.255Z","avatar_url":"https://github.com/wongsingfo.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# SimpleLisp\nAn simple implement of scheme lisp :)\n\n# Todo\n\n- string type\n- garbage collection\n- lazy evaluate\n\n# Brief explanation\n\n## Compile \n\n```\ngcc control.c symbol.c number.c exception.c eval.c parser.c atom.c -Wall -O2\n```\n\n## install package\n\nThese packages must be installed in order! \nInstall `exception` first, then the `symbol` \u0026 `number`, then the `atom`, etc..\n\n```\n-- parser\n-- eval\n  -- atom\n    -- symbol\n    -- number\n      -- exception\n```\n\n# Test\n\n## lambda\n\n```\n\u003e (define x 2)\n\u003c ()\n\u003e ((lambda (f)\n           ((lambda (x)     \n                    (f 3))\n            4))\n   (lambda (y) (+ x y)))\n\u003c 5\n```\n\nThe representation of `lambda` and `environment` is shown below.\n\n```\n\u003e (define f (lambda (x y) (+ x y)))\n\u003c ()\n\u003e f\n\u003c (lambda_tag (x y) (+ x y) ...env...)\n```\n\n## cons, car, cdr\n\n```\n\u003e (define cons (lambda (x y) \n    (lambda (c)\n      (if (= c 0) x y))))\n\u003c ()\n\u003e (define car (lambda (x)\n    (x 0)))\n\u003c ()\n\u003e (define cdr (lambda (x)\n    (x 1)))\n\u003c ()\n\u003e (define x (cons 100 200))\n\u003c ()\n\u003e (cdr x)\n\u003c 200\n\u003e (car x)\n\u003c 100\n```\n\n## stream\n\n```\n(define-syntax cons-stream\n  (syntax-rules ()\n    ((cons-stream a b)\n     (cons a (lambda () b))))) \n```\n\n`cons-tream` is a primitive procedure, so the code above is not needed.\n\n```\n\u003e (define add-streams\n  (lambda (x y)\n    (cons-stream\n      (+ (stream-car x) (stream-car y))\n      (add-streams (stream-cdr x) (stream-cdr y)))))\n\u003c ()\n\u003e (define stream-car (lambda (stream) (car stream)))\n\u003c ()\n\u003e (define stream-cdr (lambda (stream) ((cdr stream))))\n\u003c ()\n\u003e (define fibs (cons-stream 0 (cons-stream 1 (add-streams (stream-cdr fibs) fibs))))\n\u003c ()\n\u003e (define stream-iter \n  (lambda (stream i)\n    (if (= i 0) \n        (stream-car stream)\n        (stream-iter (stream-cdr stream) (+ i -1)))))\n\u003c ()\n\u003e (stream-iter fibs 22)\n\u003c 17711\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwongsingfo%2FSimpleLisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwongsingfo%2FSimpleLisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwongsingfo%2FSimpleLisp/lists"}