# Re: Bracket Packing (#78)

Quick question about the phrase ‘occasionally missing off a bracket’. Is
it possible to have lost more than one braket missing from the string,
or will it be a case of 0…1 brackets missing? I assume just one. If it
is possible to have more than one bracket missing, you could never trust
what the program was saying, even when the string was valid.

Ie, [{(B),(B)}] -> [(B),(B)]

• Stu

Surely that isn’t possible, some combinations could have more than one
possible
correction, eg:

[{BB] => [{B}B]
or
[{BB] => [{BB}]
or even,
[{BB] => [{}BB]
or even, (tho presumably this is invalid - some sort of black hole
packaging):
[{BB]}

Perhaps the program should present the possible options and ask which is
wanted?

On Fri, 2006-05-05 at 22:52 +0900, Stuart H. wrote:

Quick question about the phrase ‘occasionally missing off a bracket’. Is
it possible to have lost more than one braket missing from the string,
or will it be a case of 0…1 brackets missing? I assume just one. If it
is possible to have more than one bracket missing, you could never trust
what the program was saying, even when the string was valid.

Ie, [{(B),(B)}] -> [(B),(B)]

Good point. Let’s assume just one bracket will be missing, if any.
Obviously, to fix it, it needs to go back in the right place.

On Fri, 5 May 2006 23:38:05 +0900, Ross B. [email protected]
wrote:

sure the packer doesn’t get in a mess, and both of those will pass
through fine (even if the wrappings aren’t exactly as intended).

Hmm, to clarify, brackets can have non-bracket siblings?

-mental

On Fri, 2006-05-05 at 23:23 +0900, [email protected] wrote:

Surely that isn’t possible, some combinations could have more than one possible
correction, eg:

[{BB] => [{B}B]
or
[{BB] => [{BB}]

Either of the above is valid - the main object of this is just to make
sure the packer doesn’t get in a mess, and both of those will pass
through fine (even if the wrappings aren’t exactly as intended).

or even,
[{BB] => [{}BB]
or even, (tho presumably this is invalid - some sort of black hole packaging):
[{BB]}

Both of these are invalid, and definitely not what was intended - there
won’t be any empty packages (as in the first case) and the second isn’t
balanced.

Perhaps the program should present the possible options and ask which is wanted?

If you want to output the options and fail with exitcode 1 for the
ambiguous ones, that’s cool too.

On Sat, 2006-05-06 at 04:42 +0900, MenTaLguY wrote:

Either of the above is valid - the main object of this is just to make
sure the packer doesn’t get in a mess, and both of those will pass
through fine (even if the wrappings aren’t exactly as intended).

Hmm, to clarify, brackets can have non-bracket siblings?

It’s technically allowed in the output, but would never occur in a
correct input.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.