-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
148 lines (92 loc) · 12.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!doctype html>
<html lang="en"> <head> <title>Learning Lisp!</title> <meta http-equiv="content-type" content="text/html;" charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="//fonts.googleapis.com/css?family=Vollkorn:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css" /> <link href="//fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css" /> <link href= "jacobis9000.github.io/css/style.css" rel="stylesheet" type="text/css" /> <link rel="alternate" href="jacobis9000.github.io/rss.xml" type="application/rss+xml" /> </head> <body> <div class="navigation"> <a href="jacobis9000.github.io">Learning Lisp!</a> | <a href="http://jacobis9000.github.io/">Home</a> | <a href="http://github.com/jacobis9000">Code</a> </div> <div id="content"> <h1 class="title">Recent Content</h1> <div class="article-meta"> <a class="article-title" href="jacobis9000.github.io/posts/2024-08-08.html">2024-08-08</a> <div class="date"> posted on 2024-08-08 13:17:18</div> <div class="article"><!-- **** your post here (remove this line) **** -->
<!-- format: could be 'html' (for raw html) or 'md' (for markdown). -->
<h1>Setting up your Lisp IDE</h1>
<p>This is a guide to setting up your LISP IDE using Emacs as your editor, SBCL as your compiler, slime as your REPL/IDE, Quicklisp as your package manager and Ultralisp as your package manager distribution, which has all the latest releases.</p>
<p>It is drawn from various guides, but the main one is at <a href="https://lisp-lang.org/learn/getting-started/" >Lisp-Lang.org</a> and this guide will get you going without Ultralisp for the latest releases of packages, however Ultralisp is useful if for example you're interested in Web or GUI development and want the latest version of the CLOG Builder IDE, which is only available through Ultralisp. For more on CLOG and some great Lisp guides: <a href="https://github.com/rabibotton/clog" >CLOG</a></p>
<p>While this is a guide for Ubuntu, it is similar on Mac and other UNIX flavours except your package manager may be different, e.g. homebrew on MacOS.</p>
<p>The first step is to install SBCL, the high-performance Lisp compiler, which is very simple:</p>
<blockquote>
<p><code>sudo apt install sbcl</code></p>
</blockquote>
<p>Next we install Quicklisp, the Package Manager, placing the downloaded installation file in <code>/tmp/ql.lisp</code> and then using SBCL to install:</p>
<blockquote>
<p><code>curl -o /tmp/ql.lisp http://beta.quicklisp.org/quicklisp.lisp</code></p>
</blockquote>
<p>Then we use SBCL to install Quicklisp. My instructions here differ from lisp-lang.org because I find it easier to install Quicklisp from within SBCL:</p>
<p>First:</p>
<blockquote>
<p><code>sbcl --no-sysinit --no-userinit --load /tmp/ql.lisp</code></p>
</blockquote>
<p>Then press return. Then you will be inside SBCL, and will receive some instructions. Enter this command, which is in Common Lisp code, into SBCL to install Quicklisp into the ~/.quicklisp directory:</p>
<blockquote>
<p><code>(quicklisp-quick-start:install :path "~/.quicklisp")</code></p>
</blockquote>
<p>Once done, there is one more command to run, to add necessary lines to your SBCL init file:</p>
<blockquote>
<p><code>(ql:add-to-init-file)</code></p>
</blockquote>
<p>And then, to exit SBCL:</p>
<blockquote>
<p><code>(exit)</code></p>
</blockquote>
<p>You should now be back at your bash prompt. The next step is to install Emacs with the following command:</p>
<blockquote>
<p><code>sudo apt install emacs</code></p>
</blockquote>
<p>After installing, from your terminal run:</p>
<blockquote>
<p><code>emacs</code></p>
</blockquote>
<p>And the GUI Emacs editor should pop up. (At this point, you can customise Emacs if you like, go to <code>Options > Customize Emacs</code> and select your theme. I like tango-dark. Then at the top of that page, <code>Save Theme Settings</code>, exit Emacs, and your theme should be saved.)</p>
<p>Exit Emacs and return to your bash prompt. Now we need to install SLIME. SLIME turns Emacs into an IDE, with a live REPL into which you can plug code, and have the Lisp image return the evaluated results. This is very simple:</p>
<blockquote>
<p><code>sbcl --eval "(ql:quickload :quicklisp-slime-helper)" --quit</code></p>
</blockquote>
<p>Then, add this to <code>~/.emacs.d/init.el</code> (you may instead find you have: <code>~/.emacs</code> in which case the same applies.) This will create the file "slime-helper.el" in your ~/.quicklisp directory which will install the SLIME REPL and turn Emacs into an IDE.</p>
<blockquote>
<p><code>(load (expand-file-name "~/.quicklisp/slime-helper.el"))</code></p>
<p><code>(setq inferior-lisp-program "sbcl")</code></p>
</blockquote>
<p>Now run Emacs to test. In Emacs terminology, a capital M stands for the Meta key, which is usually the Alt key, and a capital C stands for Control, and is usually the CTRL key. So if we want you to type <code>Alt-X</code> we will say <code>M-x</code>. So now type into Emacs:</p>
<blockquote>
<p><code>M-x slime</code></p>
</blockquote>
<p>The SLIME REPL should open in the bottom pane of Emacs. At this point, you are set up and good to go, and can begin entering code into the REPL for evaluation, or download Quicklisp packages via <code>(ql:quickload :package)</code>. More information at: <a href="https://www.quicklisp.org/beta/" >Quicklisp Beta</a></p>
<p>However, we want the most up-to-date packages! So we will install Ultralisp, a distribution for Quicklisp Package Manager with more up-to-date packages.</p>
<p>In the SLIME REPL type:</p>
<blockquote>
<p><code>(ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil)</code></p>
</blockquote>
<p>This may be all you need to do. However if you encounter issues installing packages (such as package installations hanging on an error) then this will resolve it. Remember slime-helper.el file we installed earlier? Go to <code>~/.quicklisp/</code> and edit <code>slime-helper.el</code>. Under the comments (noted by ;;;;) where it introduces the file, should be these two lines:</p>
<blockquote>
<p><code>(unless (boundp 'quicklisp-slime-helper-dist)</code></p>
<blockquote>
<p><code>(setq quicklisp-slime-helper-dist "quicklisp"))</code></p>
</blockquote>
</blockquote>
<p>Edit the second line so that "quicklisp" now reads "ultralisp" like so:</p>
<blockquote>
<p><code>(setq quicklisp-slime-helper-dist "ultralisp"))</code></p>
</blockquote>
<p>And save the file. (Type <code>C-x s</code> if you're editing in Emacs.) Now restart Emacs and SLIME, and download your package.</p>
<p>I hope you found this guide useful. If you have any issues setting up your Lisp IDE, the folks at the Lisp Discord, Lisp IRC, or r/Lisp will be happy to help. Check out the communities at <a href="https://lisp-lang.org/community/" >Lisp-Lang Communities</a></p>
<p>Thanks for reading, and happy hacking!</p>
</div> </div><div class="article-meta"> <a class="article-title" href="jacobis9000.github.io/posts/2024-08-05.html">2024-08-05</a> <div class="date"> posted on 2024-08-05 14:53:44</div> <div class="article"><!-- **** your post here (remove this line) **** -->
<!-- format: could be 'html' (for raw html) or 'md' (for markdown). -->
<h1>Learning Lisp: A New Programmer's Perspective</h1>
<blockquote>
<p>"Each atom of that stone, each mineral flake of that night-filled mountain,
in itself, forms a world. The struggle itself toward the heights is enough
to fill a man's heart. One must imagine Sisyphus happy." -- Albert Camus</p>
</blockquote>
<p>This quote of Albert Camus from his work on the absurdity of existence expresses something of my journey with Common Lisp. Common Lisp is absurd. It is an ancient language by the standards of programming, yet more modern than anything available in the lineage of C. It is a simple language in some respects which can become infinitely more complex, because it is infinitely extensible and modifiable to your needs. It has taken me two years of (on-and-off) learning Lisp to realise something about Lisp: it's not a language, it's a meta-language. It can become any language you like, and it can enable any paradigm, or combinations of paradigms you like. But what was it that Camus captured of my journey?</p>
<p>My friends think I am ridiculous, in that I chose to learn to program with no purpose or aim in mind, no end-goal, no programming career I coveted nor anything, really, outside of the challenge itself. This is what Camus means when he says we must imagine Sisyphus happy. Sisyphus, who must push the boulder to the top of the mount only to have it fall again, finds purpose in nothing more than his struggle. That's me!</p>
<p>So I began with CS50x the programming course by Harvard, and learnt C and Python with varying degrees of success. I preferred C to Python. In fact, I struggled with Python so much, because it is determined to force you to think in a certain way, and I was unwilling to bend to its will. And also: whitespace. And also: overloaded operators. And also: well, I just didn't like everything about it. It seemed no improvement on C and much worse really, and I couldn't believe that it was touted as a "modern" and "accessible" language. Python wasn't for me, at that time, anyway.</p>
<p>It's maybe because I grew up coding in MUSHcode. Not many people have heard of MUSHcode, but it's a programming language designed for text-based programming games called MUSHes, which stands for Multi-User Shared Hallucinations. Our MUSH was graphical, though, with 16-bit IBM CP437 Extended Character Set graphics. Really, it pushed the envelope of what a MUSH is capable of doing, and I hold that it is the best MUSH ever made. Now MUSHcode has been, by some, compared to Lisp, and in some ways the comparison holds. Like Lisp, data is usually a list (but the form the list takes is a string, because of course, it's a language for text-based games.) There's functions like <strong>dolist</strong>. You nest functions, nest and nest and nest. And there's brackets (parentheses.) Lots and lots of brackets. Round brackets and square brackets too.</p>
<p>So brackets didn't intimidate me.</p>
<p>It was on the basis that Lisp was similar to MUSHcode that I decided to try Lisp. Lisp was a revelation, coming from C and Python. It worked like I expected a programming language to work. It was natural, intuitive, sensible and sane. It was a dream coming from C and Python. Everything in Lisp has a return value, and code is data and data is code. So you plug functions into functions, and get results! Just like MUSHcode, but a real programming language (sorry MUSHcode.)</p>
<p>So suddenly my Sisyphean struggle was not so much a struggle, but a joyful journey. Due to the vagaries of life I wasn't able to study Lisp constantly, work, family, etc. got in the way, and I have a lot of hobbies, too. But when I did I just had FUN! The REPL is an instant-feedback-loop, you test your code function by function, on the fly. There's no compiling, failing, trawling through pages of code. There's no confusion and misery for hours. I don't even know the full power of the debugger and usually just "Abort" but I find debugging in Lisp, compared to any other language I've tried, a breeze.</p>
<p>Lisp is just fun, but it is also consistent and makes sense. I can't explain why here. I'm no expert, and there's better people for that, but if you haven't tried it, try Lisp: it might just change your life.</p>
<p>So I'll upload to this blog bits of Lisp I find interesting, or stuff I'm doing, or my thoughts about Lisp or programming generally. If you're interested in listening to the half-baked theories of a perpetual n00b, welcome to my blog :)</p>
</div> </div> <div id="relative-nav"> </div> <div id="tagsoup"> <p>This blog covers <a href="jacobis9000.github.io/tag/lisp.html">lisp</a> </div> <div id="monthsoup"> <p>View content from <a href="jacobis9000.github.io/date/2024-08.html">2024-08</a> </div> </div> <div class="fineprint"> <hr> Unless otherwise credited all material <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"> <img alt="Creative Commons License" style="border-width:0" src="jacobis9000.github.io/css/cc-by-sa.png" /> </a> by Joseph Ashford <a id="coleslaw-logo" href="https://github.com/redline6561/coleslaw"> <img src="jacobis9000.github.io/css/logo_small.jpg" alt="Coleslaw logo" /> </a> </div> </body> </html>