HNHacker News
TopNewBestAskShowJobs

flavio81

2,368 karma · joined May 18, 2017

"Informatics" engineer (a combination of SE + CE + CS).
submissionscomments
flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
See my reply above: https://news.ycombinator.com/item?id=25451321
flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
See my reply: https://news.ycombinator.com/item?id=25451321
flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
What i'm talking is about the following:

- Able to easily modify (and recompile) a function while your code is running

- Able to redefine a class and then change existing instances so they use the new class definition

- Able to sabe the complete running state of the system (the "image" of the system, including state of all variables, data, loaded libraries, compiled functions, etc) into a file so it can be restarted later, just like Smalltalk does.

- Able to inspect any stack frame at will and to restart execution from any chosen stack frame

These are just a few of the feature that Common Lisp has and that are part of what an "interactive language" is. Common Lisp brings all these features, they work seamlessly, without any sweat, working reliably and efficiently.

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
Yes, "Why do you want to learn Lisp?" is a good question.

If the author wants to use Lisp because he/she thinks metaprogramming is interesting, or has read about the benefits of interactive programming, Common Lisp is the choice here.

If the author wants to use Lisp as a way to get a deeper understanding of important computer science topics, I think Scheme is the best choice and with this, following the SICP book.

If the author is interested specifically in functional programming and wants to get easy employment doing it, he/she should take a look at Clojure, Ocaml, and F#.

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
Yes, "Why do you want to learn Lisp?" is a good question.

If the author wants to use Lisp because he/she thinks metaprogramming is interesting, or has read about interact

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
>Is there a good argument against Clojure in this case?

I use Common Lisp and my main argument will be that Clojure isn't an "interactive programming" language like Common Lisp, Smalltalk (and Pharo, Squeak, Scratch) are. And, for me, this is removing one of the main, core advantages of Lisp.

Dispensing with the interactive programming features is, IMO, a step backwards in the state-of-the-art. Common Lisp ADDED all the improvements in the state of the art: Interactive programming from Smalltalk, lexical scoping from Scheme, various high performance/low level features from StarLisp and ZetaLisp, a very powerful OOP system, etc. And then, thanks to it being highly extensive, almost any feature can be added to it.

Clojure features like threading macros, immutable seqences, software transactional memory, and others, are already available in Common Lisp by just importing (loading) the respective library.

One of Clojure's main advantage is to be able to call Java libraries. But, surprise, you can do this in Common Lisp too, easily, by using the Armed Bear Common Lisp (ABCL) implementation. Which runs on the JVM too and makes the process of calling Java libs really, really easy. I have made a working example here, calling all the Swing UI library (java) from lisp:

https://github.com/defunkydrummer/abcl-jazz

It's true that Clojure has more widespread adoption in the industry and more libraries. However the library ecosystem on Common Lisp is decent.

>and you can get actual work done in it which is an advantage over some of the other options

This implies you can't do "actual work" in, for example, Common lisp. Which is not true, since there are companies that, in this very moment, are doing well paid, critical commercial work using Common Lisp.

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
>And found them to be very hostile.

I started 4 years ago. They are very helpful and friendly.

Just approach them with a genuine interest.

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
>Is it possible to build web apps in common lisp or any lisp? Any frameworks available?

Yes, many.

>Is it possible to build multithreaded apps that use multiple CPU cores for performance? What is used? POSIX threads?

Yes, threads, there's many libraries also for channels, software transactional memory, etc.

flavio81··on Ask HN: I want to start learning Lisp. Where do I begin?
>I use VS Code and Vim. Are they suitable for learning Lisp?

Better install Portacle, that's the only thing you need to install to edit, compile, and debug Common Lisp code.

Then you can learn by reading a good book like a "Gentle introduction to Symbolic Computation" or "Practical Common Lisp".

flavio81··on Eslisp – An S-expression syntax for ECMAScript/JavaScript, with Lisp-like macros
>Someone just needs to write tslisp that converts the TypeScript AST into s-expressions...

Well, this is actually a very good idea!

flavio81··on Eslisp – An S-expression syntax for ECMAScript/JavaScript, with Lisp-like macros
>80% of Common Lisp.

So, does it include bit-arrays, custom hash tables, multimethods, method combinations, the condition-restarts signalling system, ability to place items on the stack instead of on the garbage collector, type declarations that enable speed optimizations, saving the running state to disk, and upgrading the instances of a class to a new class?

I don't want to be smug, but 80% is a bold claim. Again, I think Eslisp is useful and maybe i'll try to introduce it to my team (they're all JS/TS developers) to see if they get the GATEWAY DRUG to Lisp.

flavio81··on Eslisp – An S-expression syntax for ECMAScript/JavaScript, with Lisp-like macros
> slow implementation of half of Common Lisp." Now with more JavaScript.

Yes, but Eslisp doesn't even implement 10% of Common Lisp...

Not that eslisp isn't useful. I think it's useful!!

flavio81··on Eslisp – An S-expression syntax for ECMAScript/JavaScript, with Lisp-like macros
>Is the implication here that people build on top of ecosystems because they're incapable of implementing things themselves in plain JS, and that lisp will make them capable?

Not exactly, but Lisp (specifically Common Lisp but also other lisps) will make far easier to implement whatever is missing thanks to the various features that enable very quick development, quicker than JS or Python. And interfacing with C code is also easy too. Interfacing with Java libs, even easier (using Armed Bear Common Lisp.)

flavio81··on An Intuition for Lisp Syntax
>Common Lisp isn't typed

It is heavily typed. Very strongly typed for the most part (except numbers). So typed that it won't accept a "character vector" in the place of a string.

But type checking is mostly at runtime, not at compile-time.

The good part is that you can edit your program at runtime and restart it at the exact point the error happened, very easily.

flavio81··on An Intuition for Lisp Syntax
>Hacker Robert Morris later declared a corollary, which clarifies the set of "sufficiently complicated" programs to which the rule applies "...including Common Lisp."

This is referring to CL implementations that depend heavily on C.

Many CL implementations now are almost 100% Lisp code.

flavio81··on An Intuition for Lisp Syntax
> It should be possible for tooling to just show you the expansion of any given macro invocation. In fact, when I used Clojure a decade ago, there was an Emacs command that would expand the macro invocation under your cursor, so you could see what code was actually being generated.

Exactly. On common lisp, for example, it's just a keypress, and it has a "macro stepper" so it shows the first expansion possible, then the second expansion, and so on and so on... until you end up with compiler primitives!

flavio81··on An Intuition for Lisp Syntax
>in general, you can't know what the program will do until you run it

It needs to be added that in Common Lisp, once the program is running you can do everything with it while it's running: Inspect the stack frames, change variable values, rewrite/recomiple/update functions, update class definitions, update objects to said new class definitions, save the current program state to disk,etc.

So it's programming that is geared to RUNNING the program and modifying it while its running.

flavio81··on Running Lisp in Production (2015)
>Could you give me an example of a real-world software engineering task which takes “weeks” in Python and minutes in Lisp?

Not "weeks vs hours" but let me offer my personal experience. I already had around 3 years of professional experience in Python and about the same in Common Lisp.

Last year I had to create a small utility to help some document scanning process, this included doing some OCR. I had the choice to do this in Lisp or Python or whatever language (I also could as well have written the stuff in Java, C#, C, JS, etc.)

Initially I thought "ok, i have good tesseract binding and PDF output libs in Python, where as the Lisp bindings look unmaintained" so i chose Python.

Well, back into Python's antiquated way of working: No compiler-time checking of anything, and, even worse, upon finding an error, there was no way of correcting the offending function and restarting program execution at that point (restarting a stack frame). No sir, I had to run my whole program again (this was an interaction heavy program) to test it again.

So MANY hours were lost in just having to restart the program again and do all the clicks needed to bring back the program to a specific state.

Where with Common Lisp those hours would be reduced to zero, since I can modify the program while it's running and I can always inspect all stack frames and restart them at will. Not to mention other benefits in terms of being able to write code that is way higher in abstraction level. Not to mention I can actually SAVE the current program's state to disk and resume it back at a later date.

And not to mention that the Lisp program would probably had executed 20 to 30 times faster as well.

So far, that's the last time I chose to use Python for non-trivial tasks.

flavio81··on Ask HN: Production Lisp in 2020?
I've used Lisp for a production system I delivered one year ago. I used CCL as an implementation and had a lot of success.

Here i'll cover your points:

> poor ecosystem of libraries - few gems, most other half-baked

I'd say the ecosystem is high-quality. There are relatively few libraries (around 2000+) compared to other ecosystem, but on the other hand most of them are either interesting, or unique (wouldn't exist in languages that lack certain features), or really well-written. Or many of those qualities at the same time.

In the absolute sense, there are enough libraries, IMO.

If you need something that isn't available, you have at least three options:

1. Bind to a C library; for this, Common Lisp has many facilities/libs for this, some of them make this task rather easy.

2. Same as (1) but Use ECL (Embeddable Common Lisp) for integrating a C program with a Lisp program as a whole, easily calling C from Lisp and Lisp from C, etc.

3. Use the java ecosystem and use the Armed Bear Common Lisp (ABCL) implementation. This implementation makes calling java libs a piece of cake, basically you call a java method with just one line of code. Or instance a class with just one line of code, etc. Really easy.

> poor community coordination

That's a bit meaningless. There are really good quality books and resources, i think that's what counts.

> Dependency management limitations with quicklisp

Quite the opposite. Quicklisp is awesome, better than PIP or NPM. It "just works".

> And some specific red flags like:

> poor support for json[6]

The opposite, many libs for JSON. The one I use, I like a lot.

> poor support for async

What does this mean? You can use cl-async, but i wonder what would be the benefit when in CL you have actual threads and great libraries for concurrency like lparallel (which introduces parallel processing constructs) or chanL (which gives you an easy to use channel implementation).

Cl-async allows you to leverage the whole power of libuv (just like Node does), but why? I'd rather use threads.

> have to restart the server every 20 days because of some memory leak [3]

Never heard about such things.

Perhaps you are confusing the "condition - restarts system" (which is the Lisp exception handling system) with having to restart something?

> hack to tune GC [5]

The URL you cite says "We had to tune the generation sizes".

Any respecting developer who wants to release a high performance production quality service NEEDS to tune the GC. Tune the GC is not a "hack", is just configuration parameters. Ask any Java developer who has had to "tune" the JVM for best performance.

By the way, everybody raves about Golang but it has a GC system that is comparatively outdated to the ones in most Lisp implementations (or the JVM). For example CCL has a very good generational garbage collection.

flavio81··on Ask HN: Production Lisp in 2020?
>I have noticed that deployment and compilation part of lisp isn't talked about often.

Because it's trivial.

Compilation is almost implicit, when loading a file.

Creating an executable is only one line of code.

flavio81··on Ask HN: Production Lisp in 2020?
>The post [1] (though old) - hints at no good libs for json

That's his opinion. We have a lot of JSON libs, maybe too many. I use "jonathan" and i'm happy with it.

EDIT: He wrote: "JSON support in Common Lisp is a god damn mess. There are an absurd number of JSON libraries and I don't really like any of them."

He doesn't like any of them, but I do like more than one.

flavio81··on Ask HN: Production Lisp in 2020?
>From what I read it took a whole summer to write in lisp and the rewrite in python took a weekend.

And one guy in comp.lang.lisp wrote a working Reddit 1.0 clone in Lisp in 4 hours:

https://groups.google.com/d/msg/comp.lang.lisp/9WD9-yEaqMs/H...

flavio81··on Ask HN: Production Lisp in 2020?
> and stuck with Common Lisp's woeful hash table interface and the loop macro keywords

You are not stuck with anything in Common Lisp.

Instead of loop you have lots of options, from the built-in constructs (do, dolist, map...) to very powerful libraries like SERIES and ITERATE.

You are not stuck with the default hash table interface either. Many libraries for data structure are available, you just pick the one that suits you best.

>And then Clojure implemented Map literals and - what do you know - Clojure still has Lisp Macros!

Most of those Clojure features are already available in CL through the use of libraries. Even the ability to easily call Java libraries, by using the Armed Bear Common Lisp implementation.

flavio81··on Ask HN: Production Lisp in 2020?
>I think Reddit's decision to move from Common Lisp

That original Reddit system was very simple, yet the Lisp source code was of poor quality (it is currently available on the web). When it was released, the lispers at comp.lang.lisp said they could write a clone in a few days. One of them did it in about 2 or 3 hours (true story).

So it wasn't good code. Moreover they, for some strange reason, chose to develop using a different implementation than the one in the server, and things like that.

Then Reddit got a famous name recommended by PG, who was a Python expert. So he rewrote the thing in Python and obviously, being a Python expert, did a good job.

flavio81··on Janet: a lightweight, expressive and modern Lisp
Or, since Janet is a bytecode interpreter with a download size of <2MB, there's CLISP which also fits that criteria, while providing the full power of Common Lisp and a nice FFI with C.
flavio81··on Janet: a lightweight, expressive and modern Lisp
>Does anyone have pointers to books or websites to learn 'real-world' LISP programming?

https://lisp-lang.org/learn/getting-started/

You can start here to set up your IDE and then read the "Practical Common Lisp" book.

flavio81··on Janet: a lightweight, expressive and modern Lisp
More precisely, Lisp

... without cons,

without arbitrary precision integers, fixed precision integers, rationals and complex numbers,

without image-based development,

without the conditions-restart system,

without CLOS,

etc.

It's interesting to note, since Janet is a bytecode interpreter, that we've have had a full Common Lisp implementation for years (CLISP) that provides all the features above (plus many many others) with a download size (1.8MB) just slightly bigge than to Janet's.

flavio81··on Janet: a lightweight, expressive and modern Lisp
Golang's garbage collection system isn't just NOT state-of-the-art; it brings you back to the 1970s. A big pain point there.
flavio81··on Janet: a lightweight, expressive and modern Lisp
>Even installing new dependencies into a running image is a breeze, and no need to restart anything.

You don't even need to leave the REPL!

flavio81··on Janet: a lightweight, expressive and modern Lisp
Hilarious, but true!
← PreviousPage 2 of 34Next →