Live data from Hacker News

The Land of Lisp

landoflisp.com

91–100 of 146 posts

Re: The Land of Lisp

#91

Earlier quoted context omitted.

Well I can do runtime checks just as easily in Clojure, but I'm really talking about compile time checks.

> Well I can do runtime checks just as easily in Clojure, but I'm really talking about compile time checks. Take a look at this: http://ahungry.com/blog/2015-07-10-Type-Safety-and-Lack-Ther... It shows you a 9-lines macro for CL, that allows you to declare types in a way resembling Haskell, and having the compiler do the static checks. Very nice. Another example is here: https://news.ycombinator.com/item?id=8598149

That's a neat example (the first one) but it's using compile time constants in the type check, which is not as impressive. You could write a similar macro in Clojure that does that.

Re: The Land of Lisp

#92
post #90

This book is destined to be a classic programming book, just as "The C programming language", "The Little Schemer" or "Operating systems: Design and implementation". I would really like to meet Conrad Barski and give him a great hug. And invite him a good beer. Be sure to read the comic that is on the bottom of the page!! Now, to be honest, a quicker or more practical introduction to Lisp would be the "Practical Comm…

I started my career hacking Common Lisp (Allegro CL), these days I do Clojure, among other things. That comic by Dr. Barski tears me up every time! Just to test, I went and read the comic again and I cried, again! I have met Dr. Barski personally at a Clojure conference many years ago and I still remember him as an extremely kind and knowledgeable person. Thank you for the Land of Lisp, Dr. Barski! Some day, we will…

>That comic by Dr. Barski tears me up every time! Just to test, I went and read the comic again and I cried, again!

I confess I also cried when I realized such a book existed.

It was like God telling me: "Don't be ashamed of being a nerd. You're unique and we love you."

Re: The Land of Lisp

#93

This book is destined to be a classic programming book, just as "The C programming language", "The Little Schemer" or "Operating systems: Design and implementation". I would really like to meet Conrad Barski and give him a great hug. And invite him a good beer. Be sure to read the comic that is on the bottom of the page!! Now, to be honest, a quicker or more practical introduction to Lisp would be the "Practical Comm…

Little Schemer is worth reading if only to see a different approach to teaching. I really hope I can find time to read LoL.

I wonder if the author made new chapters free..

Re: The Land of Lisp

#94

Earlier quoted context omitted.

> Well I can do runtime checks just as easily in Clojure, but I'm really talking about compile time checks. Take a look at this: http://ahungry.com/blog/2015-07-10-Type-Safety-and-Lack-Ther... It shows you a 9-lines macro for CL, that allows you to declare types in a way resembling Haskell, and having the compiler do the static checks. Very nice. Another example is here: https://news.ycombinator.com/item?id=8598149

That's a neat example (the first one) but it's using compile time constants in the type check, which is not as impressive. You could write a similar macro in Clojure that does that.

  (declaim (ftype (function (integer string) cons)
		  foo))
  (defun foo (a b)
    (list a b))


  (declaim (ftype (function (integer) cons)
		  bar))
  (defun bar (a) (foo a a))


  (declaim (ftype (function (integer) integer)
		  baz))
  (defun baz (a) (+ (foo a "b") 42))
The SBCL compiler:

in BAR: an argument of the wrong type.

  ; in: DEFUN BAR
  ;     (FOO A A)
  ; 
  ; note: deleting unreachable code
  ; 
  ; caught WARNING:
  ;   Derived type of A is
  ;     (VALUES INTEGER &OPTIONAL),
  ;   conflicting with its asserted type
  ;     STRING.
  ;   See also:
  ;     The SBCL Manual, Node "Handling of Types"

in BAZ: the wrong return type

  ; compiling (DECLAIM (FTYPE # ...))
  ; compiling (DEFUN BAZ ...)
  ; file: /private/tmp/test.lisp
  ; in: DEFUN BAZ
  ;     (+ (FOO A "b") 42)
  ; 
  ; note: deleting unreachable code
  ; 
  ; caught WARNING:
  ;   Derived type of (FOO A "b") is
  ;     (VALUES CONS &REST T),
  ;   conflicting with its asserted type
  ;     NUMBER.
  ;   See also:
  ;     The SBCL Manual, Node "Handling of Types"

Re: The Land of Lisp

#95

I'll get hammered for this, but there are better books. I still haven't figured out if this book is a vanity project written by a bored Doctor, or a sincere attempt to convey information. I do like the Period Table though. And maybe it's just me? I have the book on my shelf, and it's dusty. I do feel using a comic book format to convey technical information is the way to go. It should be used more often.

Care to share some details on which books you consider better and why? Thanks!

Re: The Land of Lisp

#97

When I discovered lisp several years ago, it was indeed the textbook moment of enlightenment that you've heard about. This book was a part of that introduction for me (along with Practical Common Lisp). After working in C-like languages, I had no idea that programming could work this way as in lisp, the idea of code and data being inseparable, I even had dreams at night about run-time data structures getting expresse…

I question the downsides you suggest.

There was a study done where they had two groups of people implement the same thing, one with a dynamic language, the other with its equivalent static variant.

What they found was that the people who used the dynamic language took 33% less time to complete the task. But what's interesting is students who were given the static typed variant all said they felt the type system helped them, and made them more productive.

Now, that study can be criticised in a lot of ways, but as it stands, it's still better then people's opinions.

I think it can feel like a drag sometimes in dynamic languages to figure out the type of things, and what structure the data comming into functions has, etc. But I suspect in practice, that feeling does not translate to lower productivity or higher defects.

Re: The Land of Lisp

#98

This book is destined to be a classic programming book, just as "The C programming language", "The Little Schemer" or "Operating systems: Design and implementation". I would really like to meet Conrad Barski and give him a great hug. And invite him a good beer. Be sure to read the comic that is on the bottom of the page!! Now, to be honest, a quicker or more practical introduction to Lisp would be the "Practical Comm…

I remember that glorious feeling :)

Re: The Land of Lisp

#99

When I discovered lisp several years ago, it was indeed the textbook moment of enlightenment that you've heard about. This book was a part of that introduction for me (along with Practical Common Lisp). After working in C-like languages, I had no idea that programming could work this way as in lisp, the idea of code and data being inseparable, I even had dreams at night about run-time data structures getting expresse…

> run-time contracts and things like Clojure.spec come about to help fill the void of static typing

If you look at clojure.spec as a replacement for a type system, you'll be frustrated. The focus is on expressiveness, not proof. It's quite a different beast.

The leverage comes from the fact specs are data, and therefore usable at runtime, which usually isn't possible due to type-erasure.

Not having a chasm between compile-time and runtime allows extending the language. You can run clojure.spec checks, or a full type system (like Typed Clojure), etc. The entire mindset is based on "there's only runtime".

The discomfort comes from comparing that to a language that has a canonical type system, and evaluates type definitions in what is essentially a separate runtime only available in the compiler. Apples, oranges.

Re: The Land of Lisp

#100

This book is destined to be a classic programming book, just as "The C programming language", "The Little Schemer" or "Operating systems: Design and implementation". I would really like to meet Conrad Barski and give him a great hug. And invite him a good beer. Be sure to read the comic that is on the bottom of the page!! Now, to be honest, a quicker or more practical introduction to Lisp would be the "Practical Comm…

Counterpoint comic: https://xkcd.com/224/
Post reply on HN