Skip to content

Instantly share code, notes, and snippets.

@hashmal
Created April 12, 2013 07:32
Show Gist options
  • Save hashmal/5370214 to your computer and use it in GitHub Desktop.
Save hashmal/5370214 to your computer and use it in GitHub Desktop.
[Shirka] Trabb Pardo-Knuth algorithm, simple layout obfuscation.
-- Trabb Pardo-Knuth algorithm, simple layout obfuscation.
(=> >>) [ -> x x <- x ] (=> <<) [ -> x ] (=> ><) [ -> x -> y <- x <- y ] (=>
puts) [ print '\n print ] (=> if) [ uncons -> iftrue uncons -> iffalse << ->
cond cond iftrue !? cond not iffalse !? ] (=> while) [ => cond => op [ cond [
op tail ] !? ] => tail tail ] (=> times) [ >< => op2 ([>> 0 >] while) [ 1 - ->
count op2 <- count ] << ] (=> each) [ => op-each length -> n (n times) [
uncons op-each ] << ] (=> list/reverse) [ "" >< ([length 0 = not] while) [ ->
src -> dest <- src uncons -> el -> src <- dest <- el cons <- src ] << ] (=>
gets) [ "" TRUE ([] while) [ getc >> '\n = not (if) [ [ cons TRUE ] [ cons
list/reverse FALSE ] ] ] ] (=> get-value) [ gets $parse length 1 = (if) [ [
uncons >< << ] [ abort ] ] ] (=> f) [ -> n n abs 0.5 ^ n 3 ^ 5 * + ]
"Please enter 11 numbers:" puts [] (11 times) [ get-value cons ] (each) [ f >>
400 > (if) [ [ << "Overflow!" puts ] [ puts ] ] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment