Shell
Orbitz - orbitz - May 30, 2006The other day, araujo suggested Erlang might make a good shell. Shell as in, bash. Hrm, I thought, maybe…
I don’t think Erlang would be flexible enough to make a decent shell. Take something like this:
for i in *; do echo $i; done
What would the Erlang equivalent look like?
lists:map(fun(X) -> print([X]) end, ls())
I just don’t see it? I should hope it doesn’t look like that but I don’t know. On the other hand, I seem to have it pretty set in my mind that Common Lisp would make an excellent shell language. A few people have told me that CL would probably be too verbose and not work out well but, I don’t know, it just seems so succinct and powerful. You could make a lot of macros to make your life easier. I sent an email to the Lisp At Light Speed blog dude to get his opinion but I figured I’d post it here too to see if anyone has any thoughts.
What I have in mind is basically an interactive shell, using Common
Lisp as its programming language. For instance something like:
for i in *; do echo $i; done
Might look like:
(loop for i in (ls) do (print i))
The second thing I would love to see is Monad/Powershell. Rather
than using text to pass data around, uses lists/objects/etc. (ls)
for instance gives a list of file objects to iterate over, and you
can extract things like the size and permissions and what not.
This raises a question though. In order to do this, just about every
standard program becomes obsolete. For instance, why use 'cut' when
you can simply split a string with a CL function. However some
things would still be very useful, such as ls, or grep, but these
now need to communicate via objects rather than just text, so those
will have ot be rewritten. In which cause it seems like they could
simply be packages and loaded into the shell, meaning you don't
have to deal with program startup times or what not. Is this a lot
of work to rewrite all of these programs, and does it mean that we
cannot usefully use third party programs that people write? You
can always drop down to using strings as communication I suppose.
That is the basic idea. So far a few people have suggested that
sexprs really aren't any better for this sort of thing. sexpr's
won't be any better than say…bash. Someone suggested that Factor
might be a better language for this. But it seems to me, with
Common Lisps powerful macro system, you can easily make most
operations incredibly simple? The most useful aspect would be using
objects to communicate. But even if this is a lot of work to
accomplish, it seems to me that simply using CL as a shell programming
language seems like it would be nice. Am I wrong here? Am I missing
something?
If CL would make a poor langauge, what would make a good language? Riastrach has suggested Factor. I don’t know enough about factor to say that but I think I like CL better for this.
All I know is:
This is not the answer
Categories: Blogs Orbitz
Erlang on Twitter
» Erlang_Cielers (Erlang G Sebastian): @indahtriutami14 makasih udah d follback :) lams knal yaa ..
» erlang_26 (Prabu Rangga Lawe): Ampe seret ni tenggorokan.. Yang namanya perang siap nggak siap hadapiiii !!!
» gab_km (let ガブ = Some(エンジニア)): RT @taketon_: PropEr: A QuickCheck-inspired property-based testing tool for Erlang http://t.co/At4HP7nVa0
» michaelklishin (Michael Klishin): «+zdbbl [Erlang VM flag] sets the distribution average zabble double shwazzizle…» http://t.co/KoXNN3PMBA
» indahtriutami14 (indah tri utami): Iyah udah:) RT”@Erlang_Cielers: @indahtriutami14 follback yaa :)”
» masterq_teokure (ジプシー): erlang?
» pocketberserker (なかやん・ゆーき(モミアゲマン)): RT @taketon_: PropEr: A QuickCheck-inspired property-based testing tool for Erlang http://t.co/At4HP7nVa0
» JCCodeHound (Justin Calcagni): @bryan_hunter I added my erlang repo (4 whole files!) to NashFP. I hope I didn’t break any unwritten rules in the process.
» taketon_ (Shig.Takei): PropEr: A QuickCheck-inspired property-based testing tool for Erlang http://t.co/At4HP7nVa0
» Erlang_Cielers (Erlang G Sebastian): @indahtriutami14 follback yaa :)
Statistics
Number of aggregated posts: 10650
Most recent article: May 20, 2013
Latest comments
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…