Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Let's try "port search factor" - again it fails. There's no 'factor' utility in Mac OS X's ports.
On the other hand, Ruby version works perfectly even with the bundled Ruby interpreter.
And THAT is the problem with shells.
Posted Dec 8, 2012 20:01 UTC (Sat) by man_ls (subscriber, #15091)
Posted Dec 8, 2012 20:04 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
I've checked and it doesn't seem that the 'factor' command is mentioned anywhere in the POSIX spec.
Posted Dec 8, 2012 22:52 UTC (Sat) by man_ls (subscriber, #15091)
For your Mac OS X, I believe that brew install coreutils will get you a nice local copy of factor.
brew install coreutils
Posted Dec 8, 2012 23:26 UTC (Sat) by davidescott (guest, #58580)
GNU has done an impressive job of unifying the *nix with a set of common tools, and the fact that someone can "brew install coreutils" and get a bunch of useful binaries is a testament to the value of the work GNU has done. BUT...
That does not mean that "shell" is the best language, it just means that shell is the least common denominator for interacting with a diverse set of programs (and it has served *nix well). Text input/output, flags for program options, silence is success, integer return codes, etc... As programs mature they get split into libraries, and those libraries get external interfaces to other languages like python/ruby/etc...
Posted Dec 8, 2012 23:10 UTC (Sat) by davidescott (guest, #58580)
If you look at what else is in coreutils factor seems completely out of place. There is not a single other tool in coreutils to do basic arithmetic. Where is there a /usr/bin/factor but not a /usr/bin/factorial, /usr/bin/exponent, /usr/bin/log or for that matter a /usr/bin/prime or /usr/bin/primes. In fact a good multi-function random tool (to generate random numbers or strings) would seem to be a far far far more useful thing to add to coreutils than "factor."
I'm really curious what considerations lead to "factor" being included into coreutils, is there an init script that really needs to factor a number before it can continue?
I don't mean this as a criticism of the developers of bc or coreutils or of GNU in general. Tools like "bc" were advanced and useful for their day. Thankful we have better alternatives for many use cases, and with 8 cores and 16GB of RAM I'm happy to waste a bit of each to get a more use friendly tool to do basic arithmetic and really don't need "bc" or "factor" anymore.
Posted Dec 9, 2012 17:39 UTC (Sun) by nix (subscriber, #2304)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds