Talk:Text processing/Max licenses in use: Difference between revisions

From Rosetta Code
Content added Content deleted
(Alternate hosting)
Line 13: Line 13:
Maximum simultaneous license use is 0 at the following times:
Maximum simultaneous license use is 0 at the following times:
:Note that I didn't have to do any special checks to get this behavior, it just fell naturally out of the code. (This happens a lot in J.)
:Note that I didn't have to do any special checks to get this behavior, it just fell naturally out of the code. (This happens a lot in J.)
== File hosting ==

Not that I have anything against Google Documents, but would I'd like to put the file on RC's server. --[[User:Short Circuit|Short Circuit]] 04:11, 4 October 2008 (UTC)

Revision as of 04:11, 4 October 2008

Assumptions

We might be better able to compare code if we document our assumptions.

J

The J solution makes assumptions to allow the interesting code to stand out (rather than the drudgery). This obviously comes at the cost of some robustness (and, incidentally, optimizes for speed).

  • Assumes the file ends in a newline.
  • Assumes the format of the file is fixed (that char 8 of each line is 'I' or 'O' as the license is checked in or out, respectively, and that the date is chars 14-32 of each line).
  • Does not assume the file exists or, if it exists, that it contains any data (i.e. it may be zero bytes long). For example, if the file is empty, you get this:
Maximum simultaneous license use is 0 at the following times:
Note that I didn't have to do any special checks to get this behavior, it just fell naturally out of the code. (This happens a lot in J.)

File hosting

Not that I have anything against Google Documents, but would I'd like to put the file on RC's server. --Short Circuit 04:11, 4 October 2008 (UTC)