Skip to content
Haoxi Zhan edited this page Dec 11, 2013 · 9 revisions

This page introduces instructions for :code and :exec.

codemaker

Codemaker pops an item from a specific stack and push it into the code stack. Codemaker is a high level function which is used to construct push instructions code_fromboolean, code_fromfloat, code_frominteger and code-quote, which moves an item from :exec to :code.

Stack manipulations

Instruction Explanation input output

code_append

Append the first 2 items in :code

:code

:code

code_atom

If the first item in :code is a sequence → false, otherwise true

:code

:boolean

code_car

Perform first on the first item of :code

:code

:code

code_cdr

Perform rest on the first item of :code

:code

:code

code_cons

Concatenate the second item of :code into the first one

:code

:code

code_wrap

Wrap up the first item of :code with (list )

:code

:code

code_list

List the first two items of :code

:code

:code

code_length

Get the length of the first item of :code

:code

:code

code_map

Maps the first item of :code and the first item in :exec

:code, :exec

:code

code_member

Whether the second item in :code belongs to the first item of :code or not

:code

:boolean

code_nth

Get the nth (mod the length of code) from a piece of code

:code, :integer

:code

code_nthcdr

Delete all instructions before the nth (mod the length of code)

:code, :integer

:code

code_null

Determine whether the first item in :code is an empty sequence or not

:code

:boolean

code_extract

Use code-at-a-point to return a subtree of the first item from :code

:code, :integer

:code

code_insert

Insert a piece of code into another by insert-code-at-a-point

:code, :integer

:code

code_subst

To name the first, second and third items from :code 1, 2 and 3. Replace all 3 in 1 with 2.

:code

:code

code_contains

Exam whether the second code item contains the first one as its subtree or not

:code

:boolean

code_containing

Returns the smallest subtree of the first item which contains the second item.

:code

:code

code_position

Get the position in which the second code item appears in the first one. -1 if no appearance is found.

:code

:integer

Execute codes

instruction explanation

code_do

execute the code (by pushing both it and code_popper to :exec)

code_do*

execute the code (by popping it and pushing to :exec)

code_do*range

While the counter moves from the second item of :integer to the first item of :integer by 1 (+ or -), keep executing the first item of :code

exec_do*range

similar to code_do*range but the source is from :exec

code_do*count

Execute the first item of :code for (the first item of :integer) times

exec_do*count

similar to code_do*count but the source if from :exec

code_if

If the first item in :boolean is true, run the second item of :code, otherwise run the first one

exec_if

true → run the fist one from :exec, false → run the second one

exec_when

first item from :boolean is true → pop :boolean, otherwise pop both :boolean and :exec. To understand: if true, it would be executed later at some point.