An interactive version of this article is available here: http://wordsandbuttons.online/learn_you_a_lisp_in_0_minutes.html But why? Learning a language you are not going to write in professionally is like visiting a country you are not going to move in to. It may be tiring, but it’s fun, educational and it makes you appreciate other cultures. And Lisp is particularly fascinating to learn because of its influence on modern programming. You might see traces of Lisp in the most unexpected technologies like or . WebAssembly GCC internal representation The only reason not to learn Lisp, or any other language, is the amount of effort it usually takes. But! It if you only want to know the very basics of Lisp, you wouldn’t have to spend any effort at all. But how? If you can read this article, then you should know English. And this also means that you know a bit of French as well. Words like “concept”, “culture”, “action”, “instinct”, “machine”, “science”, and many more are actually shared between two languages. Words like this are called “cognates”, and the word “cognate” is almost a cognate itself. This happens because of long lasting French influence on English language. And the same works with Lisp too. Its ideas and concepts are so widespread among modern languages then, if you have any substantial experience in programming, you automatically know some Lisp. So? I’ve made this test so you could prove yourself you know Lisp. As many languages and dialects belong to Lisp family I should specify that this test is based on . WeScheme The test starts from very simple things and gradually progresses into obscurity. It’s ok not to get all the answers right, some of them would only work for programmers with functional programming background. Amuse-toi! 1 What number would this evaluate to? (+ 2 2) 2 Is this **true** or **false** ? (= (+ 2 2) (* 2 2)) 3 Is it **‘a** , **‘b** or **‘c** ? ( ( ‘a ‘b ‘c)) first list 4 Would it print **Apples!** or **Oranges!** ? ( apples 5)( oranges 6)( (< apples oranges)( "Apples!")( "Oranges!")) define define if printf printf 5 What number would it be? ( ( x)(* 2 x)) define dbl ( 2) dbl 6 What number will this result to? ( ( x)( (< x 1)1(* x ( (- x 1))))) define fact if fact ( 3) fact 7 What would this function do to the list? ( ( xs)( ( xs)( )( ((middle ( xs))(others ( xs)))( ((left ( ( (x) (<= x middle)) others))(right ( ( (x) (> x middle)) others)))( ( left) ( middle ( right))))))) define qs if empty? list let first rest let filter lambda filter lambda append qs cons qs ( ( 4 5 6 1 2 3)) qs list That’s it. The answers are under the baguettes. By jules / stonesoup (bocadillos-3) [CC BY 2.0 ( )], via Wikimedia Commons. Well, I just needed something long to screen the answers, so why not baguettes? http://creativecommons.org/licenses/by/2.0 That’s just prefix notation for , so the answer is . 2+2 4 It is . . true 2+2 = 2*2 First element of list is . (a, b, c) **a** Apples is just a variable set to 5, and oranges set to 6. so it should print . 5<6 **Apples!** Function is defined to double the argument. Then it’s called with as an argument, so the answer is . dbl 2 **4** Function returns 1 for anything less than 1 and an argument multiplied to . So, , , and = . It is a factorial of 3 also known as "3!". fact x fact(x-1) fact(0) = 1 fact(1) = 1*1 fact(2) = 2*1*1 fact(3) = 3*2*1*1 6 This is a simple implementation. The list gets split into pieces: some middle element, the “left” list with all the other elements lower than or equal to middle, and the “right” list with all the other elements greater than middle. “Left” and “right” get quicksorted recursively until they’re done and the function then returns . So the list becomes sorted: . quicksort sorted left + middle + sorted right (4, 5, 6, 1, 2, 3) **(1, 2, 3, 4, 5, 6)** If you have read this far, congratulations! You now know you know Lisp! If you got five answers right, you would probably be able to write simple on . Gimp plugin configure Emacs If you got all the answers then you have a knack for functional programming. If you haven’t been working in functional language before, perhaps you should consider trying one. Now what? Of course this test covers the very basics of Lisp. It doesn’t even touch the meta-programming, which is arguably the mightiest Lisp feature. But learning a bit of Lisp is not the whole point. The test actually shows that you should not stop at this, but learn more are more languages that you are not going to use professionally. Consider this. If practicing with JavaScript, or Python, or C#, or whatever your primary language is made you unknowingly learn some Lisp, then shouldn’t it work the other way around as well? Eric Raymond once wrote: “Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.” But I don’t think Lisp is in any way magical. I think that learning any language enriches your experience. The more it’s different from what you do every day the better. The more you know — the more ideas you have when approaching any new task. That’s the whole point of linguistic tourism. If learning new languages, new concepts, and ideas makes you a better programmer, then it is not just a waste of time, but an investment in your professional career. N’est-ce pas?