On StackOverFlow, before I quit, I was building up a suite of elisp questions. I though this format provided an excellent way to learn and throw down some breadcrumbs.
Note on Unix/Mac, you can use Emacs as your scripting language: #!/usr/bin/emacs --script
What I am trying to do is make it possible to get people to start writing 'code that works' up to the point that they want to stop learning and start writing their own code.
If you know how a language/build setup works in general, then you can work out why in your particular case something isn't working.
If you literally can't read a languages syntax (and for most programmers Lisp is as unreadable as the Cyrillic script is to someone used to the Latin script) then 'do this and it will work' is key to a smooth learning process.
Once people have got over that, then they can take the training wheels off the bike themselves.
All they would need to do is add this to the beginning for every file "(require 'cl)".
The CL package is already bundled with Emacs, and a good chunk of emacs packages and libraries are written in it. It's not Common Lisp, just some syntatic sugar to make Elisp more like CL and every other mainstream language out there. IMO, your readers will have more difficulty understanding dynamic-scope than remembering to add a line. CL provides lexical scoping with lexical-let.
You need to stop thinking about 'what my readers will have difficultly understanding' and start thinking about 'what the author doesn't know'.
I know as much eLisp as is covered in the book so far - so I have no idea of the difference between lexical and dynamic scope in eLisp.
Doing a quick scan of the site-lisp on my 'proper' dev machine (ie not the Virtual Box image I am writing the book on) I find that the following (uncompiled) files require cl:
* mh-acros.el
* rst.el
* js2.el
* css-mode.el
* html-helper-mode.el
So it is clear that the convention "don't use cl" is being honoured in the breach for fairly standard bits of code - so as an idea it needs to be considered.
There is some lisp code printed out. I look at it. I have no idea what it is. What does a bracket mean? what does a single quote mean? what does a comma mean? How do I loop or iterate? What does a variable look like? What does a function look like?
If all you have ever programmed in is Fortran, Algol, Pascal, C++, Java, PHP, Python, Perl, Ruby and Erlang then Lisp looks like line noise/obsfucated Perl (delete as appropriate).
The fastest way to get familiar with Lisp syntax is to read _The Little Schemer_. Unlike other books people are suggesting, it's a quick read. It steps through the evaluation of Lisp code, building up from the absolute basics.
It uses Scheme, a different Lisp dialect, but for your purposes that doesn't matter. An earlier version ("The Little Lisper") used Common Lisp.
I understand totally. I had the great fortune to learn lisp after Fortran and Pascal and Pl/1, but before all the others.
lisp is a functional language (more or less) so recursion is preferred to iteration.
The beauty of lisp is that it's syntax and semantics are merged in some sense. A smart eight grader can learn scheme and be productive in an afternoon.
I don't mean to discourage you, we can always use new books, new approaches and so forth but I would recommend you go through the Chassells tutorial (reference above) that I mentioned is bundled in emacs and also look at the PLT scheme literature and/or Abelson and Sussman's SICP work as background research for your book.
I think elisp alone is a great way to learn both lisp and emacs, as well as a whole lot of computer science as well. Common Lisp is probably the most practical for the working programmer but elisp is ideal for working with emacs.
> A smart eight grader can learn scheme and be productive in an afternoon.
With all due respect "I hae ma doots" - show me such a beast as this eight grader. (as a non-American I don't even know what an eight grader is? a 14 year old, a 12 year old?)
> PLT scheme literature and/or Abelson and Sussman's SICP work
This is at the heart of the problem with Lisp in my mind. I am working on eLisp and I am getting advice to make it like Common Lisp (require 'cl) and read Scheme books.
I don't know what eLisp looks like.
I don't know how different the various dialects of Lisp are from each other.
The Chassels tutorial clearly helps the non-Lisper to write working eLisp in Emacs (and sections are referenced throughout all the existing lessons in Additional Reading) but adding more Lisp dialects into the mix at this stage isn't helping.
"With all due respect "I hae ma doots" - show me such a beast as this eight grader. (as a non-American I don't even know what an eight grader is? a 14 year old, a 12 year old?)"
I'm referring to the teach scheme[1] project of Felleisen et. al.
"I don't know what eLisp looks like.
I don't know how different the various dialects of Lisp are from each other."
I see, sorry, I misunderstood. So you're learning elisp by writing a book. Great idea, truly, I always found teaching a subject a good way to learn it better. Writing a book is also good for that. All the best and happy new year!
I only found out about it after I had started writing this one. I have never seen a physical copy of it.
I also think the fairly brutal way that the Learn X The Hard Way format forces you through typing in working code is a good way for people to learn how to 'read' a new/weird syntax <-- not meant derogatively, just strangely unfamiliar.
Great resolution, but I'm surprised by this. Type C-h i in most emacsen and you should see a great elisp tutorial as well as the full elisp manual. All you need is the space bar to read it.
1. Make it easier for people to comment on your text--- some sort of wiki perhaps?
2. Beginners forget, so telling them that you won't repeat information (key strokes to evaluate an expression) isn't going to help.
3. In the line 'The way in which you evaluate the expression determines where the output goes. Alos notice that the previous examples used integers like 1 and 2 and returned an integer value. This expression uses floating point numbers like 1.0 and returns a float as the result.
' Alos should be Also...
4. If you can get to a feature in the editor with key-strokes list them. If you can get there using the menu say so. If you can get there both ways mention that.
I would like to make it like PHP documentation where you can add comments directly to the HTML pages - but that means mastering the Sphinx Document Building system as well.
Note on Unix/Mac, you can use Emacs as your scripting language: #!/usr/bin/emacs --script
This should be a good start:
Hello World: http://stackoverflow.com/questions/2170528/writing-hello-wor...
CGI: http://stackoverflow.com/questions/1532311/cgi-programming-i...
AWK Example: http://stackoverflow.com/questions/2260294/awk-print-2-1-in-...
Extract URLs: http://stackoverflow.com/questions/1642184/extracting-urls-f...
Parse CSV/Gen HTML: http://stackoverflow.com/questions/1541682/lisp-script-to-pa...
Wrap Selection like Textmate: http://stackoverflow.com/questions/1558178/wrap-selection-in...
MySql (Unanswered): http://stackoverflow.com/questions/1532365/mysql-queries-fro...
Generate a Quiz: http://stackoverflow.com/questions/2264286/generating-a-quiz...
Open Browser: http://stackoverflow.com/questions/1532365/mysql-queries-fro...
Finally, I thought having the same questions answered in Common Lisp would be useful.
Generate a Quiz: http://stackoverflow.com/questions/2264267/generating-a-quiz...