A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.wolfram.com/language/fast-introduction-for-programmers/en/pure-functions/ below:

Pure Functions | Wolfram Language Fast Introduction for Programmers

Pure Functions | Wolfram Language Fast Introduction for Programmers WOLFRAM Products

More mobile apps

Core Technologies of Wolfram Products Deployment Options From the Community Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

WolframConsulting.com

Wolfram Solutions

More Wolfram Solutions

Wolfram Solutions For Education

More Solutions for Education

Learning & Support Get Started More Learning Grow Your Skills Tech Support Company Work with Us Educational Programs for Adults Educational Programs for Youth Read Educational Resources Wolfram Initiatives Events Wolfram|Alpha Wolfram Cloud Your Account Search Navigation Menu The Wolfram Language:
Fast Introduction for Programmers
Show additional notes for:
All sections  Get Started Pure Functions Video Version

The Wolfram Language allows what it calls pure functions, indicated by ending with &
Their first argument is indicated by #

(These are also known as anonymous functions, lambda expressions, etc.)

Notes for Java programmers:

Pure functions work similarly to lambda expressions in Java, but the syntax is simpler and more consistent in the Wolfram Language.

Notes for Python programmers:

Pure functions in the Wolfram Language work similarly to lambda functions in Python. The language.wlexpr function from the Wolfram Client Library for Python can be used to define and evaluate Wolfram Language pure functions from a Python environment.

Make a pure function for adding 1:

In[1]:= Out[1]=

If a pure function is given as the head of an expression, the function is applied to the arguments:

In[2]:= Out[2]=

Here is a function of several arguments:

In[3]:= Out[3]=

This is an alternative way to specify the function:

In[4]:= Out[4]=

Notes for Java programmers:

Wolfram Language pure functions provide a much simpler syntax for including multiple parameters than Java lambda expressions.

Notes for Python programmers:

Wolfram Language pure functions can indicate parameters either with # or by giving them explicit names. Python's lambda functions always require named parameters.

Lots of built-in functions commonly use pure functions:

In[1]:= Out[1]= In[2]:= Out[2]=

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