Ruby 1.9 and unicode

M

Marcin Raczkowski

Well i tried to play a little with new unicode features.


i wanted to do something like this:

def Σ(*args)
args.inject(0){|sum,el| sum+el}
end

and use it like Σ[1,2,3,4]

BUT:

swistak@sreberko:~$ irb1.9
irb(main):001:0> # -*- encoding: utf-8 -*-
irb(main):002:0* Σ(1,2,3)
=> nil
swistak@sreberko:~$

--------------------------

swistak@sreberko:~$ irb1.9
irb(main):001:0> def Σ(*args)
SyntaxError: compile error
(irb):1: syntax error, unexpected $end
from (irb):1:in `Kernel#binding'
swistak@sreberko:~$

-------------------------
as you can see it's droping back to shell after i type unicode character in.

I'm using Debian etch. Gnome + gnome terminal.

Any ideas?
 
T

Tiziano Merzi

Marcin said:
Well i tried to play a little with new unicode features.


i wanted to do something like this:
Any ideas?

I try with netbeans and from command in windows: it works!
But not with irb.

You ca try with a script and run the script with ruby interpreter

tiziano
 
M

Marcin Raczkowski

Tiziano said:
I try with netbeans and from command in windows: it works!
But not with irb.

You ca try with a script and run the script with ruby interpreter

tiziano

Strange, anyone can confirm that behavior? mayby some compiler flags ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top