Skip to content

Seperators before

20121010 (2012 October 10 Wednesday)

Use when processing test.


When parsing test, it is some times necessary to place separators after each elements, but not after the last one.

And

At the time you write out the last element you don’t know it is the last one.

We always thing of the separator as after an item. e.g. (new line at end of line, comma after each element except last).

However it is equally valid to think of it as being before e.g. (comma before each element except the first).

When you have a separator between each item but think of the separator as after an item, the last item becomes a special case (no separator after last item). You can make the first item the special case by putting the separator before each item. The first item is easy to predict ( its the first one ).

Therefore:

Put separators before item instead of after.
Initialize separator to its first case exception value, after its first use change it to its normal value.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: