CLTS: common lisp-the series

1. Abstract : V 0.0

An end to end series on common-lisp. From env setup, covering the basics until language native complexities (macros) and being able to adapt styles from other languages/specific domains (monads, static types, quantum computation etc): End with interop with other languages and how one can use lisp in common-place projects (dialects, transpilation, etc).

While definining the series structure, following a top down approach initially for deducing what all needs to be covered. Will fill in the crevices later on.

2. Comment stream

2.1. 0x2147 CLTS 0.1 : Representing Programs

2.1.1. What are programs really ?

  • a set of instructions that carry a computer from an initial to a final state
  • the initial and final state encompass the input and output respectively

2.1.2. What is source code then?

  • the computer understands binary code
  • intermediaries that map source code to corresponding binary code
  1. Instance: byte code
    import dis
    
    def add10(x:int) -> int:
      return x + 10
    
    print(dis.dis(add10))
    

2.1.3. Why the Parentheses?

  • infix to prefix
  • uniformity over promoting convenient habits
print(23 + 234 + 100)
(+ 23 234 100)
print(sum([23,234,100]))

2.1.4. The S-Expression

  • i.e symbolic expressions
    • ( operator … operands …)
  • natural segue into representing code as data (aka homoiconicity)
    • as nested lists :-> hence the name ..
      • LISt Processing

2.1.5. Pseudo-Code

:INPUT -> temperature in celcius
:OUTPUT -> temperature in fahrenheit

:BEGIN
 - multiply by 9
 - divide by 5
 - add 32
 - return as output
:END
def celc2fahr(celc):
  return (celc * 9) / 5 + 32

print(celc2fahr(0))
(defun celc2fahr (celc)
  (+ (/ (* celc 9)
      5)
     32))

(celc2fahr 0)

2.2. 0x2146

  • done with CLTS 0, beginning with CLTS 1
  • a high level discussion of what really communicating with the computer is all about.
  • familiarizing ourselves with the vocabulary
  • paradigms of computation : Turing machine and Lambda calculus (considerable inclusion)
    • start with basic math
  • talk about what a program really is: in terms of black boxes -> result in definite inputs and outputs.
    • chain and nest a bunch of smaller programs together and you get a more complicated program -> intro to abstractions
    • a basic program of converting temperature between different units.
  • once you define what a program does, you can start building a representation for them.
  • S - expressions -> infix, postfix and prefix notation

3. Content

3.1. Types

The series will be a splice between the different following phases - even at the video of a single level.

3.1.1. Meta Phase

  • about tools, and environment setup

3.1.2. Theoretical Phase

  • covers introduction and philosophical discussion on various tools and concepts

3.1.3. Practical Phase

  • a practical component that discusses the technical aspects of the language (separate from the Meta Phase)

3.2. Structure

3.2.1. Introduction and Env Setup

  • intro to common lisp : history
  • why consider a lisp? -> articles, etc.
  • env setup : recommend -> emacs, slime
    • alternatives : lem
  • helping build the third/fourth generation of lisp programmers
  • incentive on why learn lisp
  • refer compilation speed ups while being able to enjoy an interpreted langauge
  • from the perspective of a beginner

3.2.2. Basics

  • getting comfortable with the repl
  • variables, data types and basic operations
  • conditionals (special operators) (if, when, unless, cond, etc)
  • iteration and recursion
  • function
  • IO : format, read, yes-or-no-p -> quick coverage

3.2.3. Data Structures

  • the primitive glue in lisp: cons
    • good exercise : implement cons, car, cdr with functions
  • arrays, vectors, sequences
  • hash tables and associative arrays
  • def-struct and defer CLOS into the future

3.2.4. Object Oriented Programming

  • CLOS
  • all that goes along with the basic OOP

3.2.5. Error handling / debugging

  • condition system
  • debugging tools

3.2.6. Practical component and self-study

  • build something in lisp

3.2.7. Advanced Topics

  • macros
  • performance optimization
  • multithreading and concurrency
  • interop with other languages

3.2.8. Conclusion

  • final thoughts
  • books, resources, recommendations
Tags::yt:lisp: