Handbook
Glossary
interpret-string ( TURTLE STRING COMMANDS -- turtle )
Vocabulary
L-system
Inputs
TURTLE
an
object
STRING
an
object
COMMANDS
an
object
Outputs
turtle
an
object
Definition
USING:
assocs
combinators
kernel
math.parser
sequences
;
IN:
L-system
::
interpret-string
( TURTLE STRING COMMANDS -- turtle )
STRING
empty?
not
[
[let
STRING
read-instruction
:>
( NEXT REST ) NEXT 1
head
COMMANDS
at
:>
COMMAND COMMAND
[
NEXT
length
1
=
[
TURTLE COMMAND ( turtle -- turtle )
call-effect
drop
]
[
TURTLE NEXT 2
tail
1
head*
string>number
COMMAND 1
tail*
( turtle x -- turtle )
call-effect
drop
]
if
]
when
TURTLE REST COMMANDS
interpret-string
drop
]
]
when
TURTLE
;