`

Synopsis
` list
Description

Outputs a list equal to its input but with certain substitutions.

If a member of the input list is the word , (comma) then the following member should be an instruction list that produces an output when run. That output value replaces the comma and the instruction list. This is called substitution.

If a member of the input list is the word ,@ (comma atsign) then the following member should be an instruction list that outputs a list when run. The members of that list replace the ,@ and the instruction list. This is called splicing.

A word starting with , or ,@ is treated as if the rest of the word were a one-word list. For example, ,:foo is equivalent to ,[:foo].

A word starting with ", (quote comma) is replaced with a word beginning with " followed by the result of running the substitution on what comes after the comma. If what comes after the comma is a list, only the first word in the list is used in the substitution.

A word starting with :, (colon comma) is replaced with a word beginning with : followed by the result of running the substitution on what comes after the comma. If what comes after the comma is a list, only the first word in the list is used in the substitution.

Backquotes can be nested. Substitution is only done for commas when they appear at the same depth as the backquote in which they are found. See the second and third example below.

Example
SHOW `[foo baz ,[BUTFIRST [a b c]] garply ,@[BUTFIRST [a b c]]]
[foo baz [b c] garply b c]
SHOW `[a `[b ,[1+2] ,[foo ,[1+3] d] e] f]
[a ` [b , [1+2]  , [foo 4 d] e] f]
MAKE "name1 "x
MAKE "name2 "y
SHOW `[a `[b ,:,:name1 ,",:name2 d] e]
[a ` [b , [:x]  , ["y] d] e]

SourceForge.net Logo