Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Julia

You're reading from   Learning Julia Build high-performance applications for scientific computing

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781785883279
Length 316 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Rahul Lakhanpal Rahul Lakhanpal
Author Profile Icon Rahul Lakhanpal
Rahul Lakhanpal
Anshul Joshi Anshul Joshi
Author Profile Icon Anshul Joshi
Anshul Joshi
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Understanding Julia's Ecosystem FREE CHAPTER 2. Programming Concepts with Julia 3. Functions in Julia 4. Understanding Types and Dispatch 5. Working with Control Flow 6. Interoperability and Metaprogramming 7. Numerical and Scientific Computation with Julia 8. Data Visualization and Graphics 9. Connecting with Databases 10. Julia’s Internals

Anonymous functions


Anonymous functions are shorthand notations for regular functions. These are the choice of code when a function has to be used only a limited number of times, hence, it may be slightly easier and quicker to have them rather than using named functions. In popular terms, they are also sometimes referred to as lambda functions.

To relate to the preceding sentence, just think of a scenario wherein you want to apply a functionality over a list of values using a map() function. Instead of writing down a full-fledged function, we can just define them in an easy way without even bothering about giving them a name!

In Julia, we define an anonymous function using the following syntax:

f -> 2f

The syntax uses -> to notify that we are defining an anonymous function here. However, it should be kept in mind that anonymous functions themselves have no use, as they don't have a name, hence cannot be called from anywhere in the code:

julia> f ->2f
(::#1) (generic function with...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime