diff --git a/golfscript.html.markdown b/golfscript.html.markdown index 8ea985e8..f4b88a9f 100644 --- a/golfscript.html.markdown +++ b/golfscript.html.markdown @@ -242,7 +242,18 @@ I drive a stick, BTW. [] > '22222'{+}* # note that if you fold-sum a string not in an array, you'll # get the sum of the ascii values. '2' is 50, so five times that is: -250 +[250] +> ]; # this actually is a clever trick to get ascii values into an array. +[] +> "aabc" [{""+~}*] # if you fold over addition and drop it into a string: +[[97 97 98 99]] +> {[.]""^}%""+ # which can be returned to a string as such using a ""^ map. +# and an empty string join. +["aabc"] +> {32-}% # note that most mapping operations work on the ascii values as +# you would expect, for instance with the difference between A and a being +# 32, you can just subtract that from the ascii value to get: +["AABC"] > ]; ################################################################### # blocks ########################################################################