40 points · by sabalaba · 13y ago · 46 comments
Why is it ls instead of list? chmod instead of permissions? grep instead of search? mv, cp, rm instead of move, copy, remove? Is it really so much work to type a few more characters to justify this?
Programming langue APIs (or rather their libraries) have come a long way since the C days in that regard, but OS wise we're still stuck with these cryptic names.
I hate chmod, too, because I can't remember exactly what permissions are what (number-wise.) My fault, not his. But I'd love it to be named "grant" and have a neater language. Like grant user/group/whatever read,write,execute (rwx are actually okayish...) filename. I know chmod is more or less like this. But I don't stand it. It's like combinatoric problems, something deep inside of me refuses to accept doing it :)
I guess you know what grep stands for, don't you? It's a "legacy" command from an early version of ed, g/re/p as in "global search" a "re"gex "p"rinting results. It could be named re (for regex, search implicit) or res (I like this.) Anyway, I use ag (the silver searcher) for text/code search, though. Less letters, easier to use (I keep forgetting if I need -r, -e and all that, ag makes it somewhat easier.)
As for mv, cp, rm, if all 2-letter acronyms were that easy to remember! Did you use extensively DOS? Most commands where far too verbose, I cringe if thinking about having to write copy to copy. Cp is just a smash with the left hand and another with the right hand and off you go. Minimise errors, 2 strokes. Actually now I wonder why in nix we have clear and not cls (or just cl)
As a matter of names... Plan9 uses
nix names, and since Plan9 tried to do things "differently" almost just for the sake of it, either they didn't think about it or thought it was a bad idea.Would you like to type out 2-3x more characters per command?
The time I spent thinking "what was that command again?" is far greater than the time I would need to type a few more characters.
The shell is a working language as much as English is. You'll spend more time using it than learning it, so get crackin'.
- the symmetry: 'c[ad]r'
- thus same size
- small size (3)
and ended up being annoyed by `first` and `rest`. I see them as APL-like characters now.ps: based on that, head/tail, hd/tl, fst/snd (seen in ml dialects) are also good candidates.
First, Rest, Most, Last
(Results on Range[4], respectively: 1, {2, 3, 4}, {1, 2, 3}, 4.)
>> a: [1 2 3 4]
== [1 2 3 4]
>> first a
== 1
>> last a
== 4
This is how you could add rest & most: >> rest: func [s] [next s]
>> most: func [s] [copy/part s back tail s]
>> rest a
== [2 3 4]
>> most a
== [1 2 3]
Rebol unifies all this under what it calls a series - http://www.rebol.com/docs/core23/rebolcore-6.htmlCar and Cdr are arbitrary and legacy terms.
sub car { $_[0] } sub cdr { shift; @_ } # every utils module ever
For eg:
use perl5i::2;
sub autobox::Core::ARRAY::car { $_[0]->[0] }
sub autobox::Core::ARRAY::cdr {
my $last = $#{$_[0]};
wantarray ? @{$_[0]}[1 .. $last] : [@{$_[0]}[1 .. $last]];
}
then... my @a = 1..4;
@a->car; # 1
@a->cdr->cdr->car; # 3
@a->cdr; # 2, 3, 4
my @x = @a->cdr;
@x->cdr; # 3, 4
Some refs: https://metacpan.org/pod/perl5i | https://metacpan.org/pod/autobox::CorePerl can be written ugly enough without introducing car and cdr to it!