Created
June 18, 2011 14:11
-
-
Save lsparrish/1033126 to your computer and use it in GitHub Desktop.
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: struct' | |
| : { ( -n ) 0 ; | |
| : field ( nn"-n ) over ` : .data ` + ` ; + ; | |
| : } ( n"- ) ` : .data ` here ` swap ` allot ` constant ` ; ; | |
| : clone ( a-a ) here swap 3 + @ allot ; | |
| ;chain | |
| with struct' | |
| { | |
| 2 field .bar | |
| 1 field .baz | |
| } foo | |
| &foo 3 + @ putn | |
| here putn | |
| foo test | |
| here putn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chain: struct' : { ( -n ) 0 ; : field ( nn"-n ) over ` : .data ` + ` ; + ; : } ( n"- ) [ here swap allot constant ] curry constant &.word reclass ; : clone ( a-a ) here swap 1+ @ allot ; ;chain