BUTFIRST (BF)

Syntax

BUTFIRST word or list

BF word or list

Explanation

BUTFIRST outputs all but the first element of its input. If its input is a list of words, BUTFIRST outputs a list of words containing all but the first word. If its input is a word or number, BUTFIRST outputs all the characters of the word or number except the first character.

See also BUTLAST, FIRST, and LAST.

Examples

? BUTFIRST [MARY HAD A LITTLE LAMB]

Result: [HAD A LITTLE LAMB]

? BUTFIRST "WHEAT

Result: HEAT

? BUTFIRST [WHEAT]

Result: []

? BUTFIRST 2135

Result: 135

? BUTFIRST JANUARY FEBRUARY][MARCH APRIL] [MAY JUNE

Result: MARCH APRIL] [MAY JUNE

?

The following procedure removes one element at a time from a word or a list.

TO SHRINKWORD :WORD

IF EMPTY? :WORD THEN STOP

PR :WORD

SHRINKWORD BUTFIRST :WORD

END

? SHRINKWORD "WHEAT

WHEAT

HEAT

EAT

AT

T

?