Hacker News new | ask | show | jobs
by jacobush 2325 days ago
Does it handle multiple files, and stdin?

Anyway, destroying Haskell with 100 lines of C :-)

https://raw.githubusercontent.com/gdevic/minix1/master/comma...

3 comments

I see and raise, to one line:

https://www.ioccc.org/2019/burton/prog.c

It is the Burton entry from The International Obfuscated C Code Contest, but seems like only handling ascii

https://www.ioccc.org/years-spoiler.html

Limits:

"Requires the C locale and ASCII character set. Input should be less than ten million octets to avoid this problem."

https://www.ioccc.org/2019/burton/hint.html

Isn't 100 lines too much for a simple utility like wc? I get that it has many edge cases to cover, but edge cases usually require some different handling when you run into them anyway. I'd rather use my one-liner (including calculation in a single pass, and even parallel processing!):

    wc:{sum (({1};ceiling 0.5*sum differ " "=;{1+count x})@\:) peach read0 x}
Do you get a speed-up if you use getc_unlocked() instead of getc()? And if you write your own isspace()? As far as I know, isspace() is locale sensitive.
isspace is defined as a macro at the top of the file, and it's definitely not locale sensitive ;)