{"id":18862650,"url":"https://github.com/zk-phi/lambda_to_lazyk","last_synced_at":"2026-02-12T01:37:15.249Z","repository":{"id":152679667,"uuid":"42470524","full_name":"zk-phi/lambda_to_lazyk","owner":"zk-phi","description":"A Lambda Calculus to Lazy K translator","archived":false,"fork":false,"pushed_at":"2016-02-27T08:33:03.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T22:32:41.574Z","etag":null,"topics":["other"],"latest_commit_sha":null,"homepage":"","language":null,"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/zk-phi.png","metadata":{"files":{"readme":"Readme.org","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":"2015-09-14T19:03:24.000Z","updated_at":"2025-06-24T09:57:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"8da5906a-8c6e-4bea-a5d9-283706e02b50","html_url":"https://github.com/zk-phi/lambda_to_lazyk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zk-phi/lambda_to_lazyk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Flambda_to_lazyk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Flambda_to_lazyk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Flambda_to_lazyk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Flambda_to_lazyk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zk-phi","download_url":"https://codeload.github.com/zk-phi/lambda_to_lazyk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Flambda_to_lazyk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29352872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"ssl_error","status_checked_at":"2026-02-12T01:00:51.346Z","response_time":97,"last_error":"SSL_read: 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":["other"],"created_at":"2024-11-08T04:35:22.807Z","updated_at":"2026-02-12T01:37:15.234Z","avatar_url":"https://github.com/zk-phi.png","language":null,"readme":"* a Lambda Calculus to Lazy K translator\n** Usage\n\nRun the translator with\n\n: swipl lambda_to_lazyk.swi\n\nand give a lambda expresssion to the ~compile~ pred.\n\n: ?- compile(x -\u003e y -\u003e y @ x).\n: S(K(S(I)))(K)\n\n** Syntax\n\n- fundamental syntax\n\n  - ~-\u003e~ :: abstraction (right associative)\n  - ~@~ :: application (left associative)\n\n- syntax sugars\n\n  - lists   :: ~[x, y, ...]~ = ~cons @ x @ (cons @ y @ ... nil)~\n  - numbers :: ~4~ = ~succ @ (succ @ (succ @ (succ @ zero)))~\n  - strings :: ~​\"abc\"​~ = ~[97, 98, 99]~\n\n** Built-in macros\n\n- data representation\n  - boolean :: ~true/0~, ~false/0~\n  - number :: ~zero/0~, ~succ/1~\n  - list :: ~nil/0~, ~cons/2~\n\n- predicates\n  - unary :: ~zerop/1~, ~nullp/1~\n  - binary :: ~ge/2~, ~gt/2~, ~eq/2~, ~neq/2~, ~le/2~, ~lt/2~\n\n- operations\n  - arithmetic :: ~add/2~, ~sub/2~, ~mult/2~, ~exp/2~, ~mod/2~, ~div/2~\n  - boolean :: ~not/1~, ~and/2~, ~or/2~, ~xor/2~\n  - list :: ~car/1~, ~cdr/1~, ~nthcdr/2~, ~nth/2~, ~map/2~, ~append/2~, ~reverse/1~\n\n- others\n  - control :: ~if/3~,\n  - higher order :: ~fix/1~, ~compose/2~\n  - utils :: ~int_to_str/1~\n\n** User-defined macros\n\nDefine macros with ~define~ pred\n\n: ?- define(twice, f -\u003e x -\u003e f @ (f @ x)).\n: true.\n\nso that you can use the definition in the expressions.\n\n: ?- compile(twice @ (x -\u003e x) @ (x -\u003e y -\u003e y @ x)).\n: S(S(K(S))(K))(I)(I)(S(K(S(I)))(K))\n\n** Examples\n*** Hello World\n\n: ?- compile(x -\u003e reverse @ \"!dlroW ,olleH\").\n\n*** Project Eulerr #001\n\n: ?- define(thirty_seven, succ @ (exp @ (mult @ 2 @ 3) @ 2)). % equals to 37 but optimized in code size\n: ?- define(limit, mult @ thirty_seven @ ((x -\u003e x @ x) @ 3)). % equals to 999\n: ?- define(solve_1, x -\u003e if @ (zerop @ (mult @ (mod @ x @ 3) @ (mod @ x @ 5))) @ x @ 0).\n: ?- define(solve, fix @ (f -\u003e x -\u003e if @ (zerop @ x) @ 0 @ (add @ (solve_1 @ x) @ (f @ (pred @ x))))).\n: ?- compile(x -\u003e int_to_str @ (solve @ limit)).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk-phi%2Flambda_to_lazyk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzk-phi%2Flambda_to_lazyk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk-phi%2Flambda_to_lazyk/lists"}