{"id":24755571,"url":"https://github.com/zefirka/jisp","last_synced_at":"2026-04-29T15:03:02.424Z","repository":{"id":31966789,"uuid":"35536860","full_name":"zefirka/jisp","owner":"zefirka","description":"JavaScript written lisp interpreter","archived":false,"fork":false,"pushed_at":"2015-05-20T13:38:33.000Z","size":3221,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T12:48:00.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zefirka.github.io/jisp/repl.html","language":"JavaScript","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/zefirka.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}},"created_at":"2015-05-13T08:20:40.000Z","updated_at":"2015-05-14T14:11:59.000Z","dependencies_parsed_at":"2022-08-24T08:30:28.782Z","dependency_job_id":null,"html_url":"https://github.com/zefirka/jisp","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/zefirka%2Fjisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefirka%2Fjisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefirka%2Fjisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zefirka%2Fjisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zefirka","download_url":"https://codeload.github.com/zefirka/jisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245063704,"owners_count":20554994,"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":"2025-01-28T12:48:02.877Z","updated_at":"2026-04-29T15:02:57.387Z","avatar_url":"https://github.com/zefirka.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jisp\nLittle JavaScript Lisp Interpreter\n\n[Online REPL](https://zefirka.github.io/jisp/repl.html)\n\n\n## Run\nRepl:\n```node repl.js```\n\nFile and repl:\n```node repl.js code.jisp```\n\n\n\n## Commands\n###Math and logic\n  - `(+ 1 2 3)` - equals to 6 (1 + 2 + 3)\n  - `(- 10 1 1)` - equals to 8 (10 - 1 - 1)\n  - `(* 1 2 3)` - equals to 9 (1 * 2 * 3)\n  - `(/ 100 4 5)` - equals to 5 (100 / 4 = 25 -\u003e 25 / 5 = 5)\n  - `(\u003e 10 11)` - false (10 \u003e 11)\n  - `(\u003c 10 11)` - true (10 \u003c 11)\n  - `(or (\u003e= 10 10) (\u003c 3 2))` - true (equals to (10 \u003e= 10 || 3 \u003c 2))\n  - `(and (\u003e= 10 10) (\u003c 3 2))` - false (equals to (10 \u003e= 10 \u0026\u0026 3 \u003c 2))\n  - `(not true)` - false\n  - `(eq? 1 1)` - true (strong equality)\n  - `(= 1 1)` - true (== equality)\n  - `(eq? (1 2) (1 2))` - true (lists comparsion)\n  - `(= (1 2) (1 2))` - false (week comparsion don't take lists)\n\n###Definitions\n`(def var 100)` - defines global variable `var` with value `100`\n\n`(def xv var)` - defines global variable `xv` with value `100` dereferenced from `var` variable\n\n```lisp\n(def result ; define global variable with value of sum of local vars\n  (let (x 10 y 20) ; here x and y are local variables \n    (+ x y))) ;final result \n(log result) \n\u003e 30\n```\n\n###Functions\nDefinition of anonymous functions:\n```lisp \n;define var with name fac which is lambda-function\n(def fac\n  (lambda(n)\n    (if (\u003c= n 2)\n        2\n        (* n (fac (- n 1))))))\n```\nOr use `defun` macros:\n```lisp\n(defun inc(x) (+ x 1)) ; increment function\n(defun dec(x) (- x 1)) ; decrement function\n```\n\n####Let-bindings\n```lisp\n(defun highest-first(x y) \n  (let (  firsta (car x)\n          firstb (car y))\n    (\u003e= firsta firstb) firsta firstb))\n```\n\n###Constructions\n\n####Conditions\n#####If/then/else\n`(if cond then else)` - evaluetes `cond` and if it's not `false` (`nil`) evaluetes `then` else evaluetes `else`\n\n```lisp\n(if t \"Hoooray\" \"Never will be logd\")\n\u003e\"Hoooray\"\n\n(defun abs(x)\n  (if (\u003e= x 0)    ;cond\n      x           ;then\n      (* -1 x)))  ;else\n\n(abs 10)\n\u003e10\n(abs -10)\n\u003e10\n```\n\n#####Cond\n`cond` has 2 signatures :\n\n`(cond test value1 result1 value2 result2 ... \u0026 default )` and `(cond test1 result1 test2 result2 ... \u0026 default)` \n\n```lisp\n; cond where every condition calculates \n(defun fac(n)\n  (cond \n    (\u003c n 0) (throw \"Error: Argument is negative!\")\n    (= n 0) 1\n    (\u003c= n 2) n\n    \u0026 (* n (fac (- n 1)))))\n\n(fac -1)\nError: Argument is negative!\n\n(fac 0)\n\u003e1\n\n(fac 2)\n\u003e2\n\n(fac 4)\n\u003e24\n```\n\n```lisp\n; cond where test calculates once\n(defun test(n)\n  (cond n\n    1 \"Arg = 1\"\n    2 \"Arg = 2\"\n    \u0026 \"Arg != 1 and 2\"))\n\n(test 1)\n\u003e\"Arg = 1\"\n\n(test 10)\n\u003e\"Arg != 1 and 2\"\n```\n\n\n\n####Form sequences\n`(do form1 form2 form3 )` - repeatedly evaluetes forms and return value of last form\n\n```lisp\n(do \n  (log \"Hey!\")  \n  (log \"You!\")\n  (let (x 10 y 20)\n    (+ x y))\n)\nHey\nYou\n\u003e30\n```\n\n####Applications\n`(apply fn list)` - applies given function to the list\n\n```lisp\n(apply + (1 2 3))\n\u003e6\n(apply set (\"alpha\" \"betta\" \"gamma\"))\n\u003e#SET: \u003c( \"alpha\" \"betta\" \"gamma\" ) \u003e\n```\n\n###Data types\n\n####Lists\n  - `(list 1 2 3)` - creates list  `(1 2 3)`\n  - `(car (1 2 3)` - takes head of list `1`\n  - `(cdr (1 2 3)` - takes rest of list `(2 3)`\n  - `(cons 1 (2 3)` - concats args to list `(1 2 3)`\n  - `(length (1 2 3)` - return count of elements of list `3`\n\n###Methods\n  - `(map fn list)` - applies given function to the each list element return new list\n\n```lisp\n(defun square(x) (* x x))\n\n(map square (1 2 3 4))\n\u003e(1 4 9 16)\n```\n\n  - `(filter fn list)` - filters list by given function\n\n```lisp\n(defun odd?(x) (not (eq? 0 (mod x 2))))\n\n(filter odd? (1 2 3 4 5 6 7))\n\u003e(1 3 5 7)\n```\n\n  - `(reduce fn list)` - reduce list by given function\n\n```lisp\n(defun average(count)\n  (let (sum (reduce + (range count))) \n    (log (str \"count is \" count))\n    (/ sum count)))\n\n(average 10)\n\u003e5.5\n(average 20)\n\u003e10.5\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzefirka%2Fjisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzefirka%2Fjisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzefirka%2Fjisp/lists"}