Sorry, forgot that rule.
···
Just make test pass....
According to my watch, you're about 24 hours too early.
Sorry, forgot that rule.
Just make test pass....
According to my watch, you're about 24 hours too early.
Excuse me…
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…
Char>Symbol, String, Array or REGEXP-escape,
and Scope of variables
It maybe another Quiz…
-----source follows-----
#!/usr/bin/env ruby -Ku
#Oh, by the way... You may only use the characters `?`, `*`, `(`, `)` 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 = ':?:*:(:):-'
5.times { |i|
letters[i] = str[i]
}
end #init
def symb1(i)
s = ""
p = i / 5
# p = (i.abs) / 5
unless p < 1
symb1(p)
end
q = i.mod(5)
s += letters(q)
end
def symbolify(i)
letters = []
init
puts i
symb1(i)
# symb2(i)
end
puts symbolify(ARGV[1].to_i)
=== end of source ===
=============================
I've 3 bits, from time to time
Shindo-san,
I think I understand the basic idea you were attempting to code, but
you might want to revise it; as it is written below, it doesn't quite
work.
On Jul 12, 11:43 pm, SHINDO Motoaki <motoak...@mac.com> wrote:
#!/usr/bin/env ruby -Ku
#Oh, by the way... You may only use the characters `?`, `*`, `(`, `)`
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 = ':?:*:(:):-'
5.times { |i|
letters[i] = str[i]
}
end #initdef symb1(i)
s = ""
p = i / 5
# p = (i.abs) / 5
unless p < 1
symb1(p)
end
q = i.mod(5)s \+= letters\(q\)end
def symbolify(i)
letters =
initputs i symb1\(i\)# symb2(i)
endputs symbolify(ARGV[1].to_i)
Matthew Moss san < Thank you for your comment
On 2008/07/14, at 4:50, Matthew Moss wrote:
it doesn't quite work.
Yes(no?) it's not only out of work but
also off-track to the context of the quiz,
I'm realizing.
I'd well review solutions of others and regenerate mine
(^_^;) -- smile with sweats --
=============================
I've 3 bits, from time to time