{{ : :find ( a-af ) last repeat @ 2dup =if drop @ -1 ;; else dup 0 =if ;then then again ; : .vocab ( a- ) dup 1+ @ :find nip if shut else open then ; ---reveal--- : as-vocab ( a- ) last @ d->class ['] .vocab swap ! ;
This file contains hidden or 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
( generator ) | |
{{ | |
: xt, ( - ) 1 , @last @d->xt , ; | |
---reveal--- | |
: yield ( - ) 1 , here 5 + , xt, ` :is 9 , xt, ` :devector ; compile-only | |
}} | |
: foo ( - ) "State one" puts yield | |
"State two" puts yield | |
"State three" puts ; |
This file contains hidden or 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
# This is my first full blow coffeescript class Im working on | |
# thoughts? | |
class Request | |
constructor: -> | |
@xhrObjects = [ | |
-> new XMLHttpRequest() | |
-> new ActiveXObject("Msxml2.XMLHTTP") | |
-> new ActiveXObject("Microsoft.XMLHTTP") | |
] |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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: parable | |
{{ | |
create stack here , 10 allot | |
: push stack dup ++ @ ! ; | |
: pop stack dup @ @ swap -- ; | |
: empty? stack dup @ = ; | |
: nest compiler on here push 0 , 0 , ; | |
: unnest pop empty? not !compiler ; | |
---reveal--- | |
: [ nest ; immediate |
First, the header describing the library.
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) ( do ... until ) ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) ( Value n is taken from the stack and stored to a virtual ) ( variable. When this number is equal to the TOS at the time ) ( until is executed, the loop terminates. )