Created
July 18, 2010 17:23
-
-
Save lsparrish/480553 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( cd -- char dict ) | |
( cdl -- cd last ) | |
( cdn -- cd new ) | |
( cdf -- cd find ) | |
( cde -- cd exec ) | |
( cdk -- cd key ) | |
vocab cd (( | |
variable cdl | |
: cdn ( "- ) 32 accept here @cdl , @tib , !cdl ] ; | |
: cdf ( c-af ) cdl repeat @ 2dup 1+ @ =if nip 2 + -1 ;then dup 0; drop again ; | |
: cde ( c- ) cdf if .word ;then drop ; | |
: cdk ( "- ) key cde ; | |
)) | |
variable c | |
: advance2 ( $c-$f ) !c repeat @+ dup 0; drop @c =if dup 1- 0 !swap -1 ;then again ; | |
: process ( $c- ) advance2 if @c cde ;then drop ; | |
: 2process ( $c- ) push dup pop process ; | |
cdn . type ; | |
: bar 10 ; | |
: baz 20 ; | |
: foo s" bar.baz" '. process2 ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment