Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia 1.0 Programming

You're reading from   Julia 1.0 Programming Dynamic and high-performance programming to build fast scientific applications

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher
ISBN-13 9781788999090
Length 196 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ivo Balbaert Ivo Balbaert
Author Profile Icon Ivo Balbaert
Ivo Balbaert
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Installing the Julia Platform FREE CHAPTER 2. Variables, Types, and Operations 3. Functions 4. Control Flow 5. Collection Types 6. More on Types, Methods, and Modules 7. Metaprogramming in Julia 8. I/O, Networking, and Parallel Computing 9. Running External Programs 10. The Standard Library and Packages 11. Other Books You May Enjoy

Built-in macros


Needless to say, the Julia team has put macros to good use. To get help information about a macro, enter a ? in the REPL, and type @macroname after the help> prompt. Apart from the built-in macros we encountered in the examples in the previous chapters, here are some other very useful ones (refer to the code in Chapter 7\built_in_macros.jl).

Testing

The @assert macro actually exists in the standard library. The standard version also allows you to give your own error message, which is printed after ERROR: assertion failed.

The Test library contains some useful macros to compare the numbers:

using Test 
@test 1 == 3 

This returns the following:

Test Failed at REPL[5]:1
  Expression: 1 == 3
    Evaluated: 1 == 3
ERROR: There was an error during testing.

@test with the operator tests whether the two numbers are approximately equal. @test 1 ≈ 1.1 returns Test Failed because they are not equal within the machine tolerance. However, you can give the interval as the last argument within...

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 $19.99/month. Cancel anytime
Banner background image