General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lawrence D’Oliveiro
Fireship
comments
Comments by "Lawrence D’Oliveiro" (@lawrencedoliveiro9104) on "Lisp in 100 Seconds" video.
Worth mentioning the fundamental schism between “LISP-1” (e.g. Scheme) and “LISP-2” (e.g. Common LISP, Emacs LISP) languages. The first kind put both function names and variable names into a common namespace, while the second kind put them into separate namespaces.
15
@qandak As I understand it, Autolisp manages to leave out the features that make LISP so powerful (e.g. macros, lexical binding), leaving only the mess of parentheses.
9
Emacs is one of those things you can start working with very quickly. Then as you get more familiar with it, you feel the need to add a little customization here and a little bit there. Looking at the Git repo containing my custom Emacs prefs, the first commit was made in 2007. Currently the main file is about 900 lines. I wouldn’t consider myself an Emacs expert, by any means.
5
I don’t like the traditional way of writing LISP code with “parenthesis pileup”. I find that putting openers and closers on matching indentation levels makes it easier to see the structure of the code. Example: (defun convert-to-region-codes (beg end) "converts alphabetic characters in the selection to “region indicator symbols”." (interactive "*r") (unless (use-region-p) (ding) (keyboard-quit) ) ; unless (let ( deactivate-mark (intext (delete-and-extract-region beg end)) c ) (dotimes (i (- end beg)) (setq c (elt intext i)) (cond ((and (>= c ?A) (<= c ?Z)) (setq c (+ (- c ?A) #x1F1E6)) ) ((and (>= c ?a) (<= c ?z)) (setq c (+ (- c ?a) #x1F1E6)) ) ) ; cond (insert-char c) ) ; dotimes ) ; let ) ; convert-to-region-codes
3
I used TECO, back in the early days. Just about every character you can type is a command. Emacs left its TECO roots and embraced LISP a long while ago. But it still bears some traces of those beginnings. For example, using CTRL/G as the cancel character: that came from TECO. No other software has that convention!
2
FORTH really only belongs in a museum. I don’t see any reason to use it any more. PostScript, on the other hand, had some interesting ideas. Give it proper local variables and lexical binding, maybe even module scoping, and you could have quite a useful programming language. Just dump the obsolete built-in graphics.
2
@zilog1 I know all that. I understand the difference between YOU FORTH LOVE IF HONK THEN and you PostScript love {honk} if But FORTH’s memory management is still from the Stone Age. Avoid.
2
In Computer Science we learn about “abstract syntax trees” (ASTs), which are an intermediate representation when parsing a programming language which just represents the structure of the code, getting rid of layout details. Think of LISP as a language that is already in AST form -- I think the term for this is “homoiconic”. Since language constructs can be directly represented in terms of data structures in the language itself, this makes all kinds of powerful manipulations possible. For example, have you ever tried to use “♯define” macros in C or similar? These macros work by string substitution, and that is notorious for being fiddly and troublesome, and prone to mysterious bugs. In LISP, on the other hand, the macro facility works at the syntax level. This lets you do many useful things very conveniently and with much less trouble.
2
Certainly the traditional “parenthesis pileup” way of writing LISP code just looks ugly to me. Here is how I write my code: (defun convert-to-region-codes (beg end) "converts alphabetic characters in the selection to “region indicator symbols”." (interactive "*r") (unless (use-region-p) (ding) (keyboard-quit) ) ; unless (let ( deactivate-mark (intext (delete-and-extract-region beg end)) c ) (dotimes (i (- end beg)) (setq c (elt intext i)) (cond ((and (>= c ?A) (<= c ?Z)) (setq c (+ (- c ?A) #x1F1E6)) ) ((and (>= c ?a) (<= c ?z)) (setq c (+ (- c ?a) #x1F1E6)) ) ) ; cond (insert-char c) ) ; dotimes ) ; let ) ; convert-to-region-codes
2
@maccsguitar You have to learn to treat comments as an essential part of the code, not some optional extra.
1
@rumfordc No, they are not “optional”, “extra” or “redundant”. They are vital.
1
@rumfordc That’s what I mean by “vital”. Imagine trying to get the program functional without understanding what it does. For non-trivial code, that can be come an impossible task.
1
@cmaxz817 One common headache with all these stack-based languages is keeping track of what’s on the operand stack at any moment. This is why, in my doodlings around a PostScript derivative, I added operators to manage additional operand stacks. So you temporarily create a new stack, with a known number of items transferred to it from the previous one, which is now temporarily inaccessible. Then when you have finished a calculation sequence, you expect to find a particular number of items remaining, which you transfer back to the previous stack, which becomes the current stack again, getting rid of this one.
1
They pretty much invented it.
1