ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Common Lisp is whatever you make it. You can write functional-style code in it or imperative code with it. Scheme (also a member of Lisp language family, but slightly different) is more inclined to be functional, but even it allows writing imperative code if you really want it. Haskell is a language that claims to be purely functional. Unfortunately, there is so much syntax sugar in Haskell that some people manage to write imperative-style Haskell tutorials despite all that...
Some people recommend "Structure and Interpretation of Computer Programs" to learn fucntional programming and Scheme. Of course there are many tutorials to learn Haskell or Scheme out there (I recommend Scheme). I cannot advise anything specific for learning Scheme because I was taught some fuctional programming in high school using a barebones toy language, and learned Scheme and Common Lisp by reading the specifications..
It may be that learning APL could be a nice start for learning functional programming, too..
I've tried common lisp at one point. Well, it's interesting as a concept, but I don't really like all the parentheses. Sure, I guess a good IDE will handle them, but then I asked myself what good will common lisp do me. I've never seen any programs written in lisp, or maybe 1 or 2. I already learned C/C++, much of which I've forgotten, and had to re-learn, and I don't even use C that often, and C++ almost never. Bash does everything I need in much less time than it would take to write a C program. I would only write a C program if there is none already available that can do the same thing, or if better performance is needed somewhere.
H_TeXMeX_H, so you just do not need to do any programming. I know bash scripting quite well (up to writing a small site as a CGI in POSIX shell), but it is simply not enough for many things.. And so I use Common Lisp... Its usefulness is only visible when Pascal stops being enough.
Some people recommend "Structure and Interpretation of Computer Programs" to learn functional programming and Scheme. Of course there are many tutorials to learn Haskell or Scheme out there (I recommend Scheme).
I second that. SICP I believe is still on the web for free.
From personal experience, I highly recommend that folks try to learn more languages than they actually use in day-to-day work. Try to learn them even if it makes your brain hurt (not all discomfort is bad). As a result, your thought process with working with the current set of "popular" languages will benefit greatly from it. For me, the two A and B languages were Scheme and C++ (I use C++ heavily in my daily work, only because it pays the bills in my chosen corner world where I chose to stay).
The reason Scheme (and Common Lisp to some degree) have stood the test of time, is due to their macro systems, not due to their embodiment of one particular programming fad. Want to program in a new paradigm? Then search for a macro library that provides that feature, or roll your own after that search is exhausted.
As your proficiency with several languages grows, you will find the rough edges of those languages. That applies to any languages. But, the advantage of the CL and Scheme branch of languages is that you can break out of those limitations by careful use of macro constructs. This is really the ability to extend the language.
As an example of the "A versus B" case, I run into this situation quite frequently in my own work: C++ (and its C predecessor) lack a good macro system. As programs get larger and larger, they need to be refactored to use constructs that operate at a higher level of abstraction than you can obtain by functional decomposition, object-oriented decomposition, or by generic programming. I cannot tell you how many times I've coded the same construct in C++ over and over again simply because there was no way to express exactly what I meant without resorting to the crippled C preprocessor (Read the GLIBC library source code, and you quickly discover that a much better macro system than what the C preprocessor provides, is in great need!).
Notice above that I am comparing Scheme's macro system to the C preprocessor, not comparing Scheme to C++.
Originally Posted by H_TeXMeX_H
I've tried common lisp at one point. Well, it's interesting as a concept, but I don't really like all the parentheses. Sure, I guess a good IDE will handle them, but then I asked myself what good will common lisp do me.
Choosing languages so as to avoid learning surrounding tools (such as sophisticated editors, and IDE's), is a mistake. You will find that languages that continue to evolve, such as C++, see the introduction of more complex syntax, and that inevitably leads to more complex constructs using more punctuation than just parentheses. Again, C++ has added angle brackets for C++ template constructs, and it already requires you to use curly braces and parenthesis. Compare that with other languages that wanted to "bolt on" generic programming constructs. You will, over time, beg for a sophisticated and customizable IDE to navigate all of the punctuation and constructs of multiple languages in a production software environment.
Actually, no. APL has a simple and strict grammar - just an unusual one. Perl has a ball of duct tape instead of grammar, and I am not sure it is even decidable.
And learning APL will make you learn something about pure functional programming (the things you caould have missed even with Scheme) and highly expressive array processing constructs - while Perl will only teach you to cut corners.
I agree that Perl is messy language, I wouldn't recommend it as a first language, it doesn't teach you how to program, only how to hack or yeah "duct tape" things together. Of course, you can still do stuff with it, but I decided not to learn it because of these aspects. I'll stick with C and some bash, and a bit of python.
The only functional language that has stood out for me is OCaml, I think you might wanna try it, like Sergei suggests. They boast performance nearing that of C, and it's like an all-in-one language. You can compile to byte code or fully compile. And it is FLOSS.
First, it is possible to write good readable code in Perl - and you have given a fine example. It just happens too rarely.
Second, what you have shown is a thing that can be done in any advanced shell, although in a clumsy way including evals. But if you want such things from the beginning, you could just pick a suitable language. You have given a fragment where Perl isn't even doing anything that is inconvenient in Python.
Now, Perl is a language with no overall design, and Python has only imitation of overall design principles. As the original question was about picking a language for learning concepts, language with an overall design usually gives you more.