{"id":20526102,"url":"https://github.com/scicloj/wolframite","last_synced_at":"2025-04-05T23:05:24.923Z","repository":{"id":39794297,"uuid":"422604958","full_name":"scicloj/wolframite","owner":"scicloj","description":"An interface between Clojure and Wolfram Language (the language of Mathematica)","archived":false,"fork":false,"pushed_at":"2025-01-25T20:12:05.000Z","size":12439,"stargazers_count":76,"open_issues_count":26,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T22:05:27.859Z","etag":null,"topics":["clojure","data-science","mathematica","wolfram-language"],"latest_commit_sha":null,"homepage":"https://scicloj.github.io/wolframite/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"chanshunli/Clojuratica12","license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scicloj.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}},"created_at":"2021-10-29T14:26:06.000Z","updated_at":"2025-03-24T07:17:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"d78c7404-bcaa-427c-ac34-fbcd56848e8c","html_url":"https://github.com/scicloj/wolframite","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/scicloj%2Fwolframite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scicloj%2Fwolframite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scicloj%2Fwolframite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scicloj%2Fwolframite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scicloj","download_url":"https://codeload.github.com/scicloj/wolframite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411226,"owners_count":20934653,"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","data-science","mathematica","wolfram-language"],"created_at":"2024-11-15T23:12:25.811Z","updated_at":"2025-04-05T23:05:24.905Z","avatar_url":"https://github.com/scicloj.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wolframite\n\n[![Clojars download](https://img.shields.io/clojars/v/org.scicloj/wolframite.svg)](https://clojars.org/org.scicloj/wolframite) [Wolframite sources](https://github.com/scicloj/wolframite/)\n\nAn interface between Clojure and the Wolfram Language (Supports [Mathematica](https://www.wolfram.com/mathematica/) and [Wolfram Engine](https://www.wolfram.com/engine/)).\n\n## Status\n\nStable\n\n## What is Wolframite? ##\n\nWolframite (formerly Clojuratica) brings together two of today's most exciting tools for high-performance, parallel computation.\n\n[Clojure](http://clojure.org) is a dynamic functional programming language with a compelling approach to concurrency and state, a strong cast of persistent immutable data structures, and a growing reputation for doing all the right things.\n[Wolfram Mathematica](https://www.wolfram.com/mathematica/) is arguably the world's most powerful integrated tool for numerical computation, symbolic mathematics, optimization, and visualization and is build on top of its own splendid functional programming language, [Wolfram Language](https://www.wolfram.com/language/).\n\nBy linking the two:\n\n* Wolframite lets you **write and evaluate Wolfram/Mathematica code in Clojure** with full **syntactic integration**. Now Clojure programs can take advantage of Wolfram's enormous range of numerical and symbolic mathematics algorithms and fast matrix algebra routines.\n* Wolframite provides the **seamless and transparent translation of native data structures** between Clojure and Wolfram. This includes high-precision numbers, matricies, N-dimensional arrays, and evaluated and unevaluated Mathematica expressions and formulae.\n* Wolframite lets you **write Wolfram as if it was Clojure** by providing Clojure functions and vars for all Wolfram symbols, including docstrings and autocompletion in your favorite IDE\n* [Tentative] Wolframite facilitates **the \"Clojurization\" of Wolfram's existing parallel-computing capabilities.** Wolfram is not designed for threads or concurrency. It has excellent support for parallel computation, but parallel evaluations are initiated from a single-threaded master kernel which blocks until all parallel evaluations return. By contrast, Wolframite includes a concurrency framework that lets multiple Clojure threads execute Wolfram expressions without blocking others. Now it is easy to run a simulation in Clojure with 1,000 independent threads asynchronously evaluating processor-intensive expressions in Wolfram. The computations will be farmed out adaptively and transparently to however many Wolfram kernels are available on any number of processor cores, either locally or across a cluster, grid, or network.\n  * Notice that you cannot run more Wolfram kernels than your license allows (see the function `(wolframite.core/kernel-info!)`) \n\nWolframite is open-source and targeted at applications in scientific computing, computational economics, finance, and other fields that rely on the combination of parallelized simulation and high-performance number-crunching. Wolframite gives the programmer access to Clojure's most cutting-edge features--easy concurrency and multithreading, immutable persistent data structures, and software transactional memory---alongside Wolfram's easy-to-use algorithms for numerics, symbolic mathematics, optimization, statistics, visualization, and image-processing.\n\nWolfram / Mathematica itself is a commercial product and requires a license. Though Wolfram Engine is [free to use in development](https://www.wolfram.com/engine/free-license/).\n\n## Documentation\n\nNo matter what is your level of experience with either Clojure or Wolfram, we have you covered!\n\nWhile this page provides a brief overview of Wolframite assuming some level of knowledge of each of the systems, we have also tutorials targeted at [scientists new to Clojure](https://scicloj.github.io/wolframite/for_scientists.index.html) \nand at [Clojure developers new to Wolfram](https://scicloj.github.io/wolframite/for_developers.index.html). However, you should try to read through this page, the [Quickstart](https://scicloj.github.io/wolframite/quickstart.html), and browse through [Understanding Wolframite](https://scicloj.github.io/wolframite/understanding_wolframite.html) before diving into the tutorials. If you have never seen Clojure before, you may want to start with a quick look at our [Clojure Primer](https://scicloj.github.io/wolframite/clojure_primer.index.html) to understand better the rest of the documentation. Remember: you don't need to learn or remember all at once.\n\n## Usage\n\n### Prerequisites:\n\n#### Clojure\n\nFirst, if you haven't already, install the [Clojure CLI toolchain](https://clojure.org/guides/getting_started) (homebrew is a great way to do this if you're on Mac or Linux, but you can just as easily use the installation scripts if you prefer).\n\n#### Wolfram Mathematica or Wolfram Engine\n\nNext, obviously, you'll need to ensure that you have Wolfram Engine or the Wolfram desktop application (formerly called Mathematica) installed and your license registered. Make sure you can run these tools on their own _before_ trying Wolframite.\n\nFirst of all, you need to initialize a connection to a Wolfram/Mathematica kernel, like this:\n\n```clojure\n(wolframite.api.v1/start!)\n```\nThis should also find and load the JLink JAR included with your installation. Watch stdout for an INFO log message (via clojure.tools.logging) like:\n\n\u003e === Adding path to classpath: /Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/SystemFiles/Links/JLink/JLink.jar ===\n\nHowever, sometimes Wolframite may fail to find the correct path automatically and needs your help. You can set the `WOLFRAM_INSTALL_PATH` environment variable or Java system property (the latter takes priority) to point to the correct location. Examples:\n\n```shell\nexport WOLFRAM_INSTALL_PATH=/opt/mathematica/13.1\nexport WOLFRAM_INSTALL_PATH=\"/Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents\"\n```\n\n### Getting started\n\nStart a [Clojure REPL](https://clojure.org/guides/repl/introduction) with Wolframite on the classpath:\n\n```shell\nclj -Sdeps '{:deps {org.scicloj/wolframite {:mvn/version \"1.0.0-SNAPSHOT\"}}}'\n```\n\nand try it out:\n\n```clojure\n(require '[wolframite.api.v1 :as wl] \n         '[wolframite.wolfram :as w :refer :all  ; Wolfram symbols as Clojure vars / fns\n           :exclude [* + - -\u003e / \u003c \u003c= = == \u003e \u003e= fn\n                     Byte Character Integer Number Short String Thread]])\n;; Initialize\n(wl/start!) ; =\u003e {:status :ok, :wolfram-version 14.1, :started? true}\n;; Use it:\n(wl/! (Dot [2 2 4] [4 5 6]))\n;=\u003e 42\n```\n\nMore examples:\n\n```clojure\n(wl/! (D (Power 'x 2) 'x)) ; derivative\n;=\u003e (* 2 x)\n(wl/! (ChemicalData \"Ethanol\" \"MolarMass\"))\n;=\u003e (Quantity 46.069M (* \"Grams\" (Power \"Moles\" -1)))\n\n;; Accessing WolframAlpha (BEWARE: must be online)\n(wl/! (WolframAlpha \"How many licks does it take to get to the center of a Tootsie Pop?\"))\n;=\u003e [(-\u003e [[\"Input\" 1] \"Plaintext\"] \"How many licks does it take to get to the Tootsie Roll\n;   center of a Tootsie Pop?\") (-\u003e [[\"Result\" 1] \"Plaintext\"] \"3481\\n(according to student\n;   researchers at the University of Cambridge)\")]\n\n(wl/! (N Pi 20)) ; numerical value with 20 digit precision\n;=\u003e 3.141592653589793238462643383279502884197169399375105820285M\n\n(wl/! (Map (w/fn [x] (Sqrt x)) [4 16]))\n;=\u003e [2 4]\n```\n\nTIP: Cursive - teach it to resolve `w/fn` as `clojure.core/fn`.\n\nNOTE: The `wolframite.wolfram` (`w`) namespace has vars for all Wolfram symbols at the time of the last release of Wolframite. Check `w/*wolfram-kernel-name*` for kernel type/version and run `(wolframite.impl.wolfram-syms.write-ns/write-ns!)`\nto generate your own wolfram ns with whatever additional symbols your Wolfram/Mathematice has, and/or with custom \"aliases\". \n\n### Clerk Integration\n\nWe primarily use [Clay](https://scicloj.github.io/clay/) as our notebook tool, but there is also experimental support for [Clerk](https://github.com/nextjournal/clerk). \n\nExample usage: (watching for changes in a folder)\n\n```\nuser\u003e (require '[wolframite.tools.clerk-helper :as ch])\nuser\u003e (ch/clerk-watch! [\"dev/notebook\"])\n```\n\n* Open `dev/notebook/quickstart.clj`, make a change and save.\n* Open `localhost:7777` in the browser\n\n### How does it work?\n\nYou compose Wolfram expressions using the convenience functions and vars from `wolframite.wolfram`. These are then turned first into a symbolic representation of themselves and later into a tree of JLink `Expr` objects and sent to a Wolfram kernel subprocess (started by `wl/start!`) for evaluation. The result is translated back from jlink.Expr into a Clojure form. This translation allows for some additional convenience logic, such as supporting `w/*` instead of `Times`.\n\n## Development\n\n### Running tests\n\nTo run tests from the command line, you need to add JLink to the classpath (only REPL supports dynamically loading jars) -\ncreate a `./symlink-jlink.jar` symlink and then run the tests:\n\n```shell\nclojure -X:run-tests\n```\n\n### Deployment\n\nBuild the jar with `clojure -T:build jar` then deploy with\n`env CLOJARS_USERNAME=\u003ctbd\u003e CLOJARS_PASSWORD=\u003cclojars-token\u003e clojure -T:build deploy`.\n\nNote: You need to log in to Clojars and generate a deployment token. You also need to be added to\nthe SciCloj group there by an admin.\n\nConsider studying Wolfram's guide [Writing Java Programs That Use the Wolfram Language](https://reference.wolfram.com/language/JLink/tutorial/WritingJavaProgramsThatUseTheWolframLanguage.html) and \n[WSTP and External Program Communication](https://reference.wolfram.com/language/tutorial/WSTPAndExternalProgramCommunicationOverview.html)\nwhen you want to dig into the JVM ↔ Wolfram communication.\n\n#### Writing documentation\n\nDocumentation is written as literal programming sources in the `notebooks` directory and turned into HTML\nunder `docs` using [Clay](https://scicloj.github.io/clay/)\nand [Quarto](https://quarto.org/).\n\nTo render a single namespace/page, require Clay and run `(clay/make! {:source-path \"\u003cpath to the file\u003e\"\"})`. Tip: You can also do this without quarto - just add `:run-quarto false` to the options.\n\nTo build the whole site, run `clojure -T:build build-site` (remembering to ensure that you have the `./symlink-jlink.jar` symlink).\n\n## Authors\n\nThe original Clojuratica, Wolframite's predecessor, was created by Garth Sheldon-Coulson, a graduate student at the Massachusetts Institute of Technology and Harvard Law School.\n\nOngoing maintenance and development over the years have been thanks to\n\n* [Steve Chan](https://github.com/chanshunli),\n* [Dan Farmer](https://github.com/dfarmer),\n* [Norman Richards](https://github.com/orb)\nand others.\n\nMost recently, Clojuratica has been transformed into *Wolframite* by\n\n* Pawel Ceranka,\n* Thomas Clark and\n* [Jakub Holý](https://holyjak.cz);\n\nand is now being maintained as part of the [SciCloj](https://github.com/scicloj) project. Wolframite is free, open-source software, but if you would like to support our work then please cite us.\n\n``` bibtex\n@software{Holý_2024},\nauthor = {Holý, Jakub and Clark, Thomas and Ceranka, Pawel and Richards, Norman and Farmer, Dan and Chan, Steve and Sheldon-Coulon, Garth},\nlicense = {Mozilla Public License},\ntitle = {{Wolframite: }},\nurl = {https://github.com/scicloj/wolframite},\nversion = {1.0.0-SNAPSHOT},\nyear = {2024}\n\n```\n## Sponsorship\nWe are grateful for the financial support of [Clojurists Together](https://www.clojuriststogether.org/), who supported this work for a quarter in 2024.\n\n## Contact\nIf you would like to contact the maintainers or otherwise seek help from the community then please drop a message into our [zulip channel](https://clojurians.zulipchat.com/#narrow/stream/313853-wolfram-clojure-bridge), the `#wolframite` channel in [Clojurians Slack](https://clojurians.net), or contact the team at [SciCloj](https://github.com/scicloj).\n\n## License\n\nDistributed under the Mozilla Public License either version 2.0 or (at\nyour option) any later version.\n\n## Legal\n\nThe product names used in this website are for identification purposes only.\nAll trademarks and registered trademarks, including \"Wolfram Mathematica,\" are the property of their respective owners.\nWolframite is not a product of Wolfram Research.\nThe software on this site is provided \"as-is,\" without any express or implied warranty.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscicloj%2Fwolframite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscicloj%2Fwolframite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscicloj%2Fwolframite/lists"}