79 karma · joined August 31, 2017
>>> def foo():
... import __main__
... a = __main__.a
... print(a)
...
>>> foo()
1Ctrl+F and try skipping to ";;;; The Basic Macros" section on that quick start page. Is that about the right level?
For many of the "popular" languages, a simple cheat sheet showing the equivalent control structures in a common language might be enough for a typical programmer to get a handle on it quickly. But Lisp is not an Algol-family language. It's different enough that such a document would fail to convey what makes it interesting. There's an inferential gap that must be bridged first, and it's difficult to do that quickly; a programmer mistakenly [expecting a short inferential distance][1] may not have the patience to "get it".
[1]: https://www.lesswrong.com/posts/HLqWn5LASfhhArZ7w/expecting-...
[1]: https://github.com/gilch/hissp
[2]: https://hissp.readthedocs.io/en/v0.3.0/tutorial.html#hello-w...
(/ (+ (- b)
(sqrt (- (* b b)
(* 4 (* a c))))
(* 2 a))
The trick is that a trail of any number of `)`'s should also end the line. Like any language, it takes some getting used to, but I find this tree structure perfectly readable now.Sure for the four-function calculator operations, operator precedence levels are a reasonable notation, but when you can define your own functions, and your programming language now needs a dozen precedence levels, it becomes hard to read. Lisp is completely unambiguous.
Its read language (Lissp) doesn't have an Emacs mode (yet), but its syntax is so close to traditional Lisps that lisp-mode pretty much works. No completions either. There is Lily https://github.com/mjobuda/damascus-tools/tree/main/lily, which proved Jedi works on Lissp, but it's never quite worked right.
Hissp leans more Lispy than Pythonic compared to Hy, but still prioritizes interop, so the object model is still Python's.
>>> a = 1
>>> def foo():
... a = globals()['a']
... print(a)
...
>>> foo()
1
Still yuck? * (let ((a 1))
(defun foo ()
(setq a 2))
(foo)
(print a))
2
2On the other hand, [Hissp][1] has a pretty good tutorial for anyone coming from a Python background.
>>> (lambda a, b=2:
... print(a, a, b, b, c:=3, c, *[[d,d] for d in [4]][0])
... )(1)
1 1 2 2 3 3 4 4
That's four different ways to get locals with no statements.Did you mean to say that lambda expressions can't contain statements? But no Python expressions can! But functional programming is all done with expressions anyway, to the point where functional languages don't even have statements, so what's the problem?
Why? Black Swans. Taleb says:
"If you know that you are vulnerable to prediction errors, and accept that most risk measures are flawed, then your strategy is to be as hyper-conservative and hyper-aggressive as you can be, instead of being mildly aggressive or conservative."
The "moderate middle" isn't as safe as you think it is, thus, it's not compensating you enough for the risk. The conservative side of the barbell will protect you from a negative black swan, and the aggressive side will expose you to positive ones.