REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 4-Aug-2010 Edit History  

REBOL 3 Functions: ajoin

ajoin  block

Reduces and joins a block of values into a new string.

Arguments:

block [block!]

See also:

join   rejoin   form   reform   append  

Description

The join and rejoin functions return the same datatype as their first element, be it a string!, file!, binary!, tag!, email! or whatever. However, there are times when you just want to construct a string!, and that's the purpose of ajoin.

For example:

ajoin ["test" 123]
"test123"

It is similar to reform but does not insert spaces between values:

reform ["test" 123]
"test 123"

Note that the block is always evaluated:

time: 10:30
ajoin [time/hour "h" time/minute "m"]
"10h30m"

The ajoin function is equivalent to:

to-string reduce block

How it differs

Here are examples that show how ajoin differs from join and rejoin.

Compare:

ajoin [<test> 123]
"<test>123"

with:

rejoin [<test> 123]
<test123>

and:

join <test> 123
<test123>

Notice that the last two examples return a tag!, not a string!.


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin