Skip to content

Instantly share code, notes, and snippets.

@lsparrish
Created January 10, 2010 07:58
Show Gist options
  • Save lsparrish/273370 to your computer and use it in GitHub Desktop.
Save lsparrish/273370 to your computer and use it in GitHub Desktop.
( Elements are equivalent to variables, but are contiguous. )
{{
: list ( n-a ) here swap allot ;
: setxt ( a- ) last @ d->xt ! ;
: element ( a-a ) create dup setxt 1+ ;
---reveal---
: elements ( n"- ) dup list swap for element next drop ;
}}
3 elements first second third
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment