# Re: Symbolify (#169)

**URL:** <https://www.ruby-forum.com/t/re-symbolify-169/142903>\
**Category:** Ruby\
**Created:** [July 13, 2008, 3:01am UTC](https://www.ruby-forum.com/t/re-symbolify-169/142903 "2008-07-13T03:01:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2008, 3:01am UTC](https://www.ruby-forum.com/t/re-symbolify-169/142903/1 "2008-07-13T03:01:57Z")

</div>

Sorry, forgot that rule.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2008, 6:48am UTC](https://www.ruby-forum.com/t/re-symbolify-169/142903/2 "2008-07-13T06:48:49Z")

</div>

Excuse me…

Already the punch line is told before

—\> On 2008/07/13, at 9:56, removed\_email\_address@domain.invalid 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§  
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 Motoakira
<removed_email_address@domain.invalid>

```

=============================

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2008, 9:55pm UTC](https://www.ruby-forum.com/t/re-symbolify-169/142903/3 "2008-07-13T21:55:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 14, 2008, 2:00am UTC](https://www.ruby-forum.com/t/re-symbolify-169/142903/4 "2008-07-14T02:00:13Z")

</div>

Matthew M. san \< Thank you for your comment

On 2008/07/14, at 4:50, Matthew M. 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

```
     Shindo Motoakira
<removed_email_address@domain.invalid>

```

=============================
