Live data from Hacker News

Exploring pre-1990 versions of wc(1) (2023)

sigwait.org

11–20 of 27 posts

Re: Exploring pre-1990 versions of wc(1) (2023)

#11
post #5

Earlier quoted context omitted.

Because they thought that a word is something said in a human language that they can understand.

Mi ne pensas ke lingvoj kiuj usas ekskluzive la basan latinan alfabeton estas komprepeneblaj per si mem.

Ze riform iz komplit.

Re: Exploring pre-1990 versions of wc(1) (2023)

#12
post #5

Earlier quoted context omitted.

Because they thought that a word is something said in a human language that they can understand.

Mi ne pensas ke lingvoj kiuj usas ekskluzive la basan latinan alfabeton estas komprepeneblaj per si mem.

Cool how my native language is Spanish and I can almost-understand 80% of Esperanto.

Re: Exploring pre-1990 versions of wc(1) (2023)

#13
The brevity carried over to Plan 9. Re-posting my older comment (https://news.ycombinator.com/item?id=4023385):

http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs follows the Unix philosophy. A lot of legacy has been shed. I can count 13 options to ls, 11 options to sed and just 5 to sed.

The standard Plan 9 shell, Rc, is described in mere ~500 lines of manpage, while Bash takes whooping ~5400 lines.

Oh, and there is no `dll hell' in P9 :-)

Re: Exploring pre-1990 versions of wc(1) (2023)

#14
post #8
post #3

> A word is a maximal string of characters delimited by spaces, tabs or newlines. And then the actual code explicitly filters out and ignores every character larger than 0x7F. Just why.

ASCII is 7 bits (the eight bit would be parity), so that makes perfect sense, in an ASCII world.

So the character e.g. "B" would have this parity bit set and therefore should be filtered out and not count as a letter, in the ASCII world?

Re: Exploring pre-1990 versions of wc(1) (2023)

#16
post #8

Earlier quoted context omitted.

ASCII is 7 bits (the eight bit would be parity), so that makes perfect sense, in an ASCII world.

So the character e.g. "B" would have this parity bit set and therefore should be filtered out and not count as a letter, in the ASCII world?

There are only 7 bits in ASCII. An 8th can be used for parity when transmitting data but a regular program will never see it. Anything above 0x7F is simply not a character.

Re: Exploring pre-1990 versions of wc(1) (2023)

#18
post #5

Earlier quoted context omitted.

Mi ne pensas ke lingvoj kiuj usas ekskluzive la basan latinan alfabeton estas komprepeneblaj per si mem.

Ze riform iz komplit.

The [z] and [ð] are phonemically different in English, just as [i] and [i:] are, so it'd actually be "Ðe riform is komplijt". American rhotacism prevents us from spelling it "rifoom" as would be proper, unfortunately.

Re: Exploring pre-1990 versions of wc(1) (2023)

#19
post #7
post #6

A fun read on word count optimization can be found in Abrash's Black Book: https://www.jagregory.com/abrash-black-book/#lessons-learned... You can gloss over the asm if you wish, the tricks that are explained around it are worth it imho.

I wonder if large lookup tables/table-driven state machines are still as good as they used to be. After all, even with all the on-chip caches, the additional memory accesses today seem to be slower than doing some multi-instruction SIMD voodoo.

At least the GNU version of wc [0] uses AVX2 for line counting, if available. Though it falls back to a simple character-by-character loop if you ask for a character count [not to be confused with a byte count!] or a word count.

[0] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/wc_...

Re: Exploring pre-1990 versions of wc(1) (2023)

#20
post #8

Earlier quoted context omitted.

ASCII is 7 bits (the eight bit would be parity), so that makes perfect sense, in an ASCII world.

So the character e.g. "B" would have this parity bit set and therefore should be filtered out and not count as a letter, in the ASCII world?

What in the hell are you going on about? B is 0x46 which is < 0x7F.
Post reply on HN