Wolfram Language
{{Short description|Programming language and environment developed by Wolfram Research}}
{{multiple issues|
{{Undisclosed paid|date=March 2021}}
{{primary sources|date=March 2021}}
}}
{{Infobox programming language
| name = Wolfram Language
| logo = Wolfram Language Logo 2016.svg
| paradigm = Multi-paradigm: term-rewriting, functional, procedural, array
| year = {{Start date and age|1988}}
| latest_test_date =
| designer = Stephen Wolfram
| developer = Wolfram Research
| latest release date = {{start date and age|2025|01|23}}
| implementations = Mathematica, [https://github.com/mathics/Mathics Mathics], [https://github.com/corywalker/expreduce Expreduce], [https://web.archive.org/web/20160119224638/http://www.cs.berkeley.edu/~fateman/lisp/mma4max/ MockMMA]
| dialects =
| influenced_by = {{startflatlist}}
- APL
- C
- C++
- FORTRAN
- Lisp
- Pascal
- Prolog
- Schoonschip{{cite web |last1=Wolfram |first1=Stephen |title=Tini Veltman (1931–2021): From Assembly Language to a Nobel Prize—Stephen Wolfram Writings |url=https://writings.stephenwolfram.com/2021/01/tini-veltman-1931-2021-from-assembly-language-to-a-nobel-prize/ |website=stephenwolfram.comwritings. |access-date=22 January 2021 |language=en}}
- Simula
- Smalltalk{{cite book |first=Roman E. |last=Maeder |title=The Mathematica® Programmer |publisher=Academic Press, Inc. |year=1994 |isbn=978-1-48321-415-3 |page=6}}
- SMP{{cite web |url=https://www.wolfram.com/language/faq/ |title=Wolfram Language Q&A |publisher=Wolfram Research |access-date=2016-12-05}}{{endflatlist}}
| influenced = {{startflatlist}}
- Jupyter{{Cite news|url=https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/|title=The Scientific Paper Is Obsolete|last=Somers|first=James|work=The Atlantic|access-date=2018-04-10|language=en-US}}
- Clojure{{cite web |url=https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |website=Amazon.com |title=Clojure Bookshelf |last=Hickey |first=Rich |archive-url=https://web.archive.org/web/20171003001051/https://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH |archive-date=2017-10-03 |access-date=2020-05-06}}
- Julia
{{endflatlist}}
| operating_system = Cross-platform
| license = Proprietary
| website = {{official URL}}
| file_ext = .nb, .m, .wl
}}
The Wolfram Language ({{IPAc-en|ˈ|w|ʊ|l|f|r|əm}} {{respell|WUUL|frəm}}) is a proprietary,{{Cite web |title=Wolfram Open Code, Open Source, Open Data, Open Resources |url=http://www.wolfram.com/open-materials/ |access-date=2023-02-03 |website=www.wolfram.com |language=en}} very high-level multi-paradigm programming language{{cite web|url=https://www.wolfram.com/language/for-experts/|title=Notes for Programming Language Experts about Wolfram Language|publisher=Wolfram.com|access-date=2015-11-05}} developed by Wolfram Research. It emphasizes symbolic computation, functional programming, and rule-based programming{{cite web|url=https://blog.stephenwolfram.com/2013/02/what-should-we-call-the-language-of-mathematica/|title=What Should We Call the Language of Mathematica?—Stephen Wolfram Blog|date=2013-02-12|publisher=Blog.stephenwolfram.com|access-date=2015-11-05}} and can employ arbitrary structures and data. It is the programming language of the mathematical symbolic computation program Mathematica.{{cite web|url=https://blog.wolfram.com/2013/06/23/celebrating-mathematicas-first-quarter-century/|title=Celebrating Mathematica's First Quarter Century—Wolfram Blog|date=23 June 2013 |publisher=Blog.wolfram.com|access-date=2015-11-05}}
History
The Wolfram Language was part of the initial version of Mathematica in 1988.Wolfram (1988). Mathematica, a System for Doing Mathematics By Computer.
Symbolic aspects of the engine make it a computer algebra system. The language can perform integration, differentiation, matrix manipulations, and solve differential equations using a set of rules. Also, the initial version introduced the notebook model and the ability to embed sound and images, according to Theodore Gray's patent.{{Cite news|url=http://bit-player.org/wp-content/extras/bph-publications/Pixel-1990-01-Hayes-Mathematica.pdf|title=Thoughts on Mathematica|last=Hayes|first=Brian|date=1990-01-01|work=Pixel}}
Wolfram also added features for more complex tasks, such as 3D modeling.{{cite web|url=https://reference.wolfram.com/language/|title=Wolfram Language & System Documentation Center|publisher=Reference.wolfram.com|access-date=2015-11-05}}
A name was finally adopted for the language in 2013, as Wolfram Research decided to make a version of the language engine free for Raspberry Pi users, and they needed to come up with a name for it.{{cite web|url=https://blog.wolfram.com/2013/11/21/putting-the-wolfram-language-and-mathematica-on-every-raspberry-pi/|title=Putting the Wolfram Language (and Mathematica) on Every Raspberry Pi—Wolfram Blog|date=21 November 2013 |publisher=Blog.wolfram.com|access-date=2015-11-05}} It was included in the recommended software bundle that the Raspberry Pi Foundation provides for beginners, which caused some controversy due to the Wolfram language's proprietary nature.{{cite web|url=https://www.cnet.com/news/premium-mathematica-software-free-on-budget-raspberry-pi/|title=Premium Mathematica software free on budget Raspberry Pi - CNET|last=Sherr|first=Ian|date=2013-11-22|publisher=News.cnet.com|access-date=2015-11-05}} Plans to port the Wolfram language to the Intel Edison were announced after the board's introduction at CES 2014 but were never released.{{cite web|url=https://www.heise.de/newsticker/meldung/Intels-Edison-Pentium-System-im-Format-einer-SD-Karte-2076917.html|title=Intels Edison: Pentium-System im Format einer SD-Karte | heise online|author=Daniel AJ Sokolov|date=2014-11-22|publisher=Heise.de|access-date=2015-11-05}} In 2019, a link was added to make Wolfram libraries compatible with the Unity game engine, giving game developers access to the language's high-level functions.{{cite web|url=https://www.gamedeveloper.com/design/the-wolfram-language-will-soon-be-integrated-into-unity|title=The Wolfram Language will soon be integrated into Unity|date=2014-03-10|publisher=Gamasutra|access-date=2015-11-05}}{{cite web|url=https://community.wolfram.com/groups/-/m/t/312155|title=Is there a way to use Wolfram Language in Unity3D?|year=2017|publisher=Wolfram|access-date=11 April 2017|archive-url=https://web.archive.org/web/20170719095116/https://community.wolfram.com/groups/-/m/t/312155|url-status=deviated|archive-date=19 July 2017}}
Syntax
The Wolfram Language syntax is overall similar to the M-expression of 1960s LISP, with support for infix operators and "function-notation" function calls.
= Basics =
The Wolfram language writes basic arithmetic expressions using infix operators.
(* This is a comment. *)
4 + 3
(* = 7 *)
1 + 2 * (3 + 4)
(* = 15 *)
(* Note that Multiplication can be omitted: 1 + 2 (3 + 4) *)
(* Divisions return rational numbers: *)
6 / 4
(* = 3/2 *)
Function calls are denoted with square brackets:
Sin[Pi]
(* = 0 *)
(* This is the function to convert rationals to floating point: *)
N[3 / 2]
(* = 1.5 *)
Lists are enclosed in curly brackets:
Oddlist={1,3,5}
(* = {1,3,5} *)
= Syntactic sugar =
The language may deviate from the M-expression paradigm when an alternative, more human-friendly way of showing an expression is available:
- A number of formatting rules are used in this language, including {{code|TeXForm}} for typeset expressions and {{code|InputForm}} for language input.
- Functions can also be applied using the prefix expression {{code|@}} and the postfix expression {{code|//}}.
- Derivatives can be denoted with the apostrophe {{code|'}}.
- The infix operators themselves are considered "sugar" for the function notation system.
A {{code|FullForm}} formatter desugars the input:{{cite web |title=FullForm |url=https://reference.wolfram.com/language/ref/FullForm.html |website=Wolfram Language Documentation}}
FullForm[1+2]
(* = Plus[1, 2] *)
= Functional programming =
Currying is supported.
= Pattern matching =
Functions in the Wolfram Language are effectively a case of simple patterns for replacement:
F[x_] := x ^ 0
The {{code|1=:=}} is a "SetDelayed operator", so that the x is not immediately looked for. {{code|x_}} is syntax sugar for {{code|Pattern[x, Blank[]]}}, i.e. a "blank" for any value to replace x in the rest of the evaluation.
An iteration of bubble sort is expressed as:
sortRule := {x___,y_,z_,k___} /; y>z -> {x,z,y,k}
(* Rule[Condition[List[PatternSequence[x, BlankNullSequence[]], Pattern[y, Blank[]], Pattern[z, Blank[]], PatternSequence[k, BlankNullSequence[]]], Greater[y, z]], List[x, z, y, k]] *)
The {{code|/;}} operator is "condition", so that the rule only applies when {{code|y>z}}. The three underscores are a syntax for a {{code|BlankNullSequence[]}}, for a sequence that can be null.
A ReplaceRepeated {{code|//.}} operator can be used to apply this rule repeatedly, until no more change happens:
{ 9, 5, 3, 1, 2, 4 } //. sortRule
(* = ReplaceRepeated[{ 9, 5, 3, 1, 2, 4 }, sortRule] *)
(* = {1, 2, 3, 4, 5, 9} *)
The pattern matching system also easily gives rise to rule-based integration and derivation. The following are excerpts from the Rubi package of rules:{{cite web |title=Welcome to Rubi, the Rule-based Integrator |url=https://rulebasedintegration.org/ |website=Rule-based Integration}}
(* Reciprocal rule *)
Int[1/x_,x_Symbol] :=
Log[x];
(* Power rule *)
Int[x_^m_.,x_Symbol] :=
x^(m+1)/(m+1) /;
FreeQ[m,x] && NeQ[m,-1]
Implementations
The official and reference implementation of the Wolfram Language lies in Mathematica and associated online services. These are closed source.{{cite web |last1=McLoone |first1=J |title=Why Wolfram Tech Isn't Open Source—A Dozen Reasons—Wolfram Blog |date=2 April 2019 |url=https://blog.wolfram.com/2019/04/02/why-wolfram-tech-isnt-open-source-a-dozen-reasons/ |language=en}} Wolfram Research has, however, released a parser of the language under the open source MIT License.{{cite web |title=codeparser: Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs) |url=https://github.com/WolframResearch/codeparser |website=GitHub |publisher=Wolfram Research, Inc.}} The parser was originally developed in C++ but was rewritten in Rust in 2023. The reference book is open access.{{cite web |title=Open Materials from Wolfram: Open Code, Open Source, Open Data, Open Resources |url=https://www.wolfram.com/open-materials/ |website=www.wolfram.com |language=en}}
In the over three-decade-long existence of the Wolfram language, a number of open-source third-party implementations have also been developed. Richard Fateman's MockMMA from 1991 is of historical note, both for being the earliest reimplementation and for having received a cease-and-desist from Wolfram. Modern ones still being maintained {{as of|2020|04|lc=yes}} include Symja in Java, expreduce in Golang, and SymPy-based Mathics.{{cite web |author1=Simon |title=Is there an open source implementation of Mathematica-the-language? |url=https://mathematica.stackexchange.com/a/4456 |website=Mathematica Stack Exchange}} These implementations focus on the core language and the computer algebra system that it implies, not on the online "knowledgebase" features of Wolfram.
In 2019,{{cite web |last1=Wolfram |first1=Steven |title=Launching Today: Free Wolfram Engine for Developers—Stephen Wolfram Writings |date=21 May 2019 |url=https://writings.stephenwolfram.com/2019/05/launching-today-free-wolfram-engine-for-developers/ |language=en}} Wolfram Research released the freeware Wolfram Engine, to be used as a programming library in non-commercial software. This developer-only engine provides a command-line shell of the Mathematica evaluator (with a limited number of kernels) and requires signup and license activation over the web. The freely available Jupyter Notebook/Lab project provides a protocol (ZMQ) to connect their notebooks to various languages, this is available as an alternative to the text-only CLI interface via the [https://github.com/WolframResearch/WolframLanguageForJupyter Wolfram Kernel for Jupyter].{{cite web |title=Free Wolfram Engine for Developers |url=https://www.wolfram.com/engine/ |website=www.wolfram.com |access-date=19 January 2021 |language=en}}
Naming
The language was officially named in June 2013 and has been used as the backend of Mathematica and other Wolfram technologies for over 30 years.{{Cite web |last=Kastrenakes |first=Jacob |date=2013-11-14 |title=Wolfram announces 'most important' project: a programming language that models the world |url=https://www.theverge.com/2013/11/14/5103446/wolfram-language-announced-intelligent-knowledge-based-programming |access-date=2023-09-21 |website=The Verge |language=en-US}}{{Cite web |date=2013-11-13 |title=Something Very Big Is Coming: Our Most Important Technology Project Yet—Stephen Wolfram Writings |url=https://writings.stephenwolfram.com/2013/11/something-very-big-is-coming-our-most-important-technology-project-yet/ |access-date=2023-09-21 |website=writings.stephenwolfram.com |language=en}}
See also
{{Portal|Computer programming|Mathematics}}
References
{{Reflist|30em}}
External links
- {{official website}}
- [https://reference.wolfram.com/language/ Documentation for the Wolfram Language]
- [https://www.wolfram.com/language/elementary-introduction/2nd-ed/ An Elementary Introduction to the Wolfram Language]
{{Wolfram Research}}
{{authority control}}
Category:Array programming languages
Category:Computer algebra systems
Category:Cross-platform software
Category:Dynamically typed programming languages
Category:Finite element software
Category:High-level programming languages
Category:Multi-paradigm programming languages
Category:Programming languages created in 1988