print("Infancy is: ") ; 0..2.map(e -> print("{e} ")) print("Infancy is: ") ; 0..2.map(to_string).join(" ").print |
rand = random(25 .. 75) # rand is in [25,75[ chars = "A".."Z" + "a".."z" + "0".."9" + q(!@$%^&*) password = 1..8.map(_ -> chars[random(chars.size)]).flatten |
number = hex(hexadecimal) # hexadecimal number = to_int(octal, 8) # octal print("Gimme a number in decimal, octal, or hex: ") num = Sys::stdin.line.chomp num = num.pattern_matches( "^0x", hex(num), "^0", to_string(num, 8), "", num, ) "%d %x %o\n".printf(num, num, num) |
s.commify = integer.fixpoint(subst(, "(\d)(\d\{3})($|\.|,)", (a,b,c -> "{a},{b}{c}"))) s.commify' = s.pattern_matches( "(.*)(...)", (a,b -> a.commify' + "," + b) "", s ) |