Hi,
I am a programmer of imperative languages and I would like to improve my (currently scarce) knowledge of <declarative> programming techniques, starting with the lisp language.
I have a degree in mathematics and I would like to attend chats where we can talk about this type of approach to programming.
Thanks for any help and suggestions.
Angelo Moreschini
Le 04/06/2022 à 09:59, Angelo Moreschini a écrit :
Hi,
I am a programmer of imperative languages and I would like to improve my (currently scarce) knowledge of <declarative> programming techniques, starting with the lisp language.
I have a degree in mathematics and I would like to attend chats where we can talk about this type of approach to programming.
Thanks for any help and suggestions.
http://cliki.net/Getting+Started http://cliki.net/IRC
Note: lisp is not particularly declarative (it's not particularly anything in fact), but it is possible to write lisp code in declarative style (or in any other style you want).
That's one advantage of lisp: you can use any style you want or need, depending on your current problem, even you can use multiple styles in the same program.
Declarative programming style will rely on code = data and the fact that lisp programs are written actually as lisp data.
So you can write declarations in form of symbolic expressions aka s-expressions aka sexps, and write little interpreters or translators for those declarative forms to implement their semantics.
On Sat, Jun 04, 2022 at 10:59:33AM +0300, Angelo Moreschini wrote:
Hi,
I am a programmer of imperative languages and I would like to improve my (currently scarce) knowledge of <declarative> programming techniques, starting with the lisp language.
Ahoy,
Myself, long time ago, I started from learning some Scheme. R5RS Scheme is quite simple, one can quickly (say, few afternoons? maybe just one) get enough of it to write some simple programs and see if you like it with parentheses. For this, one does not need to learn about continuations and macros, it is really easy to grasp, IMHO.
There should be some dated but still good interpreters for R5RS. I found Aubrey Jaffer's scm and Nils Holm's s9fes to be relatively small and more or less easy to understand. Some newer Schemes adhere to R7RS (or R6RS) standards and they are huge. I would say, too big for a start. But much better for solving some real life problems. But you are not there yet.
http://people.csail.mit.edu/jaffer/SCM
http://t3x.org/s9fes/index.html
Aubrey Jaffer also maintains slib, a library of Scheme code for even older and mostly unmainained (as of now) interpreters, you could look at those files and enjoy (or not) reading them.
After learning some Scheme, while I enjoyed it, I found myself a bit stuck. I had little use for continuations and macros, and R5RS was, in its pure form, very limited for everyday porgramming. So I started to learn from other sources.
I guess you will want to befriend a Unix clone if you want to learn the stuff. Some of it will work under Windows, but long term, you will probably have less pain with Unix.
And I guess you will want to befriend Emacs editor. It is not just an editor. It is a pocket universe of Elisp, another LISP dialect. Elisp has nice set of functions and I wrote few scripts in it, which were then nicely interpreted by Emacs - stuff working with files, unpacking archives and the like, nothing one would expect to be a job for editor. Of course, Emacs does not need to open a window when running in batch (script) mode.
Emacs comes with some help for LISP programmer - it knows how to color the code, and nested parentheses may have different colors and when one places cursor over a parenthese, a matching one can blink. And it can get a LISP sentence and send it to interpreter, for quick evaluation. It can integrate with some Scheme subprocess in order to make your life easier (after you cry a bit, and pull your hairs a bit, that is). It also has nice integration package for Common Lisp, called Slime. Very, very nice. Overally, relation of programmer and Emacs is quite similar to the one described as Stockholm Syndrome. I love it, it is so good to me. It is not really bad editor, not at all.
Some of the features you may find in other editors of the day, but I think that befriending Emacs few decades ago was one of the best decision I could have make. Especially that I was always dragged towards LISPs. So the one and another were supposed to come together.
And last but not least, Common Lisp. I would say, do not start from this. But if you really have to, try locating a book "Common Lisp: A Gentle Introduction to Symbolic Computation" by David S. Touretzky. I did not really read it, I found it too late for me, but I have glanced at the beginning and it looked like suitable for a beginner. Try finding author's homepage.
Some will tell you to go with Peter Seibel's "Practical Common Lisp". Well, you can try it. I found this book a bit too huge. Clearly, Seibel talks a lot because he knows a lot. But at that particular moment I just wanted a quick intro - how to make a function in CL, what flow control options do I have, how to print to the stdout. I found David B. Lamkins' "Successful Lisp" to be better for me. It was, mind you, after I poked with Scheme for a while and already had written my first dot-emacs file.
When they say that CL is "industrial LISP", they certainly are right, but this might mean that using it is a bit like driving a bulldozer. Built by space aliens. Very capable, One can shoot off one's feet without much warning. One can saw off one's head. Then one can safely return lost feet and heads to their proper places or even rearrange them a bit. Not for the faint hearted. Which is why maybe it is not the best LISP for starting your adventure.
Not that other LISPs will warn you about much. But one can learn to like it, the outcome is worth the effort.
(I have no idea, does it all sound like I am a masochist?)
HTH, YMMV