[#246252] How to use standard library? — Jamal Soueidan <jkhaledsoueidan@...>

Hello,

18 messages 2007/04/01
[#246253] Re: How to use standard library? — Stefano Crocco <stefano.crocco@...> 2007/04/01

Alle domenica 1 aprile 2007, Jamal Soueidan ha scritto:

[#246263] Re: How to use standard library? — "Yamal Soueidan" <jkhaledsoueidan@...> 2007/04/01

Well, where does it identify its module and not a class?

[#246267] Re: How to use standard library? — Stefano Crocco <stefano.crocco@...> 2007/04/01

Alle domenica 1 aprile 2007, Yamal Soueidan ha scritto:

[#246368] Map Or Collect Redux — "RubyTalk@..." <rubytalk@...>

Looking in the old archives of ruby-talk I found a thread in 2005

11 messages 2007/04/02

[#246378] Test::Unit Reports — aidy.lewis@...

Hi,

23 messages 2007/04/02

[#246464] Last iteration condition — "Mike" <michaelst@...>

Hi,

14 messages 2007/04/03

[#246590] Everything is a object? — Jamal Soueidan <jkhaledsoueidan@...>

Hello,

40 messages 2007/04/03
[#246598] Re: Everything is a object? — Jamal Soueidan <jkhaledsoueidan@...> 2007/04/04

Jamal Soueidan wrote:

[#246600] Re: Everything is a object? — Gary Wright <gwtmp01@...> 2007/04/04

[#246601] Re: Everything is a object? — Jamal Soueidan <jkhaledsoueidan@...> 2007/04/04

Gary Wright wrote:

[#246614] fast XML parser, other than libxml — Peter Szinek <peter@...>

Hello all,

20 messages 2007/04/04
[#246615] Re: fast XML parser, other than libxml — "Keith Fahlgren" <keith@...> 2007/04/04

On 4/3/07, Peter Szinek <peter@rubyrailways.com> wrote:

[#246626] Re: fast XML parser, other than libxml — Peter Szinek <peter@...> 2007/04/04

Keith Fahlgren wrote:

[#246629] Re: fast XML parser, other than libxml — Robert Klemme <shortcutter@...> 2007/04/04

On 04.04.2007 10:53, Peter Szinek wrote:

[#246630] Re: fast XML parser, other than libxml — Peter Szinek <peter@...> 2007/04/04

Robert Klemme wrote:

[#246669] Problem Extracting Array Values — Dustin Anderson <rubyforum@...>

Hi All,

16 messages 2007/04/04
[#246672] Re: Problem Extracting Array Values — "ChrisH" <chris.hulan@...> 2007/04/04

On Apr 4, 10:02 am, Dustin Anderson <rubyfo...@dustinanderson.com>

[#246673] Re: Problem Extracting Array Values — "Ryan Leavengood" <leavengood@...> 2007/04/04

On 4/4/07, ChrisH <chris.hulan@gmail.com> wrote:

[#246679] Re: Problem Extracting Array Values — Dustin Anderson <rubyforum@...> 2007/04/04

[#246702] nil? and non-existent objects — "François Montel" <zerohalo@...>

Why is it that the nil? method can sometimes be called on an object that

12 messages 2007/04/04

[#246830] Redefining initialize while staying -w clean — "Daniel Berger" <djberg96@...>

Hi all,

11 messages 2007/04/05

[#246929] Getting to 100 (#119) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

57 messages 2007/04/06
[#247191] Re: Getting to 100 (#119) — "Carl Porth" <badcarl@...> 2007/04/08

here is my first pass:

[#247192] Re: Getting to 100 (#119) — "Carl Porth" <badcarl@...> 2007/04/08

After going back and reading the current solutions, I like Ken Bloom's

[#247215] Re: Getting to 100 (#119) — "Marcel Ward" <wardies@...> 2007/04/09

On 08/04/07, Carl Porth <badcarl@gmail.com> wrote:

[#246946] A few beginners questions — wannaberor <amldcc@...>

Guys,

15 messages 2007/04/06

[#247059] Question to all you newbies (others welcome) — SonOfLilit <sonoflilit@...>

Hello everyone,

40 messages 2007/04/07
[#247078] Re: Question to all you newbies (others welcome) — Michael Brooks <michael.brooks@...> 2007/04/07

SonOfLilit wrote:

[#247097] Re: Question to all you newbies (others welcome) — "ChrisKaelin" <ck.stonedragon@...> 2007/04/07

I totally agree, what people say about a single-entry-point: ruby-

[#247099] Re: Question to all you newbies (others welcome) — James Britt <james.britt@...> 2007/04/07

ChrisKaelin wrote:

[#247100] Re: Question to all you newbies (others welcome) — "Jeff" <cohen.jeff@...> 2007/04/07

On Apr 7, 4:30 pm, James Britt <james.br...@gmail.com> wrote:

[#247131] Minimum ruby installation. — "bino_oetomo" <bino@...> 2007/04/08

Dear Experts.

[#247151] Re: Minimum ruby installation. — Alex Young <alex@...> 2007/04/08

bino_oetomo wrote:

[#247062] rb_yield(), break, and C extensions — "Noah Easterly" <noah.easterly@...>

So, I'm working on a C extension.

11 messages 2007/04/07

[#247088] Trying to GET google with socket....problem — Hey You <r3madi@...>

Well I don't know why the socket can't connect to Google. Here is my

17 messages 2007/04/07

[#247155] code blocks and methods — andy <eps@...>

Hi,

13 messages 2007/04/08

[#247299] Infinate Loop - Please Advise — "Merrie" <merries@...>

This program produces an infinate loop. I am learning from Learn to =

13 messages 2007/04/09

[#247338] How to Write a Spelling Corrector — Brian Adkins <lojicdotcomNOSPAM@...>

Peter Norvig wrote a simple spelling corrector in 20 lines of Python 2.5,

12 messages 2007/04/10

[#247391] Slow ruby regexes — Emmanuel <emmanuel@...>

Hello i've been reading this article, wich has a few benchmarks

47 messages 2007/04/10
[#247402] Re: Slow ruby regexes — SonOfLilit <sonoflilit@...> 2007/04/10

Read wikipedia on Regex. It explains better than I can why one is used

[#247403] Re: Slow ruby regexes — MenTaLguY <mental@...> 2007/04/10

On Wed, 11 Apr 2007 02:59:29 +0900, SonOfLilit <sonoflilit@gmail.com> wrote:

[#247409] Re: Slow ruby regexes — "Robert Dober" <robert.dober@...> 2007/04/10

On 4/10/07, MenTaLguY <mental@rydia.net> wrote:

[#247410] Re: Slow ruby regexes — MenTaLguY <mental@...> 2007/04/10

On Wed, 11 Apr 2007 03:56:28 +0900, "Robert Dober" <robert.dober@gmail.com> wrote:

[#247455] Re: Slow ruby regexes — "Robert Dober" <robert.dober@...> 2007/04/11

On 4/10/07, MenTaLguY <mental@rydia.net> wrote:

[#247456] Re: Slow ruby regexes — "Robert Dober" <robert.dober@...> 2007/04/11

oops wrong button here :(

[#247499] Re: Slow ruby regexes — MenTaLguY <mental@...> 2007/04/11

On Wed, 11 Apr 2007 16:53:26 +0900, "Robert Dober" <robert.dober@gmail.com> wrote:

[#247518] Re: Slow ruby regexes — "Robert Dober" <robert.dober@...> 2007/04/11

On 4/11/07, MenTaLguY <mental@rydia.net> wrote:

[#247541] Re: Slow ruby regexes — MenTaLguY <mental@...> 2007/04/11

On Thu, 12 Apr 2007 03:27:04 +0900, "Robert Dober" <robert.dober@gmail.com> wrote:

[#247608] Re: Slow ruby regexes — Robert Klemme <shortcutter@...> 2007/04/12

On 11.04.2007 22:51, MenTaLguY wrote:

[#247683] Re: Slow ruby regexes — MenTaLguY <mental@...> 2007/04/12

On Thu, 12 Apr 2007 16:10:06 +0900, Robert Klemme <shortcutter@googlemail.com> wrote:

[#247770] Re: Slow ruby regexes — Robert Klemme <shortcutter@...> 2007/04/13

On 12.04.2007 18:31, MenTaLguY wrote:

[#247398] ClothRed (HTML to Textile) — Phillip Gawlowski <cmdjackryan@...>

I'm pleased to announce, that I've begun working on a small library to

16 messages 2007/04/10
[#247526] Re: [ANN] ClothRed (HTML to Textile) — "Victor \"Zverok\" Shepelev" <vshepelev@...> 2007/04/11

From: Phillip Gawlowski [mailto:cmdjackryan@googlemail.com]

[#247436] NameError: uninitialized constant Date::ABBR_MONTHS — Jigar Gosar <jigar.gosar@...>

DATE::ABBR_MONTHS exists in this doc here.

13 messages 2007/04/11

[#247471] How come this doesn't work? — Hey You <r3madi@...>

require 'socket'

13 messages 2007/04/11

[#247622] What is your favourite IDE? — "ChrisKaelin" <ck.stonedragon@...>

I prefer using eclipse for it's freedom, ruby and svn plugins etc. But

95 messages 2007/04/12
[#247681] Re: What is your favourite IDE? — Todd Werth <twerth@...> 2007/04/12

ChrisKaelin wrote:

[#247980] Re: IDEs, syntactic vs. semantic highlighting, etc. — Tim X <timx@...> 2007/04/15

Chad Perrin <perrin@apotheon.com> writes:

[#247737] Re: What is your favourite IDE? — Vlad Ciubotariu <vcciubot@...> 2007/04/12

Is anyone using Activestate's Kodomo? I know activestate is a player in

[#247757] Re: What is your favourite IDE? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/04/13

Vlad Ciubotariu wrote:

[#247913] Re: What is your favourite IDE? Eclipse DLTK! — Tim X <timx@...> 2007/04/14

Todd Werth <twerth@infinitered.com> writes:

[#247636] Re: What is your favourite IDE? — "Alexey Kalmykov" <akalmykov@...>

15 messages 2007/04/12

[#247725] SNMP agent library? — "Marcus Bristav" <marcus.bristav@...>

I need to write an SNMP agent (raise traps and expose MIBs). Is there

15 messages 2007/04/12
[#247741] Re: SNMP agent library? — "Francis Cianfrocca" <garbagecat10@...> 2007/04/13

On 4/12/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

[#247790] Re: SNMP agent library? — "Marcus Bristav" <marcus.bristav@...> 2007/04/13

Hi Francis,

[#247809] Re: SNMP agent library? — "Francis Cianfrocca" <garbagecat10@...> 2007/04/13

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

[#247760] Idiom wanted (now hiring!) — Jonathan <terhorst@...>

Is there a cool way to do this without calling the function twice?:

28 messages 2007/04/13
[#247767] Re: Idiom wanted (now hiring!) — Joel VanderWerf <vjoel@...> 2007/04/13

Jonathan wrote:

[#247783] Re: Idiom wanted (now hiring!) — "Robert Dober" <robert.dober@...> 2007/04/13

On 4/13/07, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

[#247805] Magic Fingers (#120) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

14 messages 2007/04/13

[#247974] executing a system command and stopping it after a specified duration? — Robert La Ferla <robertlaferla@...>

I'd like to run a system command and then stop it after specified

9 messages 2007/04/15

[#248026] translate Perl diamond operator to Ruby — Chad Perrin <perrin@...>

Over the years, I've found the following to be an excellent way to whip

13 messages 2007/04/15

[#248151] factorial in ruby — "Trans" <transfire@...>

Is factorial defined anywhere in Ruby's core or standard library. If

21 messages 2007/04/16
[#248154] Re: factorial in ruby — "Jason Roelofs" <jameskilton@...> 2007/04/16

No and most likely not.

[#248245] Timeout errors using Net::HTTP on Windows — Toby DiPasquale <toby@...>

Hi all,

12 messages 2007/04/17

[#248255] new — "poison tooth" <fixxie.wits@...>

Im just learning ruby and im stuck the guide im using says

17 messages 2007/04/17

[#248263] how to have a default argument — "shawn bright" <nephish@...>

hello all,

11 messages 2007/04/17

[#248384] ruby scripting on microsoft active directory plus exchange — Pe, Botp <botp@...>

Hi All,

16 messages 2007/04/19
[#248445] Re: ruby scripting on microsoft active directory plus exchange — "Glen Holcomb" <damnbigman@...> 2007/04/19

I would recommend looking at Net::LDAP: gem install ruby-net-ldap

[#248463] Re: ruby scripting on microsoft active directory plus exchange — "Ball, Donald A Jr (Library)" <donald.ball@...> 2007/04/19

> I would recommend looking at Net::LDAP: gem install ruby-net-ldap

[#248516] what does this code do ? from libxml schema-test.rb ??? — "aktxyz@..." <aktxyz@...>

At the bottom of the schema-test.rb in the libxml gem, there is this

13 messages 2007/04/20
[#248522] Re: what does this code do ? from libxml schema-test.rb ??? — Reuben Grinberg <reuben.grinberg@...> 2007/04/20

aktxyz@gmail.com wrote:

[#248546] Morse Code (#121) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

32 messages 2007/04/20

[#248629] Tracking down a garbage collection problem — Wincent Colaiuta <win@...>

I'm trying to work out ways to reduce the memory use of one of my

12 messages 2007/04/21

[#248680] GameR 0.2 is out — Wim Vander Schelden <wim.vanderschelden@...>

I've released GameR, a small and simple game development framework for Ruby.

13 messages 2007/04/22

[#248744] Arrow operator with dash instead of equals (->) — Andrew Green <ndrw_grn@...>

Hi, all,

16 messages 2007/04/22
[#248747] Re: Arrow operator with dash instead of equals (->) — Timothy Hunter <TimHunter@...> 2007/04/22

Andrew Green wrote:

[#248750] Re: Arrow operator with dash instead of equals (->) — Andrew Green <ndrw_grn@...> 2007/04/23

> > Is it possible to use -> as a method name in Ruby?

[#248762] Question regarding design of the String Class — "Michael W. Ryder" <_mwryder@...>

Was there a reason the string class was implemented with str[i]

21 messages 2007/04/23
[#248774] Re: Question regarding design of the String Class — Daniel Martin <martin@...> 2007/04/23

"Michael W. Ryder" <_mwryder@worldnet.att.net> writes:

[#248777] Ruby Reports 1.0 RC1 (0.10.0) — "Gregory Brown" <gregory.t.brown@...>

== Ruby Reports 1.0, Release Candidate 1 (0.10.0) ==

13 messages 2007/04/23

[#248814] unix zcat with ruby? — music <music@...>

I have to read in many files.

14 messages 2007/04/23

[#248862] ruby and C — "smc smc" <fixxie.wits@...>

Would it be easier to learn ruby if i knew C/C+/C++ or the other way around?

14 messages 2007/04/24

[#248981] file-find 0.1.0 — Daniel Berger <djberg96@...>

Hi all,

18 messages 2007/04/24
[#248984] Re: [ANN] file-find 0.1.0 — "Leslie Viljoen" <leslieviljoen@...> 2007/04/24

On 4/24/07, Daniel Berger <djberg96@gmail.com> wrote:

[#248993] Re: [ANN] file-find 0.1.0 — "Daniel Berger" <djberg96@...> 2007/04/24

On 4/24/07, Leslie Viljoen <leslieviljoen@gmail.com> wrote:

[#249027] Using Watir and Ruby2Exe together — Jim Clark <diegoslice@...>

I've been asked to help solve a browser issue that I think Watir and

13 messages 2007/04/25

[#249034] C++ code into Ruby, I need it fast, no time for RTFM — Andrei Ursan <steelheart222@...>

[code]

41 messages 2007/04/25
[#249041] Re: C++ code into Ruby, I need it fast, no time for RTFM — John Joyce <dangerwillrobinsondanger@...> 2007/04/25

[#249043] Re: C++ code into Ruby, I need it fast, no time for RTFM — Andrei Ursan <steelheart222@...> 2007/04/25

> Translate this for me, right now. No, by yesterday. == A time when

[#249044] Re: C++ code into Ruby, I need it fast, no time for RTFM — "David Jones" <tafftoo@...> 2007/04/25

There are still ways to ask for things.

[#249060] Is it possible to make system use bash instead of sh? — Wai Tsang <simotsa@...>

Hi,

12 messages 2007/04/25

[#249076] DHH vs. WHY style — Trans <transfire@...>

Like to know others general opinions on having a comprehensive library

35 messages 2007/04/25

[#249226] 10 millisecond delay/callback — Earle Clubb <eclubb@...>

I need to perform a task every 10ms. I've been using

21 messages 2007/04/26
[#249228] Re: 10 millisecond delay/callback — khaines@... 2007/04/26

On Fri, 27 Apr 2007, Earle Clubb wrote:

[#249238] Using Ruby in a Corporate Environment — Steve Molitor <stevemolitor@...>

---------- Forwarded message ----------

10 messages 2007/04/26

[#249268] Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — "Gregory Brown" <gregory.t.brown@...>

Hi Folks,

24 messages 2007/04/27
[#249334] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — "Lyle Johnson" <lyle.johnson@...> 2007/04/27

On 4/27/07, Gregory Brown <gregory.t.brown@gmail.com> wrote:

[#249338] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — "Jamey Cribbs" <jcribbs@...> 2007/04/27

Lyle Johnson wrote:

[#249340] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — "Gregory Brown" <gregory.t.brown@...> 2007/04/27

On 4/27/07, Jamey Cribbs <jcribbs@netpromi.com> wrote:

[#249342] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — John Joyce <dangerwillrobinsondanger@...> 2007/04/27

[#249343] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — "Gregory Brown" <gregory.t.brown@...> 2007/04/27

On 4/27/07, John Joyce <dangerwillrobinsondanger@gmail.com> wrote:

[#249347] Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. — John Joyce <dangerwillrobinsondanger@...> 2007/04/27

[#249269] Output A File w/ Line Numbers? — John Joyce <dangerwillrobinsondanger@...>

I'd like to read a file and output its contents (just to terminal is

18 messages 2007/04/27
[#249414] Re: Output A File w/ Line Numbers? — "Robert Dober" <robert.dober@...> 2007/04/28

On 4/27/07, John Joyce <dangerwillrobinsondanger@gmail.com> wrote:

[#249274] string replacement... — Josselin <josselin@...>

I have a string : str = "/proposal/list/31551"

15 messages 2007/04/27

[#249315] Checking Credit Cards (#122) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

65 messages 2007/04/27

[#249430] cyclic array — Josselin <josselin@...>

I would like to print n elements from an Array in a cyclic way.

18 messages 2007/04/28

[#249524] Array.which_long? ( I coded an extension for Array ) — "Billy Hsu" <ruby.maillist@...>

Hi, I'm CFC

31 messages 2007/04/29
[#249526] Re: Array.which_long? ( I coded an extension for Array ) — "Chris Carter" <cdcarter@...> 2007/04/29

On 4/29/07, Billy Hsu <ruby.maillist@gmail.com> wrote:

[#249664] Re: Array.which_long? ( I coded an extension for Array ) — Robert Klemme <shortcutter@...> 2007/04/30

On 29.04.2007 16:11, Chris Carter wrote:

[#249667] Re: Array.which_long? ( I coded an extension for Array ) — "Robert Dober" <robert.dober@...> 2007/04/30

On 4/30/07, Robert Klemme <shortcutter@googlemail.com> wrote:

[#249670] Re: Array.which_long? ( I coded an extension for Array ) — Robert Klemme <shortcutter@...> 2007/04/30

On 30.04.2007 12:39, Robert Dober wrote:

[#249688] Re: Array.which_long? ( I coded an extension for Array ) — "Robert Dober" <robert.dober@...> 2007/04/30

On 4/30/07, Robert Klemme <shortcutter@googlemail.com> wrote:

[#249527] Re: Array.which_long? ( I coded an extension for Array ) — "David A. Black" <dblack@...> 2007/04/29

Hi --

[#249531] Re: Array.which_long? ( I coded an extension for Array ) — "Robert Dober" <robert.dober@...> 2007/04/29

On 4/29/07, David A. Black <dblack@wobblini.net> wrote:

[#249532] Re: Array.which_long? ( I coded an extension for Array ) — "David A. Black" <dblack@...> 2007/04/29

Hi --

[#249587] Class Level Variables — Cory <coryw@...>

Alright, I'm missing some core ruby concept here that I just can't

23 messages 2007/04/30
[#249589] Re: Class Level Variables — Ari Brown <ari@...> 2007/04/30

[#249603] sorting by rand? — seebs@... (Peter Seebach)

Browsing something at a bookstore recently, I saw an example of

22 messages 2007/04/30

[#249689] RoR how does scaffold work? — anansi <kazaam@...>

Hi,

17 messages 2007/04/30

[#249691] ruby and true — aidy.lewis@...

Hi,

16 messages 2007/04/30

[#249759] relocatable ruby distribution — "fkc_email-news @ yahoo dot com" <fkchang2000@...>

Hi All:

11 messages 2007/04/30

Re: [QUIZ] Getting to 100 (#119)

From: "Robert Dober" <robert.dober@...>
Date: 2007-04-09 09:35:47 UTC
List: ruby-talk #247236
On 4/9/07, Raj Sahae <rajsahae@gmail.com> wrote:
> Christian Neukirchen wrote:
> > =begin
> >
> >> The quiz, then, is to solve this problem without thinking, instead
> >> letting the computer think for you.
> >>
> >
> > I did not intent to seriously submit this solution, but it can be
> > helpful as an example of how to use Ruby to solve a problem quickly
> > without thinking too much or locating Knuth on the bookshelve.
> > Writing this code took maybe ten minutes and happened step-by-step
> > with checking the immediate results.
> >
> > Since there are only 168 solutions (254 if you allow a sign before the
> > first digit), brute-forcing is the simplest thing one can do.
> > Additional operations can be added by changing the base and mapping
> > the digits onto further operations.  (Different digit order is not
> > that easy to implement and maybe be futile to do with brute-forcing.)
> > =end
> >
> > (00000000..'22222222'.to_i(3)).map { |x| x.to_s(3).rjust(8, "0").
> >                                                    tr('012', '-+ ') }.
> >   find_all { |x| x.count("-") == 2 and x.count("+") == 1 }.
> >   map { |x|
> >     t = "1" + x.split(//).zip((2..9).to_a).join.delete(" ")
> >     [eval(t), t]
> >   }.sort.each { |s, x|
> >     puts "*****************" if s == 100
> >     puts "#{x}: #{s}"
> >     puts "*****************" if s == 100
> >   }
> >
> > __END__
> >
> > 2#787<p4>lilith:~/mess/current$ ruby quiz119.rb |grep -C4 100$
> > 123-456-7+89: -251
> > 123+45-67-89: 12
> > 123-45+67-89: 56
> > *****************
> > 123-45-67+89: 100
> > *****************
> > 12+345-67-89: 201
> > 1-234+567-89: 245
> > 1-23-456+789: 311
> >
> >
> I'm sorry to be a noob on this, but can someone please explain to me
> what this is doing.  If it works, it must be genius, and I can't figure
> it out.
>
> Raj Sahae
>
>
Actually I have no idea whatsoever, this is normally a good starting point ;)
irb is our friend of course, so let us hack away:
irb(main):003:0> (000..'222'.to_i(3)).map{|x|x.to_s(3).rjust(3,
"0").tr('012', '-+ ')}
=> ["---", "--+", "-- ", "-+-", "-++", "-+ ", "- -", "- +", "-  ",
"+--", "+-+", "+- ", "++-", "+++", "++ ", "+ -", "+ +", "+  ", " --",
" -+", " - ", " +-", " ++", " + ", "  -", "  +", "   "]

Aha the ternary array is used to create all kind of operator
combinations including " ".
I do not know exactly what this is good for right now, but I guess we
will learn.
As a next step I increase 3 to 8 as I think we can understand that now
and I will add the next method
 (00000000..'22222222'.to_i(3)).map { |x| x.to_s(3).rjust(8,
"0").tr('012', '-+ ') }.find_all { |x| x.count("-") == 2 and
x.count("+") == 1 }
=> ["--+     ", "-- +    ", "--  +   ", "--   +  ", "--    + ", "--
 +", "-+-     ", "-+ -    ", "-+  -   ", "-+   -  ", "-+    - ", "-+
  -", "- -+    ", "- - +   ", "- -  +  ", "- -   + ", "- -    +", "-
+-    ", "- + -   ", "- +  -  ", "- +   - ", "- +    -", "-  -+   ",
"-  - +  ", "-  -  + ", "-  -   +", "-  +-   ", "-  + -  ", "-  +  -
", "-  +   -", "-   -+  ", "-   - + ", "-   -  +", "-   +-  ", "-   +
- ", "-   +  -", "-    -+ ", "-    - +", "-    +- ", "-    + -", "-
 -+", "-     +-", "+--     ", "+- -    ", "+-  -   ", "+-   -  ", "+-
  - ", "+-     -", "+ --    ", "+ - -   ", "+ -  -  ", "+ -   - ", "+
-    -", "+  --   ", "+  - -  ", "+  -  - ", "+  -   -", "+   --  ",
"+   - - ", "+   -  -", "+    -- ", "+    - -", "+     --", " --+
", " -- +   ", " --  +  ", " --   + ", " --    +", " -+-    ", " -+ -
 ", " -+  -  ", " -+   - ", " -+    -", " - -+   ", " - - +  ", " - -
+ ", " - -   +", " - +-   ", " - + -  ", " - +  - ", " - +   -", " -
-+  ", " -  - + ", " -  -  +", " -  +-  ", " -  + - ", " -  +  -", " -
  -+ ", " -   - +", " -   +- ", " -   + -", " -    -+", " -    +-", "
+--    ", " +- -   ", " +-  -  ", " +-   - ", " +-    -", " + --   ",
" + - -  ", " + -  - ", " + -   -", " +  --  ", " +  - - ", " +  -
-", " +   -- ", " +   - -", " +    --", "  --+   ", "  -- +  ", "  --
+ ", "  --   +", "  -+-   ", "  -+ -  ", "  -+  - ", "  -+   -", "  -
-+  ", "  - - + ", "  - -  +", "  - +-  ", "  - + - ", "  - +  -", "
-  -+ ", "  -  - +", "  -  +- ", "  -  + -", "  -   -+", "  -   +-", "
 +--   ", "  +- -  ", "  +-  - ", "  +-   -", "  + --  ", "  + - - ",
"  + -  -", "  +  -- ", "  +  - -", "  +   --", "   --+  ", "   -- +
", "   --  +", "   -+-  ", "   -+ - ", "   -+  -", "   - -+ ", "   - -
+", "   - +- ", "   - + -", "   -  -+", "   -  +-", "   +--  ", "   +-
- ", "   +-  -", "   + -- ", "   + - -", "   +  --", "    --+ ", "
-- +", "    -+- ", "    -+ -", "    - -+", "    - +-", "    +-- ", "
 +- -", "    + --", "     --+", "     -+-", "     +--"]

It is a little longer but we see already that only 2 minuses and 1
plus is allowed...
By storing this into a variable tmp we can continue easily to explore
what is happening
tmp.map{|x|  t = "1" + x.split(//).zip((2..9).to_a).join.delete(" ") ;
[eval(t),t]}
=> [[456785, "1-2-3+456789"], [56754, "1-2-34+56789"], [6443,
"1-2-345+6789"], [-2668, "1-2-3456+789"], [-34479, "1-2-34567+89"],
[-345670, "1-2-345678+9"], [-456787, "1-2+3-456789"], [-56756,
"1-2+34-56789"], [-6445, "1-2+345-6789"], [2666, "1-2+3456-789"],
[34477, "1-2+34567-89"], [345668, "1-2+345678-9"], [56763,
"1-23-4+56789"], [6722, "1-23-45+6789"], [311, "1-23-456+789"],
[-4500, "1-23-4567+89"], [-45691, "1-23-45678+9"], [-56807,
"1-23+4-56789"], [-6766, "1-23+45-6789"], [-355, "1-23+456-789"],
[4456, "1-23+4567-89"], [45647, "1-23+45678-9"], [6551,
"1-234-5+6789"], [500, "1-234-56+789"], [-711, "1-234-567+89"],
[-5902, "1-234-5678+9"], [-7017, "1-234+5-6789"], [-966,
"1-234+56-789"], [245, "1-234+567-89"], [5436, "1-234+5678-9"],
[-1561, "1-2345-6+789"], [-2322, "1-2345-67+89"], [-3013,
"1-2345-678+9"], [-3127, "1-2345+6-789"], [-2366, "1-2345+67-89"],
[-1675, "1-2345+678-9"], [-23373, "1-23456-7+89"], [-23524,
"1-23456-78+9"], [-23537, "1-23456+7-89"], [-23386, "1-23456+78-9"],
[-234565, "1-234567-8+9"], [-234567, "1-234567+8-9"], [-456789,
"1+2-3-456789"], [-56820, "1+2-34-56789"], [-7131, "1+2-345-6789"],
[-4242, "1+2-3456-789"], [-34653, "1+2-34567-89"], [-345684,
"1+2-345678-9"], [-56769, "1+23-4-56789"], [-6810, "1+23-45-6789"],
[-1221, "1+23-456-789"], [-4632, "1+23-4567-89"], [-45663,
"1+23-45678-9"], [-6559, "1+234-5-6789"], [-610, "1+234-56-789"],
[-421, "1+234-567-89"], [-5452, "1+234-5678-9"], [1551,
"1+2345-6-789"], [2190, "1+2345-67-89"], [1659, "1+2345-678-9"],
[23361, "1+23456-7-89"], [23370, "1+23456-78-9"], [234551,
"1+234567-8-9"], [56794, "12-3-4+56789"], [6753, "12-3-45+6789"],
[342, "12-3-456+789"], [-4469, "12-3-4567+89"], [-45660,
"12-3-45678+9"], [-56776, "12-3+4-56789"], [-6735, "12-3+45-6789"],
[-324, "12-3+456-789"], [4487, "12-3+4567-89"], [45678,
"12-3+45678-9"], [6762, "12-34-5+6789"], [711, "12-34-56+789"], [-500,
"12-34-567+89"], [-5691, "12-34-5678+9"], [-6806, "12-34+5-6789"],
[-755, "12-34+56-789"], [456, "12-34+567-89"], [5647, "12-34+5678-9"],
[450, "12-345-6+789"], [-311, "12-345-67+89"], [-1002,
"12-345-678+9"], [-1116, "12-345+6-789"], [-355, "12-345+67-89"],
[336, "12-345+678-9"], [-3362, "12-3456-7+89"], [-3513,
"12-3456-78+9"], [-3526, "12-3456+7-89"], [-3375, "12-3456+78-9"],
[-34554, "12-34567-8+9"], [-34556, "12-34567+8-9"], [-56778,
"12+3-4-56789"], [-6819, "12+3-45-6789"], [-1230, "12+3-456-789"],
[-4641, "12+3-4567-89"], [-45672, "12+3-45678-9"], [-6748,
"12+34-5-6789"], [-799, "12+34-56-789"], [-610, "12+34-567-89"],
[-5641, "12+34-5678-9"], [-438, "12+345-6-789"], [201,
"12+345-67-89"], [-330, "12+345-678-9"], [3372, "12+3456-7-89"],
[3381, "12+3456-78-9"], [34562, "12+34567-8-9"], [6903,
"123-4-5+6789"], [852, "123-4-56+789"], [-359, "123-4-567+89"],
[-5550, "123-4-5678+9"], [-6665, "123-4+5-6789"], [-614,
"123-4+56-789"], [597, "123-4+567-89"], [5788, "123-4+5678-9"], [861,
"123-45-6+789"], [100, "123-45-67+89"], [-591, "123-45-678+9"], [-705,
"123-45+6-789"], [56, "123-45+67-89"], [747, "123-45+678-9"], [-251,
"123-456-7+89"], [-402, "123-456-78+9"], [-415, "123-456+7-89"],
[-264, "123-456+78-9"], [-4443, "123-4567-8+9"], [-4445,
"123-4567+8-9"], [-6667, "123+4-5-6789"], [-718, "123+4-56-789"],
[-529, "123+4-567-89"], [-5560, "123+4-5678-9"], [-627,
"123+45-6-789"], [12, "123+45-67-89"], [-519, "123+45-678-9"], [483,
"123+456-7-89"], [492, "123+456-78-9"], [4673, "123+4567-8-9"], [2012,
"1234-5-6+789"], [1251, "1234-5-67+89"], [560, "1234-5-678+9"], [446,
"1234-5+6-789"], [1207, "1234-5+67-89"], [1898, "1234-5+678-9"],
[1260, "1234-56-7+89"], [1109, "1234-56-78+9"], [1096,
"1234-56+7-89"], [1247, "1234-56+78-9"], [668, "1234-567-8+9"], [666,
"1234-567+8-9"], [444, "1234+5-6-789"], [1083, "1234+5-67-89"], [552,
"1234+5-678-9"], [1194, "1234+56-7-89"], [1203, "1234+56-78-9"],
[1784, "1234+567-8-9"], [12421, "12345-6-7+89"], [12270,
"12345-6-78+9"], [12257, "12345-6+7-89"], [12408, "12345-6+78-9"],
[12279, "12345-67-8+9"], [12277, "12345-67+8-9"], [12255,
"12345+6-7-89"], [12264, "12345+6-78-9"], [12395, "12345+67-8-9"],
[123450, "123456-7-8+9"], [123448, "123456-7+8-9"], [123446,
"123456+7-8-9"]]

Well this is very impressive as it solves the quiz but I lost him
there, I guess we have to look into the block applied to tmp.map
{|x|  t = "1" + x.split(//).zip((2..9).to_a).join.delete(" ") ; [eval(t),t]}

okay let us take just one x, e.g.
 x= tmp[32]
=> "-   -  +"
## To my great despair tmp[42] is not a very good example :(

Now we split x into single characters and zip the digits 2 to 9 into them
x.split(//).zip([*2..9])
=> [["-", 2], [" ", 3], [" ", 4], [" ", 5], ["-", 6], [" ", 7], [" ",
8], ["+", 9]]
and I think I understand what happened now, the rest is basic, add a 1
in the front flatten the array and delete all spaces, and you get the
expressions needed for the quiz.

I guess that the final sort.each is quite straight forward.

HTH

BTW I want to have my ball back James, or adjust my handicap please ;).

Cheers
Robert

-- 
You see things; and you say Why?
But I dream things that never were; and I say Why not?
-- George Bernard Shaw

In This Thread