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
: above ( aa-a ) repeat tuck @ over =if drop ;then swap @ 0; again ; | |
2 elements tp tib 1024 allot | |
: tib, tp ++ !@tp ; | |
: tz tib !tp ; tz | |
2 elements t trig | |
: findTrig !t trig repeat @ 0; dup 1+ @ @t = not 0; drop again ; | |
: doTrig findTrig dup 3 + @ swap 2 + @ with-class ; | |
: addTrig here @trig , !trig , &.word , here 1+ , 0 , 0 , [ ; |
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
: contig variable 0 , allot ; | |
: linked variable -1 , ; | |
: >contig .data ` tuck ` @ ` ! ` ++ ; | |
: <contig .data ` dup ` -- ` @ ` @ ; | |
: >linked .data ` here ` over ` @ ` , ` swap ` ! ` , ; | |
: <linked .data ` dup ` @ ` 1+ ` @ ` swap ` dup ` @ ` @ ` swap ` ! ; | |
: __> dup 1+ @ if >linked ;then >contig ; immediate |
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
( compare two strings from the beginning and return how many ) | |
( similar characters there are before the strings diverge. ) | |
: ^match ( $$-n ) 0 -rot repeat @+ push swap @+ pop =if rot 1+ -rot else 2drop ;then again ; | |
( test each word in the dictionary for similarity. if similar up ) | |
( to the current point, add to the suggestions queue. ) | |
create list here , 100 allot | |
: to_list ( n- ) list ++ list @ ! ; | |
: fr_list ( -n ) list @ @ list -- ; | |
: no_list ( - ) list dup ! ; |
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
with strings' | |
with quotes' | |
{ | |
create str0 512 allot | |
create str1 512 allot | |
: NewCompare | |
[ toLower dup getLength 1+ str0 swap copy ] dip | |
toLower dup getLength 1+ str1 swap copy | |
str0 str1 default: compare ; |
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
with quotes' | |
( compare two strings from the beginning and return how many ) | |
( similar characters there are before the strings diverge. ) | |
: ^match ( $$-n ) | |
0 -rot repeat @+ [ swap @+ ] dip =if rot 1+ -rot else 2drop ;then again ; | |
( test each word in the dictionary for similarity. if similar up ) | |
( to the current point, add to the suggestions queue. ) | |
create list here , 100 allot |
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
chain: stringBuffer' | |
{{ | |
tib variable: buffer | |
@buffer variable: pointer | |
: terminate ( - ) 0 @pointer ! ; | |
---reveal--- | |
: addToBuffer ( c- ) @pointer ! pointer ++ terminate ; | |
: getFromBuffer ( -c ) pointer -- @pointer @ terminate ; | |
: endOfBuffer ( -a ) repeat @pointer dup @ 0; 2drop pointer ++ again ; | |
: sizeOfBuffer ( -n ) @pointer @buffer - ; |
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
chain: stringBuffer' | |
{{ | |
tib variable: buffer | |
@buffer variable: pointer | |
: terminate ( - ) 0 @pointer ! ; | |
: bs? ( c-cf ) dup 8 = ; | |
: remove ( c- ) drop pointer -- @pointer @buffer <if @buffer !pointer then terminate ; | |
: add ( c- ) @pointer ! pointer ++ terminate ; | |
---reveal--- | |
: addToBuffer ( c- ) bs? if remove else add then ; |
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
#include <stdio.h> | |
char* listen(); | |
int process(); | |
int strcmp(); | |
int output(); | |
int main() { | |
char *str; | |
while (strcmp(str,"bye\n") != 0){ |
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
( dict contains link to the most recent char word created. ) | |
( m? is the interrupt detector for the lookup function. ) | |
( l? is the lookup function. returns an xt or 0. ) | |
( : starts a char definition. ) | |
( ; calls a char definition. ) | |
variable dict | |
: m? dup 0 =if nip -1 ( leave 0 on stack after interrupt ) ;then | |
2dup 1+ @ =if nip 2 + -1 ( leave xt on stack after interrupt );then ; | |
: l? dict repeat @ m? if; again ; |
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
chain: stacks' | |
{{ | |
variable this | |
: stack ( -n ) this @ ; | |
---reveal--- | |
: :| ( n- ) this ! ; | |
: |: ( "- ) create here dup :| , 100 allot ; | |
: \ ( n- ) stack ++ stack @ ! ; | |
: / ( -n ) stack @ stack -- @ ; | |
}} |