{"id":13803790,"url":"https://github.com/lsevero/abclj","last_synced_at":"2025-05-13T16:32:34.286Z","repository":{"id":56426815,"uuid":"306055984","full_name":"lsevero/abclj","owner":"lsevero","description":"Clojure to Common lisp interop","archived":false,"fork":false,"pushed_at":"2021-04-27T22:46:18.000Z","size":62,"stargazers_count":90,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T15:52:31.931Z","etag":null,"topics":["clojure","common-lisp"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsevero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-21T14:43:36.000Z","updated_at":"2025-04-01T09:30:14.000Z","dependencies_parsed_at":"2022-08-15T18:31:01.423Z","dependency_job_id":null,"html_url":"https://github.com/lsevero/abclj","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fabclj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fabclj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fabclj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fabclj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsevero","download_url":"https://codeload.github.com/lsevero/abclj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981935,"owners_count":21994362,"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":["clojure","common-lisp"],"created_at":"2024-08-04T01:00:37.913Z","updated_at":"2025-05-13T16:32:29.276Z","avatar_url":"https://github.com/lsevero.png","language":"Clojure","readme":"# Armed Bear Clojure\nDead easy Common Lisp interop\n\n[![Clojars Project](https://img.shields.io/clojars/v/abclj.svg)](https://clojars.org/abclj)\n\n## Why??\n\nThere are others of attempts to shorten the gap between clojure and common lisp like [Cloture](https://github.com/ruricolist/cloture) and [clclojure](https://github.com/joinr/clclojure).\nOnce they are complete Clojure will benefit from native binaries and excelent compilers like SBCL, however they are far from complete.\n\nThis project took a different aproach, instead of rewriting the whole Clojure langugage on CL I'm embedding ABCL in Clojure.\nSince both are implemented in Java and Clojure has an awesome java interop is easy to have full access on the ABCL Common Lisp environment.\nThis way we have complete support for both Clojure and Common Lisp.\n\nABCL is a incredible Common Lisp implementation, the source code is very clear and straightforward.\nIt provides both a compiler and a interpreter that can be used as scripting language in any java-based project, but embedding it in other lisps (like clojure) I do believe has some advantages.\n\n\n## Usage\n\n```clojure\n(require '[abclj.core :refer :all])\n\n\n;using the with-cl-\u003eclj macro to inject CL code into the interpreter\n;it is a composition of the with-cl macro to inject code and\n;the cl-\u003eclj protocol to convert the CL java class to a clj relative\n(= 120 (with-cl-\u003eclj\n                 '(defun fact (n)\n                    (reduce (function *) (loop for i from 1 to n collect i)))\n                 '(fact 5)))\n\n;you can also evaluate strings and LispObjects\n(= 3 (cl-\u003eclj (cl-evaluate \"(+ 1 2)\")))\n;the cl-cons creates a CL cons from a clj sequential\n(= 6 (cl-\u003eclj (cl-evaluate (cl-cons [(cl-symbol 'cl/+) 1 2 3 cl-nil]))))\n\n;importing CL functions to the java/clj world\n;the symbol namespaces are used to search for CL packages\n(def cl-format (getfunction 'cl/format))\n(-\u003e cl-format\n  (funcall cl-nil (cl-string \"Hi from CL, ~a\") (cl-string \"armed bear clojure\"))\n  cl-\u003eclj\n  clojure.string/upper-case\n  println) ;=\u003e HI FROM CL, ARMED BEAR CLOJURE\n\n\n;quicklisp support\n(require '[abclj.quicklisp :refer [quickload]])\n\n(quickload :trivial-http :drakma)\n(with-cl '(trivial-http:http-get \"http://lite.duckduckgo.com/lite/\"))\n(with-cl '(drakma:http-request \"http://lisp.org/\"))\n\n(defun fac2 (n)\n  (reduce (function *) (loop for i from 1 to n collect i)))\n\n(fac2 (fac2 3))\n\n(defun discriminant (a b c)\n  (- (* b b) (* 4 a c)))\n\n(discriminant 1 2 3)\n```\nAlso check the project tests and examples.\n\n## The ultimate goal\n\nThe reason I wanted to see Clojure and Common Lisp working with each other was to use CL programs/libraries on Clojure, especially Maxima and ACL2.\n~~Since ABCL already compiles and runs Maxima it should be possible but we are very far from it 🤷.~~\nI've got ABCLJ working with maxima on the project [clj-maxima](https://github.com/lsevero/clj-maxima)\n\n## License\n\nCopyright © 2020 Lucas Severo\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","funding_links":[],"categories":["Clojure","Languages"],"sub_categories":["Java"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fabclj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsevero%2Fabclj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fabclj/lists"}