PC Logo Wiki
Advertisement

Syntax

BUTLAST word or list

BL word or list

Explanation

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

See also BUTFIRST, FIRST, and LAST.

Examples

? BUTLAST [MARY HAD A LITTLE LAMB]

Result: [MARY HAD A LITTLE]

? BUTLAST "OSTRICH

Result: OSTRIC

? BUTLAST 3265

Result: 326

? BUTLAST [[SNAKES SLITHER][RABBITS HOP] [MICE SCURRY]]

Result:[[SNAKES SLITHER] [RABBITS HOP]]

?

The procedure below makes a plural word or list of words into singular form.

TO SINGULAR :WORD

IF EMPTY? :WORD THEN STOP
PRINT BUTLAST LAST :WORD
SINGULAR BUTLAST :WORD

END

? SINGULAR [CATS]

CAT

? SINGULAR [BOOKS TOOLS FLOWERS EYES RUNS]

RUN

EYE

FLOWER

TOOL

BOOK

?

Advertisement