Forum: Ruby Re: Bracket Packing (#78)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89bb4a34f0294dfcea27af4ed6c98b07?d=identicon&s=25 Stuart Holden (Guest)
on 2006-05-05 15:55
(Received via mailing list)
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
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-05-05 16:08
(Received via mailing list)
On Fri, 2006-05-05 at 22:52 +0900, Stuart Holden 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.
23e1a6c83befa782116313295751f6ff?d=identicon&s=25 unknown (Guest)
on 2006-05-05 16:26
(Received via mailing list)
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?
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-05-05 16:39
(Received via mailing list)
On Fri, 2006-05-05 at 23:23 +0900, st103@doc.ic.ac.uk 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.
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 MenTaLguY (Guest)
on 2006-05-05 21:43
(Received via mailing list)
On Fri, 5 May 2006 23:38:05 +0900, Ross Bamford <rossrt@roscopeco.co.uk>
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
A9b6a93b860020caf9d2d1d58c32478f?d=identicon&s=25 Ross Bamford (Guest)
on 2006-05-06 00:21
(Received via mailing list)
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 topic is locked and can not be replied to.