The definitive Wolfram Language and notebook experience
The original technical computing environment
All-in-one AI assistance for your Wolfram experience
We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise
Courses in computing, science, life and more
Learn, solve problems and share ideas.
News, views and insights from Wolfram
Resources for
Software DevelopersWe deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise
Wolfram SolutionsCourses in computing, science, life and more
Learn, solve problems and share ideas.
News, views and insights from Wolfram
Resources for
Software DevelopersIt's very common to want to "map" a function over multiple expressions:
In[1]:= Out[1]=Notes for Python programmers:
Map in the Wolfram Language is like map in Python, except that it can operate on arbitrary expression trees of any depth.
/@ ("slash at") is a short notation for Map:
In[2]:= Out[2]=Notes for Java programmers:
Map in the Wolfram Language works similarly to the Stream.map method in Java, except that Map can be applied to any kind of expression.
This uses a pure function:
In[3]:= Out[3]=Apply applies a function to multiple arguments:
In[1]:= Out[1]=Notes for Python programmers:
Apply in the Wolfram Language is similar to the unpacking operator * in Python.
Expressions have "levels"—corresponding to the number of indices needed to extract a part. Functions like Map can operate at specific levels.
Notes for Java programmers:
"Levels" are another name for dimensions of an array, but generalized for all symbolic expressions. Multi-dimensional operations like this are not built into Java and would normally require loops.
Notes for Python programmers:
"Levels" are like dimensions of an array, but generalized for all symbolic expressions. Python's array functions are typically set up only for one-dimensional arrays.
Map defaults to operate at level 1:
In[1]:= Out[1]=This operates only at level 2:
In[2]:= Out[2]=@@ is equivalent to Apply, operating by default at level 0:
In[1]:= Out[1]=@@@ means "apply at level 1":
In[2]:= Out[2]=@ means ordinary function application:
In[3]:= Out[3]=RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4