SHINDO Motoaki
7/13/2008 4:44:00 AM
Excuse me=85
Already the punch line is told before
---> On 2008/07/13, at 9:56, ruby@alef1.org wrote:
so, my source code, putting here(below) is no spoiling?
With the source, I'm in troubled of Syntax Errors.
the code is of C-language-thinking of mine,
and casting problems about=85
Char|Symbol, String, Array or REGEXP-escape,
and Scope of variables
It maybe another Quiz=85
-----source follows-----
#!/usr/bin/env ruby -Ku
#Oh, by the way... You may only use the characters `?`, `*`, `(`, `)` =20=
and `-`.
#s
#Specifically, define a function `symbolify` that accepts an integer
#and returns a string composed of only the five characters shown above.
#The string, when evaluated, will equal the original number passed in.
def init
str =3D ':?:*:(:):-'
5.times { |i|
letters[i] =3D str[i]
}
end #init
def symb1(i)
s =3D ""
p =3D i / 5
# p =3D (i.abs) / 5
unless p < 1
symb1(p)
end
q =3D i.mod(5)
=09
s +=3D letters(q)
end
def symbolify(i)
letters =3D []
init
puts i
symb1(i)
# symb2(i)
end
puts symbolify(ARGV[1].to_i)
=3D=3D=3D end of source =3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
I've 3 bits, from time to time
Shindo Motoakira
<motoakira@mac.com>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D