Just a nitpick, but I find the code part hard to read. Not sure if it is the colors or what. You might get some other feedback on it. Good luck!
It's just the language. Everything looks the same.
Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
41–50 of 110 posts
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#42It is especially good to see a complete caveman2 application developed in the book.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#43Earlier quoted context omitted.
I missed it ...
It is interesting to see people call an image a "cover" and a website a book even when the said cover actually never covers anything nor there is a book in there because a website. Digital books are so broken!
If you scan a dead tree book to PDF, and you include an image of the outside, that's still called a cover; PDF isn't broken.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#44Earlier quoted context omitted.
It's just the language. Everything looks the same.
No, I'm use to reading Lisp. Something else, but I'm not a designer and can't quite put my finger on it.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#45Can you include a good description of reading macros? I'm still looking for good explanation with examples of their power.
I found them useful when I looked at clojure and saw their shorthand syntax for lambdas where #(* % %) is a lambda that takes one argument and squares it. You can get some tidy things that are similar with regular macros but to make it actually equivalent your need to hook into the reader..and that's what reader macros are for. So within the hour I had something that let me write λ(* _ _) The best bit though, is that…
You mean ... programming the programming language?
> I can package this up ...
Not really; it will clash with someone else's use of λ. Read macros do not "package" particularly well. (Racketlang has a good solution for this: you put a #lang whatever directive at the top of a file and then the rest of the file uses the special syntax associated with that lang name).
It's very easy to overestimate the usefulness of read syntax.
This feature of Common Lisp is used far less than newcomers might imagine, though there are some famous examples of it. If you randomly sample Lisp code, you are much more likely to find a macro than a read macro.
> So within the hour I had something that let me write λ( _ _)*
Do you plan to type "lambda" with args enough times to eventually that hour of your life back? Ha.
Useful syntax for writing anonymous functions can be had, without relying on read macros at all.
cl-op: https://code.google.com/archive/p/cl-op/
Note how if we take λ(* _ _) and then just move the parenthesis over the Greek symbol, we get (λ * _ _). This saves almost the same amount of typing. If your Lisp recognizes λ as a symbol token, then all you have to do now is write a regular macro. Basically, just get the cl-op package and then set up λ as an alias for op: (defmacro λ (&rest args) `(op ,@args)).
In TXR Lisp, I implemented a more powerful op which has numbered arguments, and an escape syntax for inner ops to refer to outer ops.
Y combinator with TXR Lisp op:
;; The Y combinator:
(defun y (f)
[(op @1 @1)
(op f (op [@@1 @@1]))])
;; The Y-combinator-based factorial:
(defun fac (f)
(do if (zerop @1)
1
(* @1 [f (- @1 1)])))
;; Test:
(format t "~s\n" [[y fac] 4])
Combinators return us to your topic of writing a function which squares its argument. Instead of a condensed lambda notation like (op * _ _) for doing this with syntax, we can have a combinator, like (dup #'). This is nicer in a
Lisp-1 language where we can just do (dup ). Dup takes its argument, which is a two-argument function, and returns a one-argument function which calls that function with two copies of the argument: (defun dup (fun)
(lambda (arg) (funcall fun arg arg)))
(funcall (dup #'*) 2) -> 4
(mapcar (dup #'*) '(1 2 3)) -> (1 4 9)Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#46Earlier quoted context omitted.
+1. Kenny Tilton's blog is also great for that kind of thing. "You know Lisp is the perfect language precisely because it lost its momentum (died) and lives on. Other languages need their Next Big Thing momentum." http://smuglispweeny.blogspot.com/2013/08/wow-even-lispers-h...
I think the journey of a Lisper inevitably ends up with realizing that Common Lisp is not an acceptable Lisp. Then you start searching for an acceptable Lisp. You look at Tcl, at Prolog, Io, Rebol, and Icon; you learn Shen, try Scheme and Racket, appreciate Smalltalk and Self and Slate, wrap your head around Forth and Joy and Factor… and the whole time you write Common Lisp. Because there is no acceptable Lisp.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#47Ask me how long I spent banging my head against the wall trying to get OpenGL working in CMUCL with Alien. Jesus jumping-jack Christ. I can only hope things have improved in the past 12 years or so. But I highly doubt it.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#48or you realize Perl, Ruby, Python give you everything good from Lisp anyway with an environment and packages that can talk to the real world, and that macros and metaprogramming are massively overrated and a danger in almost any hands that touch those features. Ask me how long I spent banging my head against the wall trying to get OpenGL working in CMUCL with Alien. Jesus jumping-jack Christ. I can only hope things h…
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#49Earlier quoted context omitted.
No, I'm use to reading Lisp. Something else, but I'm not a designer and can't quite put my finger on it.
Given your username alone, I'm inclined to believe that you are, in fact, used to reading Lisp.
If it's written in a functional style it becomes even easier: you don't have to hold any state in your head.
Re: Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
#50Earlier quoted context omitted.
It is interesting to see people call an image a "cover" and a website a book even when the said cover actually never covers anything nor there is a book in there because a website. Digital books are so broken!
It's assumed that these deliverables will closely correspond to the printed ones. If you scan a dead tree book to PDF, and you include an image of the outside, that's still called a cover; PDF isn't broken.
If that isn't broken then what is?