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

Rejoining a block – rejoin

In the Evaluation with do and reduce section in Chapter 3, Using Words, Values, and Types, we saw how reduce evaluates expressions within a block, returning that block. The rejoin word goes one step further—it not only reduces a block, but it also joins the items in the block into a string with no spaces in between them. It returns the rejoined item, but the original series is not changed. It's like form, but with evaluation. Here are some examples of this:

ser: ["Product is: " 7 * 42]rejoin ser   ;== "Product is: 294"ser          ;== ["Product is: " 7 * 42]

Because rejoin converts a block into a string, it is often used in output print statements, such as print rejoin [newline "Total Images: " count] .

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