Skip to Content
Learn Red ? Fundamentals of Red
book

Learn Red ? Fundamentals of Red

by Ivo Balbaert
May 2018
Beginner content levelBeginner
252 pages
6h 19m
English
Packt Publishing
Content preview from Learn Red ? Fundamentals of Red

The make word

In the Using error? section in Chapter 4Code-Controlling Structures, we used probe to get more details of a specific error, and this returned an output starting with make error! [ ... ]. The error! is effectively an object that was constructed with make.

It turns out that make can be used to construct a new value for any datatype. It needs the type and, as a second argument, a specification for that type. This can be a value or a memory allocation, or another specification in the case of datatype!, native!, action!, routine!, and event!

Here are some examples:

;-- see Chapter06/objects.red:i: make integer! 5              ; == 5    ; (1)output: make string! 1000       ; == ""   ; (2)blk: make block! 20             ; == []   ; (3)

In line (1), the specification ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How I Built a Personal Board of Directors With GenAI

How I Built a Personal Board of Directors With GenAI

Vipin Gupta
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
Why AI Demands a New Breed of Leaders

Why AI Demands a New Breed of Leaders

Faisal Hoque, Thomas Davenport, Erik Nelson

Publisher Resources

ISBN: 9781789130706Supplemental Content