Re: More on authors that don't respond

2003-08-15 Thread Sam Vilain

Perhaps you missed
, putting an
iterator behind a tied hash, giving you "each" as a single
iteration, or "keys" to get them all.
Yet Another Way. :)

OK, well if you're using a hash to iterate, then it's perhaps a
different type of iterator.  In Maptastic there is a map_each(&@)
method, which sets @_ to (each %hash) in the block.  This would work
with your tied hash approach, as the input would be ->isa("HASH").

However, I suppose that using the scalar form of `each', returning
just the key, would be the appropriate thing to use for map variants
that expect singular items.

So we've got:

Blessed objects:
$_->__next__(Object::Iterate)
$_->get_next(SPOPS-style)
$_->next(Tangram::Cursor, File::Iterator,
   Data::Iterator::EasyObj, etc)
Unblessed:
$_->()  (MJD-style, his hybrid blessed closures can be
 expected to ->can() one of the above)
scalar(each %$_)

Hmm, for completion, what about arrays?

I can see two possible semantics for arrays as iterators;

   shift @$_while (@$_)

   $_->[$i++]   while (exists $_->[$i]);

I think the latter is better, though it doesn't work with sparse
arrays.  Caveat emptor?
-- 
Sam Vilain, [EMAIL PROTECTED]

  Things are more like they are now than they ever were before.
DWIGHT D EISENHOWER



Re: More on authors that don't respond

2003-08-14 Thread Andy Lester
Further to the earlier discussion, I thought some might find this
auto-response I got from mailing one CPAN author funny:
-
I am preparing to or have deployed with my National Guard unit for federal
active duty.  I may not be able to access or read my email for extended
periods of time, and even then may be limited by time or security measures.
I cannot answer any questions about this deployment, the nature of our
mission, or a projected return date.  "Loose lips sink ship" ;)
Funny in an amusing way?  Or funny as bad?

I now co-own everything in BDFOY's CPAN land, and his home page has a 
"CPAN power of attorney" pointing at me or Randal.  What did you need 
help with?

xoa
--
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance


Re: More on authors that don't respond

2003-08-14 Thread Sam Vilain

>Further to the earlier discussion, I thought some might find this
>auto-response I got from mailing one CPAN author funny:
>-
>I am preparing to or have deployed with my National Guard unit for
> federal active duty.  I may not be able to access or read my email
Funny in an amusing way?  Or funny as bad?

Funny as in, now it's not about dead camels, rather hibernating
camels, an aspect the conversation did not really focus on.
Fortunately as he's looked after this responsibility it's not funny as
in bad.  There's also the distinctly unfunny side of it, and my
thoughts go out to Brian in that regard.

I now co-own everything in BDFOY's CPAN land, and his home page has a
"CPAN power of attorney" pointing at me or Randal.  What did you need
help with?

It's about Object::Iterate; I have a module to be released that will
supply some extra forms of map (eg, Tye McQueen's mapcar), and wanted
to produce iterative versions of them too.  Therefore, it would be
good to form a standardised set of semantics for iterators.

I quite liked MJD's semantics for using a CODE ref as an iterator; it
certainly makes the code simple.  OTOH, I appreciate that it's not OO
clean, so the Object::Iterate approach might be considered better by
some.  This calls for hybrid semantics IMHO.

The question is, what should those semantics be, and should/how can
Object::Iterate form a convenient `adapter' for the differing
conventions?

These are the conventions I've seen used:

->__next__(Object::Iterate)
->()  (MJD-style)
->get_next(SPOPS-style)
->next(Tangram::Cursor, File::Iterator,
   Data::Iterator::EasyObj, etc)

Also, there are some stickier points; such as - is it reasonable to
assume that if an iterator returns `undef' that it's finished?  Should
there be a similar set of conventions for resetting or un-getting
items from the iterator?
-- 
Sam Vilain, [EMAIL PROTECTED]

Real software engineers don't program in assembler.  They become
queasy at the very thought.



Re: More on authors that don't respond

2003-08-14 Thread Randal L. Schwartz
> "Sam" == Sam Vilain <[EMAIL PROTECTED]> writes:

Sam> These are the conventions I've seen used:

-> __next__(Object::Iterate)
-> ()  (MJD-style)
-> get_next(SPOPS-style)
-> next(Tangram::Cursor, File::Iterator,
   Data::Iterator::EasyObj, etc)

Perhaps you missed ,
putting an iterator behind a tied hash, giving you "each" as a single
iteration, or "keys" to get them all.

Yet Another Way. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


More on authors that don't respond

2003-08-14 Thread Sam Vilain
No, I'm not trying to flog a dead horse.

Further to the earlier discussion, I thought some might find this
auto-response I got from mailing one CPAN author funny:

-
I am preparing to or have deployed with my National Guard unit for federal
active duty.  I may not be able to access or read my email for extended
periods of time, and even then may be limited by time or security measures.
I cannot answer any questions about this deployment, the nature of our
mission, or a projected return date.  "Loose lips sink ship" ;)

Mail may not be saved depending on how long I have not read mail and
how much disk space I am using.

If you care to write to me, my physical address for mail delivery is

 ...

That mail will be periodically forwarded to me, or handled appropriately. 
Note that military censors will read anything that you write, and they
will take anything you say seriously. Don't make the FBI visit you.

-- 
Sam Vilain, [EMAIL PROTECTED]

  'Martyrdom' is the only way a person can become famous without
ability
GEORGE BERNARD SHAW