{"id":21224467,"url":"https://github.com/eignnx/misp","last_synced_at":"2025-03-15T01:41:25.750Z","repository":{"id":103899910,"uuid":"144784553","full_name":"eignnx/misp","owner":"eignnx","description":"An M-expression-based Lisp descendant implemented on top of Python3.6 and SLY","archived":false,"fork":false,"pushed_at":"2018-11-10T03:49:26.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T17:35:45.475Z","etag":null,"topics":["lisp-interpreter","m-expression","python3","scheme-interpreter"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/eignnx.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-15T00:08:03.000Z","updated_at":"2024-09-03T13:01:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"0b8858cb-1604-4abf-9ad0-53f38d257488","html_url":"https://github.com/eignnx/misp","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/eignnx%2Fmisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eignnx%2Fmisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eignnx%2Fmisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eignnx%2Fmisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eignnx","download_url":"https://codeload.github.com/eignnx/misp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243672369,"owners_count":20328762,"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":["lisp-interpreter","m-expression","python3","scheme-interpreter"],"created_at":"2024-11-20T22:58:31.741Z","updated_at":"2025-03-15T01:41:25.730Z","avatar_url":"https://github.com/eignnx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# misp\nAn M-expression-based Lisp descendant implemented on top of Python3.6 and SLY\n\n## Code Example\nMisp supports both the Lisp-like S-expression syntax as well as what I'm calling \"M-expression syntax\":\n\n| M-expression Syntax     | S-expression Syntax     |\n| :---------------------: | :---------------------: |\n| `+[1 2 3]`              | `(+ 1 2 3)`             |\n| `Def[x 100]`            | `(Def x 100)`           |\n| `side-effects-please[]` | `(side-effects-please)` |\n\nThe following is an implementation of a function that recursively generates the n-th fibnonacci number: \n\n```mathematica\nDefn[fib[n]\n    If[Or[=[n 0] =[n 1]]\n       n\n       +[ fib[-[n 1]] fib[-[n 2]] ]\n    ]\n]\n    \nfib[20] \n```\n\nThe program returns `6765`.\n\n## Postfix Notation\n\nAn expression of the form\n\n```mathematica\nf[a b c d]\n```\n\ncan also be written in postfix form by putting the function at the end of the list and separating it from the arguments with the double-pipe (`||`) delimiter:\n\n```mathematica\n[a b c d || f]\n```\n\nAs an example, the following two expressions both return `10`:\n\n```mathematica\n+[1 2 3 4]\n[1 2 3 4 || +]\n```\n\n## Special Values\n\n* **Truthiness**\n  * `:F`\n    * A keyword representing the boolean false value\n  * `Nil`\n    * A symbol bound to the empty list\n    * Is also considered false\n  * `:T`\n    * A keyword representing the boolean true value\n    * Not uniquely \"true\" since anything that is not `:F` or `Nil` is considered true.\n\n## Built-in Functions\n\n* `+`, `-`, `*`,`/`\n  * Arithmetic operators. Each can take a variable number of arguments\n\n* `=[x y z ...]`\n  * Returns `:T` if all arguments are equal\n\n* `Head[list]`\n  * Like `car`. Returns the first element of the list argument\n\n* `Body[list]`\n  * Like `cdr`. Returns a list of all but the first elements in a list\n\n* `Fn[{x y z ...} body]`\n  * Replaces Lisp's `lambda`.\n  * Accepts a list of formal parameters, and a body.\n  * `Fn[{x} *[x x]][12]` returns `144`\n\n* `Def[symbol value]`\n  * Declares and assigns to `symbol` the value of the expression `value`\n  * `Def[x 100]` binds the symbol `x` to the number `100` in the current environment (scope)\n  * Returns the `value`\n\n* `Defn[f[x y z ...] body]`\n  * Equivalent to `Def[f Fn[{x y z ...} body]]`\n  * Returns the procedure that gets assigned to `f`\n\n* `Set![x v]`\n\n  * Sets the previously-defined symbol `x` to the value of `v`\n  * Returns `v`\n\n* `Do[e1 e2 e3 ... en]`\n\n  * Evaluates `e1`, `e2`, ... `en` in order\n\n  * Returns the value of `en`\n\n  * The following program returns `1` after setting `x` to `3` and `y` to `1`:\n\n    ```mathematica\n    Do[\n        Def[x 1]\n        Def[y x]\n        Set![x 3]\n        y\n    ]\n    ```\n\n* `Let[{x v1 y v2 ...} body]`\n\n  * Binds `x` to `v1`, `y` to `v2`, etc., then evaluates `body`\n  * The variable bindings are only valid during the execution of `body`\n  * Equivalent to the immediately invoked lambda expression: `Fn[{x y ...} body][v1 v2 ...]`\n\n* `Eval[expr]`\n\n  * Evaluates a quoted expression\n  * `Eval[{+ 1 2 3}]` and `Eval['(+ 1 2 3)]` both return `6`\n\n* `Apply[f {arg1 arg2 arg3 ...}]`\n\n  * Applies the callable function bound to `f` upon the argument list\n  * Eqivalent to `f[arg1 arg2 arg3 ...]`\n\n* `Quote[expression]` or `'expression`\n\n  * Returns `expression` , unevaluated, as an abstract syntax tree\n\n* `List[v1 v2 v3 ...]` or `{v1 v2 v3 ...}`\n\n  * Returns the abstract syntax tree representing a list which contains the specified values\n  * **Not** the same as `'(v1 v2 v3 ...)` or `Quote[(v1 v2 v3)]` since `List` evaluates each of its arguments `vi` *before* putting putting them in a quoted list\n\n* `Quasiquote[expression]` or `~expression`\n\n  * Returns `expression` with every instance of `Unquote[subexpression]` replaced with the value of `subexpression`\n  * Note: A quasiquoted expression -- in general -- evaluates to an abstract syntax tree\n\n* `Unquote[expression]` or `$expression`\n\n  * Cannot be evaluated outside of a quasiquote expression\n  * When inside of a quasiquote expression, `Unquote[expression]` will be replaced with the value `expression` evaluates to\n\n* `If[condition e1 e2]`\n\n  * Returns the value of `e1` if `condition` is \"truthy\" (neither `:F` nor `Nil`), otherwise, returns the value of `e2`\n\n* `Print[v1 v2 v3 ... vn]`\n\n  * Prints `v1`, `v2`, etc to stdout.\n  * Returns the value of `vn`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feignnx%2Fmisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feignnx%2Fmisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feignnx%2Fmisp/lists"}