From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60706160834t2a4a9abauab8caec41964ad59@mail.gmail.com> Date: Sat, 16 Jun 2007 08:34:30 -0700 From: "David Leimbach" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] a quick and simple minded study of configure. In-Reply-To: <106eb6113bc866fa7be68b228b07b0a6@9netics.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_45158_20566242.1182008070560" References: <3e1162e60706151818o58471565i3c5bef4487d6f2a@mail.gmail.com> <106eb6113bc866fa7be68b228b07b0a6@9netics.com> Topicbox-Message-UUID: 7fa10946-ead2-11e9-9d60-3106f5b1d025 ------=_Part_45158_20566242.1182008070560 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/15/07, Skip Tavakkolian <9nut@9netics.com> wrote: > > > I'm pretty sure I'm not good at it yet but I always found this one > > line. "word counter" impressive. > > > > std::distance(std::istream_iterator(std::cin), > > std::istream_iterator()); > > it is impressive that you typed that on a blackberry! I'm not going to tell you that it was easy :-) it's not short, if you count the class implementation. it doesn't > convey the idea - the solution is not understood unless you > understand each piece. I disagree, to the extent that it really is short, in that it's one line :-) I agree as your point is 100% valid that if you don't know distance, istream_iterator, what cin is, and how it deals with "std::string", that you wouldn't know how to write that line, and you possibly wouldn't understand how it works. But I suspect any person dealing with C++ has an idea how the STL and Standard C++ Library works. What might still not be obvious is that that you need certain restrictions on iterators for STL to work (don't stable_sort on list iterators, as you probably need something with random access, not bi-directional iterators). (ok that was a bit tongue-in-cheek) No wonder there's so much money in C++ books :-) i think what Ron is bringing up is having/learning the ability to > see through layers of filters to the exact need and providing a > design that is just the right distance between "pie in the sky" and > "failure of vision". > > Yep, I was trying to point out that sometimes less code is more headache :-) Of course when the plane door closes you have to shut off your phone so I don't think I got that across very well :-). At any rate, I'm hoping that's NOT what was meant by "Bell Labs Lines" :-) Dave ------=_Part_45158_20566242.1182008070560 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On 6/15/07, Skip Tavakkolian <9nut@9netics.com> wrote:
> I'm pretty sure I'm not good at it yet but I always found this one
> line. "word counter" impressive.
>
>  std::distance(std::istream_iterator<std::string>(std::cin),
> std::istream_iterator<std: :string>());

it is impressive that you typed that on a blackberry!

I'm not going to tell you that it was easy :-)
 

it's not short, if you count the class implementation.  it doesn't
convey the idea - the solution is not understood unless you
understand each piece.

I disagree, to the extent that it really is short, in that it's one line :-)

I agree as your point is 100% valid that if you don't know distance, istream_iterator, what cin is, and how it deals with "std::string", that you wouldn't know how to write that line, and you possibly wouldn't understand how it works.

But I suspect any person dealing with C++ has an idea how the STL and Standard C++ Library works.  What might still not be obvious is that that you need certain restrictions on iterators for STL to work (don't stable_sort on list iterators, as you probably need something with random access, not bi-directional iterators).  (ok that was a bit tongue-in-cheek)

No wonder there's so much money in C++ books  :-)   

i think what Ron is bringing up is having/learning the ability to
see through layers of filters to the exact need and providing a
design that is just the right distance between "pie in the sky" and
"failure of vision".

Yep, I was trying to point out that sometimes less code is more headache :-)

Of course when the plane door closes you have to shut off your phone so I don't think I got that across very well :-).

At any rate, I'm hoping that's NOT what was meant by "Bell Labs Lines"  :-)

Dave
------=_Part_45158_20566242.1182008070560--