Why I love Unix, number N (for some N)Suppose that you want to find all two and three digit primes where all of the component digits are also prime (eg, 37 would qualify but 41 would not, since 4 is not prime). Here is the simple Unix approach:
(I won't claim that this is obvious until you're immersed in the Unix pipe-bashing mindset, at which point it becomes all too easy to get sucked into the Turing tar pit.) On a side note, And, oh yeah, it's a GNU tool. Another way that they've contributed to Unix in the Unix way. (Okay, credit where credit is due; I believe that Update: Oops. As pointed out by a commentator, 1 is not a prime.
This shows one drawback of these neat one-line things; they're so
short and simple that you may be tempted to not double check your
work. (This is especially embarrassing for me because I looked at the
output of ' (5 comments.)
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |