Skip to content

Instantly share code, notes, and snippets.

@b1naryth1ef
Created May 21, 2011 19:12
Show Gist options
  • Save b1naryth1ef/984802 to your computer and use it in GitHub Desktop.
Save b1naryth1ef/984802 to your computer and use it in GitHub Desktop.
Self examples
<gator>
[.load]
.source #This is a new module in 3, which is best run for people messing with the eng functions.
.eng(engine())
.sys
.math
[/]
#Function
engine(){
for flag[._self.request()]:
write.~.request():> stdout #:> is the new method of pushing elements in line.
#eng.init(engine())
._self.eng.init #both of these ways work now.
}
#Class
main[
if _SELF_ init:
"Loaded":>_SELF_.stdout
if ._self:
print ._self
]
#Method
combine(in):("Combine"):(out){
in.split(._self) #The same as in.split: split for in in in:
combine.in:
+._self #Same as + for in in in:
-" "
}
exit:>engine
exit:>%env%
<gator.exit //>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment