Skip to content

Commit

Permalink
Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
tail-call committed Dec 12, 2024
1 parent b619ea2 commit d0921e6
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 23 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
28 changes: 21 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ <h1>(welcome :to tail-call.github.io)</h1>
</ul>

<ul>
<li>
<a href="https://ru.wikipedia.org/wiki/%D0%9D%D0%BE%D0%BC%D0%B5%D1%80%D0%B0_%D1%82%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%BE%D0%B2_%D1%8D%D0%BA%D1%81%D1%82%D1%80%D0%B5%D0%BD%D0%BD%D1%8B%D1%85_%D1%81%D0%BB%D1%83%D0%B6%D0%B1">Номера телефонов экстренных служб</a> | Wikipedia
<li>
<a href="https://parentheticallyspeaking.org/articles/write-a-book/">You can too write a book</a> | Parenthetically Speaking
<li>
Expand All @@ -26,14 +28,14 @@ <h1>(welcome :to tail-call.github.io)</h1>
<h2>\about{me}</h2>

<p>
My name is Maria. I'm a software developer and AI researcher. I'm an avid
My name is Maria. I'm a software developer and <abbr title="Artificial Intelligence">AI</abbr> researcher. I'm an avid
note taker and a digital gardening enthusiast.
</p>

<p>
And this is my digital garden! I happen to own a lot of them.
Recently <!-- 2024-12-04 --> I had an epiphany that I should try to keep some
amount of my notes in HTML format, for it shall swiftly outlive every other
amount of my notes in <abbr title="Hyper-Text Markup Language">HTML</abbr> format, for it shall swiftly outlive every other
technology I use now.
</p>

Expand All @@ -47,12 +49,12 @@ <h2>\about{me}</h2>
</p>

<p class="slide">
But who will leave reality of cesspit for their dreams?<br>
<abbr title="Shall that be you?">But who will leave reality of cesspit for their dreams?</abbr><br>
</p>

<code>
Two letter commands were common in UNIX because they were easy to type,
and single letter commands were reserved for the user to define.
Two letter commands were common in <abbr title="Uncle Never Installed X11">UNIX</abbr>
because they were easy to type, and single letter commands were reserved for the user to define.
<!--Not a quote, it's a slightly redacted note of mine-->
</code>

Expand All @@ -74,12 +76,16 @@ <h2>\about{me}</h2>

<ul>
<li> Scriptable in Lua (not Elisp or Vimscript!)
<li> Lua is the best language
<li> <a href="lua.html">Lua is the best language</a>
<li> I memorized Vim key bindings so well I can't use any other edytore animor
<li> So many edits you want to make are a series of <code>%s</code>-s
<li> Macros
<li> I also love <a href="https://vifm.info">vifm</a> a lot, which is a
two-pane directory editor with convenient (aka vi-like) key bindings, and
two-pane <select>
<option>directory editor</option>
<option>file manager</option>
<option>Midnight Commander clone</option>
</select> with convenient (aka vi-like) key bindings, and
so my vifm and nvim shell out into one another a lot
</ul>

Expand Down Expand Up @@ -260,3 +266,11 @@ <h2>my $academic_plan;</h2>
</tbody>
</table>
<div align=right><em>Table 1. My academic plan.</em></div>

<h2>How to reference a URL?</h2>

<p>
Unlike books, which may be torn, lost, given to another person without you ever remembering about it, URLs die in a different way: they stop opening. Or entirely different content is being put instead of what the URL once contained.

<p>
Despite that, we still want to reference URLs like we reference our books, in a nice list at the end of the text. This almost works well with books because many instances of a book are typically printed. For a URL, it is common to be served by a VM on a cheap VPS server.
134 changes: 134 additions & 0 deletions lua.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<meta charset="utf-8">
<title>Lua</title>
<style>@import url(style.css);</style>

<h1>Lua, the Programming Language</h1>

<style>
.moon {
font-size: 400%;
transform: rotate(10deg) translate(50px, 50px);
}

lua-word {
font-weight: bold;
font-family: monospace;
}

</style>

<div class="moon">&#x263d;</div>

<p>
Have you noticed the moon is a bit like a parenthesis?

<p>
Things of amazing beauty were invented by humans: first it was Lisp, then it
was Forth, and then it was Lua - if there were other good languages, please
let me know

<p align="center">
<table>
<thead>
<tr>
<th>Language</th>
<th>Year of Release</th>
<th>Keywords</th>
</tr>
</thead>
<tbody>
<tr>
<td>Lisp</td>
<td>1960</td>
<td>defun, cons, car, cdr, lambda, eval, cond</td>
</tr>
<tr>
<td>Forth</td>
<td>1970</td>
<td>:, dup, drop, pick, roll</td>
</tr>
<tr>
<td>Smalltalk</td>
<td>1972</td>
<td>new, yourself, super</td>
</tr>
<tr>
<td>Scheme</td>
<td>1975</td>
<td>define, call/cc, set!, define-syntax</td>
</tr>
<tr>
<td>Common Lisp</td>
<td>1984</td>
<td>defun, defmacro, defparameter, defclass, defpackage, loop</td>
</tr>
<tr>
<td>Python</td>
<td>1991</td>
<td>def, class, nonlocal, async, yield, import</td>
</tr>
<tr style="background: pink">
<td>Lua</td>
<td>1993</td>
<td>function, local</td>
</tr>
</tbody>
</table>
<em>Table 1. Various languages.</em>

<p>
The good thing about being a 1993 language is that you can be influenced by every other language that was released before that date. In Lua, I personally sense a great influence of every language mentioned in <em>Table 1</em>, and I like these influences

<p>
conf: __index, __add, __le, __mode -- __init__, __str__, __add__

<p>
conf: _G -- globals()

<p>
They say there's a man in the moon - if you look closely enough into moon's
surface, you will see a face. In case of Lua, the face you see in the moon
is of <strong><a href="https://en.wikipedia.org/wiki/Roberto_Ierusalimschy">Roberto Ierusalimski</a></strong> [Wikipedia]. When I say this, I always want to add "it's the
same guy who made D" but D was made by <a href="https://en.wikipedia.org/wiki/Andrei_Alexandrescu">Andrei Aleksandresku</a> [Wikipedia], an entirely
different person<sup><a href="#note1">1</a></sup>

<p class="slide" id="note1">
<sup>1</sup> No wonder I keep getting them confused, their last names both end with /sk[ui]$/

<p>
One thing that comes to mind first when thinking about Lua is that it begins
indexing its arrays (aka tables) with 1 as opposed to 0, the starting index
of choice of 99% other programming languages. Both are nice choices, one is
more intuitive when thinking about high-level problems, the other is more
intuitive when dealing with things like memory or anything with an "offset".
A truly bad choice would be using -1 or 2 as base index

<p>
The reason behind this is that Lua was indeed designed to be used by
non-programmers, who needed a very simple language to automate their daily
computations. It's a small niche, and we don't usually target it anymore when
developing software. We kind of collectively assume that programming is the
job of a programmer, and now that we have a lot of programmers, why would
<em>you</em> code instead of them?

<p>
Another instance of this is that every assignment to a free variable introduces
a global binding, visible across all modules. If you're a novice programmer,
this is a win for you because you don't have to wonder why your variable
suddenly became <lua-word>nil</lua-word>, and if you're an experienced
developer, you probably care about lexical scoping and should by default make
every variable you use with <lua-word>local</lua-word>. You also need to be
careful not to assign to undeclared variables, but your <abbr title="Integrated Development Environment">IDE</abbr>

<p>
Metatables are the continuation of theme "we're giving you one multi-purpose
tool instead of many single-purpose utilities" that table has begun. Metatables
are your meta-programming tool, and with meta-programming you may achieve object
oriented programming (OOP) and other good stuff. Lua doesn't have macros, but
metatables make it possible to introduce custom syntax to a degree. Personally
I recommend against going for the urge of rolling out Your Own Object System
because it's not a natural style for Lua: whatever you need an object system
for (inheritance, overriding behavior, polymorphism), there are other, more
straightforward ways to implement these. Lua isn't very like Smalltalk, it's
almost trying to be the opposite of Smalltalk while pursuing similar goals in
its design
52 changes: 36 additions & 16 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
:root {
--foreground: #413a7f;
--background: rgb(239 236 255);
}

html {
font-family: KaTeX_Main, Lucida Grande, Helvetica Neue, Helvetica, Arial, sans-serif;
background-color: rgb(239 236 255);
}

a {
color: #d7569c;
}
html {
font-family:
KaTeX_Main,
Lucida Grande,
Helvetica Neue,
Helvetica,
Arial,
sans-serif;

a:visited {
color: #413a7f;
background-color: var(--background);
}

body {
Expand All @@ -27,18 +28,37 @@ body {
max-width: 700px;
}

@media (min-width: 700px) {
body {
margin-top: 1rem;
margin-left: 3rem;
margin-right: 3rem;
}
}

a {
color: #d7569c;
}

a:visited {
color: #413a7f;
}

sup {
font-size: 50%;
}

p:target {
background: var(--background);
}

.slide {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
margin-left: 1rem;
margin-bottom: 2rem;
border-left: solid 1px var(--foreground);
padding-left: 1rem;
max-width: 650px;
}

@media (min-width: 700px) {
body {
margin-top: 1rem;
margin-left: 3rem;
margin-right: 3rem;
}
}

0 comments on commit d0921e6

Please sign in to comment.