Re: Bracket Packing (#78)


#1

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

#2

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?


#3

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.


#4

On Fri, 5 May 2006 23:38:05 +0900, Ross B. removed_email_address@domain.invalid
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


#5

On Fri, 2006-05-05 at 23:23 +0900, removed_email_address@domain.invalid 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.


#6

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.