Turning a series into a string – form

A series can be turned into a string using form. We saw in Chapter 3, Using Words, Values, and Types, that form turns every value into a string. In the case of a series, it removes the brackets and adds spaces between the items:

s: ["Red" "world" 13 42 4 * 8 ["a" "bee" "cee"]]form s          ;== "Red world 13 42 4 * 8 a bee cee"form/part s 15  ;== "Red world 13 42" ; limits the number of characters to take

The original series is not changed. The form word is useful in turning a bunch of data containing [ ] into text.

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.