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.
Anyway, I'm impatiently waiting to see how H_TeXMeX_H will implement the suggested code snippet in C, Python, Java (well, the very very latest Java is supposed to have closures).
By the way, delegates (bound object methods passed as functions) were present in Object Pascal and so semantically closures were even there (it was clumsy for some uses, because it was apparently optimized for a fixed use case)
Python supports simple anonymous functions through the lambda form. The executable body of the lambda must be an expression and can't be a statement, which is a restriction that limits its utility. The value returned by the lambda is the value of the contained expression. Lambda forms can be used anywhere ordinary functions can, however these restrictions make it a very limited version of a normal function.
When reading about Haskell, I found that it said all variables were unchangable once they were created, and I understood that this was part of all functional languages. Is this true?
In Haskell variables are immutable; functional language treats functions as first class objects, i.e. functions can be passed as arguments and returned from other functions - mutability is a separate issue.
Immutability allows much better optimizations and formal correctness proofs.
OCaml, for example, allows to explicitly declare a variable or a field mutable, but recommends to do this as seldom as possible and when really needed. The tutorial has examples/explanations on this.
Last edited by Sergei Steshenko; 07-12-2010 at 03:54 PM.