Skip to content

Instantly share code, notes, and snippets.

@lsparrish
Created December 27, 2009 03:09
Show Gist options
  • Save lsparrish/264138 to your computer and use it in GitHub Desktop.
Save lsparrish/264138 to your computer and use it in GitHub Desktop.
( A macro for appending code blocks. )
{{
: prepend ( $$-$ ) here -rot 2 for dup here swap getLength dup allot copy next 0 , ;
: $space ( $-$ ) s" " prepend ;
---reveal---
: append-block 32 accept tib @ char: { =if
char: } accept tib tempString keepString literal,
` $space ` swap ` prepend then ; compile-only
: code ( "- ) ` append-block ` dup ` getLength ` eval ; compile-only
}}
: access ( n"- ) 32 accept tib code { + @ . } ;
create mylist 1 , 2 ,
0 access mylist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment