[#138] Thread Problems — Reimer Behrends <behrends@...>

I have been looking at the thread implementation of Ruby for the past

21 messages 1998/12/23
[#164] Re: Thread Problems — matz@... (Yukihiro Matsumoto) 1999/01/05

Hi.

[#167] Makefiles and -lcurses — Klaus.Schilling@... 1999/01/05

Julian Fondren writes:

[#168] Re: Makefiles and -lcurses — Julian Fondren <julian@...> 1999/01/05

OpenBSD has ncurses and it's own ocurses, and I prefer the latter.

[ruby-talk:00116] RE: STDIN integer assignment

From: ozawa@...
Date: 1998-12-17 05:16:05 UTC
List: ruby-talk #116
In article <Pine.NEB.3.95.981216225135.16135C-100000@imaji.net>,
	Julian Fondren <julian@imaji.net> writes:

> in the following script, how would I be able to have the input along the
> lines of ``10 100 <ENTER>'' assign ans1 to 10 and ans2 to 100?

Use regular expressions.

-----^
input = STDIN.gets.chomp
/(\d+)\s+(\d+)/ =~ input
ans1 = $1.to_i
ans2 = $2.to_i
-----$

More obfuscating way:-p

-----^
ans1, ans2 = STDIN.gets.chomp.scan(/\d+/).collect { |x| x.to_i }
-----$

-- 
OZAWA -Crouton- Sakuro, A.I.Soft Inc.
Office: <mailto:ozawa@aisoft.co.jp>
Private: <mailto:crouton@duelists.org>
"The world is full of fascinating problems waiting to be solved." -esr

In This Thread