{"id":27352291,"url":"https://github.com/sukovanej/mplisp","last_synced_at":"2026-07-22T21:31:53.808Z","repository":{"id":88713766,"uuid":"119308596","full_name":"sukovanej/mplisp","owner":"sukovanej","description":"Just another lisp interpreter","archived":false,"fork":false,"pushed_at":"2018-02-17T23:27:32.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T01:47:37.621Z","etag":null,"topics":["lisp","lisp-dialect","lisp-interpreter","lisp-variant","python","python-3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/sukovanej.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-28T23:43:58.000Z","updated_at":"2018-02-03T10:11:26.000Z","dependencies_parsed_at":"2023-05-01T21:00:27.880Z","dependency_job_id":null,"html_url":"https://github.com/sukovanej/mplisp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sukovanej/mplisp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sukovanej%2Fmplisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sukovanej%2Fmplisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sukovanej%2Fmplisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sukovanej%2Fmplisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sukovanej","download_url":"https://codeload.github.com/sukovanej/mplisp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sukovanej%2Fmplisp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35778450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["lisp","lisp-dialect","lisp-interpreter","lisp-variant","python","python-3"],"created_at":"2025-04-12T20:54:58.058Z","updated_at":"2026-07-22T21:31:53.784Z","avatar_url":"https://github.com/sukovanej.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MPLisp\n\n## Installation\n\n```bash\n$ git clone https://github.com/sukovanej/mplisp\n$ cd mplisp\n$ pip3 install -U .\n```\n\n## Examples\n\n### Factorial\n\n```lisp\n(def fact\n    (lambda (x)\n        (if (\u003e x 1)\n            (* x (fact (- x 1)))\n            1)))\n\n(fact 20)\n```\n\n### Lists\n\nGenerating x^2 function\n\n```lisp\n(map (lambda (x) (list x (* x x))) (range -5 5))\n```\n\nApply list values as function arguments\n\n```lisp\n(apply + (range 20))\n```\n\n## Run example code\n\n```bash\n./test/run.sh\n```\n\n## Specification\n\n### REPL\n\n```lisp\n$ mplisp-repl\nmplisp\u003e\n```\n\n### Expressions, lambda, define\n\nAn expression is evaluated if first item in a list is a special form or a function. Other items are evaluated \nin unspecified order. Symbol is evaluated to it's value in it's environment and a number is evaluated to it's\nvalue.\n\n```lisp\nmplisp\u003e 1\n-\u003e 1\nmplisp\u003e 3\n-\u003e 3\n```\n\nExpression ```(lambda (param1 param2 ...) (body))``` creates a new function. \n\n```lisp\nmplisp\u003e (lambda (x) x)\n-\u003e \u003cfunction create_lambda.\u003clocals\u003e.func at 0x10be461e0\u003e\n```\n\nNew symbol in an environment can be defined using a special form ```def```. As every list must be evaluated to\na value, applied ```def``` is evaluated to None.\n\n```lisp\nmplisp\u003e (def a 3)\n-\u003e None\nmplisp\u003e a\n-\u003e 3\n```\n\nEvery symbol can be defined only once.\n\n\n```lisp\nmplisp\u003e (def a 3)\n-\u003e None\nmplisp\u003e (def a 4)\n-\u003e [ error : a already defined ]\n```\n\nKnowing ```lambda``` and ```def``` forms, one can easily create a function in local environment as follow.\n\n\n```lisp\nmplisp\u003e (def double (lambda (x) (* 2 x)))\n-\u003e None\nprompt\u003e double\n-\u003e \u003cfunction create_lambda.\u003clocals\u003e.func at 0x10be46268\u003e\nprompt\u003e (double 3)\n-\u003e 6\n```\n\n```*``` is a builtin function, it simply multiplies all arguments and returns the result. There similar\nfunctions for basic arithmetic:\n\n- ```+``` plus operator\n- ```-``` minus operator\n- ```*``` multiply\n- ```/``` divide\n- ```%``` modulo\n\n### Boolean\n\nAn expression can be evaluated to *bool*. `False`, `#f` and `0` are\nevaluated to *false* and every other value is evaluated to *true*.\n\n```lisp\nmplisp\u003e #t\n-\u003e True\nmplisp\u003e #f\n-\u003e False\n```\n\nAn expression can be converted to *bool* using ```-\u003ebool?``` function.\n\n```lisp\nmplisp\u003e (-\u003ebool? 3)\n-\u003e True\nmplisp\u003e (-\u003ebool? 0)\n-\u003e False\n```\n\nType can be checked using ```bool?``` function.\n\n```lip\nmplisp\u003e (bool? 0)\n-\u003e False\nmplisp\u003e (bool? #t)\n-\u003e True\nmplisp\u003e (bool? 1)\n-\u003e False\nmplisp\u003e (bool? #f)\n-\u003e True\nmplisp\u003e (bool? (-\u003ebool? 1))\n-\u003e True\n```\n\nBinary logical operators:\n\n - ```(and? a b)``` returns *a and b*\n - ```(or? a b)``` returns *a or b*\n - ```(== a b)``` returns *a equals b*\n - ```(!= a b)``` returns *a doesnt equal b*\n - ```(\u003e a b)``` returns *a is greater than b*\n - ```(\u003c a b)``` returns *a is smaller than b*\n \nUnary logical operators:\n\n - ```(not? a)``` returns *a is ```#f```*\n\n### Control statement\n\n```if``` form evaluates an expression depending on the condition. General form is\n\n```lisp\n(if condition expr1 expr2)\n```\n\nIf the condition is evaluated to *true*, `expr1` is evaluated, otherwise `expr2` is.\nSimple example is `max` function.\n\n```lisp\nmplisp\u003e (def max (lambda (a b) (if (\u003e a b) a b)))\n-\u003e None\nmplisp\u003e (max 1 2)\n-\u003e 2\nmplisp\u003e (max 2 1)\n-\u003e 2\n```\n\n\n### Strings\n\nString are recognized by apostrophe (`'` or `\"`). For example\n\n```lisp\nmplisp\u003e \"hello world\"\n-\u003e hello world\nmplisp\u003e 'hello world'\n-\u003e hello world\nmplisp\u003e hello world\n[ error : hello not found ]\n```\n\n\n### Testing the code\n\nLets assume sample code below (file **sample.mplisp**).\n\n```lisp\n; Check whether the {value} is in the {list}\n; Usage: (list-in {list} {value})\n(def list-in\n    (lambda (l val)\n        (apply or? (map (lambda (x) (== val x)) l))))\n```\n\nOne can easily run unittests using builtin function `assert!` and `assert-equal!`.\nLets and tests to the file.\n\n```lisp\n; TESTS\n(assert! (list-in (list 1 2) 1))\n(assert! (list-in (list 1 2) 2))\n(assert! (not? (list-in (list 1 2) 3)))\n; /TESTS\n```\n\nBy this bash script sample is run without the tests\n\n```bash\nmplisp sample.mplisp\n```\n\nand with `--test` or `-t` flag one can enforce the interpreter\nto run also all the tests.\n\n```bash\nmplisp -t sample.mplisp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsukovanej%2Fmplisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsukovanej%2Fmplisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsukovanej%2Fmplisp/lists"}