Recent submissions

Comment · 1 year ago
I can see what happens there in JSCL.. I took a look at

    (disassemble (lambda () (loop for i below (expt 10 8) count t)))
Seems TAGBODY is compiled into a while(true) which sets an exception handler on each iteration. (and then, LOOP macroexpands into a TAGBODY). I don't think there's a better way to do it, BTW — JS is simply not a friendly compilation target. But `try` on each iteration is quite costly, that's most probably the bottleneck here.
Comment · 1 year ago
Comment · 1 year ago
Hm, you're right, JSCL seems abnormally slow on this loop (27.5 sec here). SLip consistently takes 19.3 sec. My CPU is rather beefy (Ryzen 9 HX 370). What's your hardware and browser?

But JSCL is much faster on the fib example, that's why I thought it should be generally faster. After all, it compiles to JS.

Comment · 1 year ago
In SLip: https://lisperator.net/s/slip/

    SL-USER> (time (loop for i below (expt 10 8) count t))
    Evaluation time: 19376ms
    100000000

    SL-USER> (time (loop for i below 1000000 count t))
    Evaluation time: 272ms
    1000000

    SL-USER> (defun fib (n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
    #'FIB
    SL-USER> (time (fib 32))
    Evaluation time: 1601ms
    2178309
These timings are in Firefox; Chromium is almost 2x faster. Also, it doesn't completely freeze the browser in the mean time (we have green threads).

I used to think it's quite slow, but somehow it's much faster than any other posted here. The only Lisp in browser I know to beat SLip (by a large margin) is JSCL, which compiles to JS.

Comment · 6 years ago
Comment · 6 years ago
Now add a Common Lisp compiler to it and you reinvented technology from the 80'es. :-)
Comment · 6 years ago
You'd be surprised to find out that Common Lisp has actually quite a strong type system (not Haskell-level but much better than C++/Java); just that it's optional. You get the best of both worlds — fast prototyping, and then when you decide upon the types, you can add type declarations, which usually result in (much!) faster code and robustness.
Comment · 6 years ago
You won't get what true "liveness" is until you work in Lisp or Smalltalk. The ability to change a function in a running program, without restarting it. Automatic reload might seem cool, but reload means your application restarts and loses state. Imagine you have some Web app and you open some menus/dialogs, perhaps it's connected to some server via WebSockets etc. and you find a bug somewhere, you go to the code to fix it, but reloading the page means you start from scratch and need to open again those menus/dialogs, and reconnect the sockets, in order to test your fix.

Common Lisp had true liveness for decades; it's almost mandated by the standard, it's designed in such a way that you can actually recompile a function, or even redefine objects, adding or removing properties or methods, at fucking runtime without restarting the application. Objects already instantiated will remain so and will be updated to reflect the change. You don't restart. That's the true "liveness", but seriously you don't get it until you try it, and once you get it you become depressed because you realize it doesn't really exist in any mainstream language.

JavaScript is some decades behind this dream, even with stuff like Webpack.

Comment · 8 years ago
Nicely done, but Courier is the ugliest font on Earth (I don't have Monaco). For the sake of humanity, never write "Courier" in a CSS file. ;-)
Comment · 8 years ago
Emacs, the One True Program.
Comment · 8 years ago
I do, when I know the types match. Also, I always use == to test if something is either null or undefined; cases where the distinction matters are extremely rare, and this looks too silly: typeof foo === "undefined" || foo === null.
Comment · 8 years ago
It's not always 10:1, but it seems to be a good average. This happened to me numerous times — I sometimes start with a quick and dirty solution for my problem, then refine and refine until I'm happy with the result, the performance, the code looks beautiful and then I'm like “heck, it's only 100 lines and it took me a week”. In more pathologic cases, I've spent a week just thinking about it, and then I started writing code.

I'm programming for 20 years and I still can't provide good ETA-s for non-trivial problems.

Comment · 9 years ago
What's wrong with:

    return {
        labels: data.items.map(function(value){
            return {
                type: "label",
                value: value > 10 ? value : value * 100
            };
        })
    };
I hope your project does not get too popular.
Comment · 9 years ago
Magit must be why Git was invented.
Comment · 9 years ago
+1, but I tried patiently to move the mouse over the X (close tab button) and clicked a few times... one minute later it closed and I got away without a hard reset.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton