>>>>> "RM" == Richard Morse <[EMAIL PROTECTED]> writes:

  RM> I've attached my code, which I know sucks, but at least mostly works
  RM> (it doesn't print the separator when $before == $after == 0).

i see no code. either the list stripped it or you forgot it! :)

better to paste the code directly as the list may not allow attachments.

  RM> An actual implementation of this should probably use a circular
  RM> array (size $before + $after + 1, do all offsets modulo this
  RM> number). Also, Uri, I must be missing something about references
  RM> to scalars, because every time I tried to make the last element a
  RM> pointer, and then deference it, I got an error about strict
  RM> 'vars', and if I didn't use strict, it didn't work. So I must be
  RM> confused about something.

circular arrays are slow as they require indexing which is slow. a shift
register should be faster and IMO cleaner code. when the first pass
coding is done and working, we can benchmark two versions and see.

as for the separator, we set it to '' initially and only set it to '--'
when we know we first need it. that should be simple logic as we
discussed. sure if A=B=0 then there is no separator so we just keep it
at ''.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to