Live data from Hacker News

Lisp-stick on a Python

docs.hylang.org

51–60 of 170 posts

Re: Lisp-stick on a Python

#51

I don't get it. I am a Smug Lisp Weenie. Lisp is not a syntactic sugar - the only reason it looks like it does is for metaprogramming. Those parens are not syntax - they indicate the underlying structure of the code, a tree which may be manipulated by Lisp macros. Why would anyone pretend to program in Lisp without any benefit? Also, Python is the worst imaginable engine for running Lisp. [correction: I see there are…

[deleted]

Re: Lisp-stick on a Python

#52
I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this.

For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with all associated safety and security pitfalls, whereas in Rust you just return a `Vec` and everything is taken care of. Simple, obvious, real-world superiority.

How does such an example for Lisp look like? I'd love to see 10 lines of Lisp that show me something that:

1. I can't easily do in, say, Rust.

2. Actually matters in practice.

Re: Lisp-stick on a Python

#53

Earlier quoted context omitted.

Clojure is more than just a Lisp for the JVM – it is a Lisp for the JVM with a big focus on immutable data structures – whereas traditionally most Lisps put mutability first instead. There are other Java-based Lisps, such as Armed Bear Common Lisp (ABCL), which are more traditionally Lisp-like in this regard. I think Hy is more of a traditional Lisp, since it shares Python's native focus on mutable data rather than t…

Let’s not be too pedantic, it was just an analogy, not a bad one, nor perfect but none are. As a Clojurist I think it behooves us not to put on gatekeeping airs (because we’re up against those too).

I wasn't trying to gatekeep anyone (and I make no claim to be a "Clojurist"–my Clojure experience is rather minimal). I was making a point about categorisation, taxonomy.

There is a certain category of Lisp-like languages – of which Hy, Fennel and LFE are good examples – which take an existing language, and provide a Lisp-like syntax for it, but generally keep the semantics reasonably close to that of the underlying language. Beyond the syntax, the other main addition tends to be a Lisp-style macro system. Maybe we might call them "veneer Lisps", since they put a Lisp veneer on another language, but beneath the surface it is largely the same.

Clojure isn't a veneer Lisp, because its semantics are quite different from Java – Java is primarily about mutable data, and Clojure-style immutable data structures aren't the mainstream Java approach. A JVM Lisp which dropped Clojure's emphasis on immutability could be a veneer Lisp. Armed Bear Common Lisp and Kawa Scheme are examples of mutability-oriented JVM Lisps, but they don't belong to the category of veneer Lisps either, since they are ports of pre-existing languages to the JVM, and their mutability comes from those pre-existing languages not a desire to conform to Java/JVM semantics.

I'm not saying there is anything wrong with immutability, or that Clojure's focus on it is a mistake, or that one ought to either prefer (or avoid) "veneer Lisps": I'm attempting descriptive taxonomy, not prescriptivism.

Re: Lisp-stick on a Python

#54
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

[deleted]

Re: Lisp-stick on a Python

#55
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

I genuinely like Rust, but it's pretty amazing that you managed to write a comment on this article and make it about Rust. Peak HN :-)

Re Lisp's superiority - Lisp was certainly a superior language when it was devised many decades ago, but over time much of its comparative advantage has been absorbed by other languages. Starting in the 90s when productive, GC'd scripting languages like Python started being prominent this trend accelerated.

For a nice discussion of this see https://norvig.com/Lisp-retro.html

Re: Lisp-stick on a Python

#56
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

I'd say the most satisfying experiences I have with lisp are a cross between clean abstractions and light code-golfing. To call out specific approaches, I'd highlight anaphoric macros, code-walking via (symbol-)macro-let [1], and the freedom to control when expressions evaluated (generally at read-time, compile-time, or run-time) for optimization [2][3].

[1]: https://letoverlambda.com/index.cl/guest/chap5.html#sec_

[2]: Compiler macro chapters aren't free, but I guess read-time is covered here https://letoverlambda.com/index.cl/guest/chap4.html#sec_1

[3]: https://irreal.org/blog/?p=809 / https://web.archive.org/web/20140711171755/symbo1ics.com/blo...

Re: Lisp-stick on a Python

#57
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

Just in case people don't know about C. This is a short piece of code where an array is returned from a function.

    typedef struct {int v[4];} Vec;
    Vec get_vec(void){return Vec {3,2,1,0};}
Edit: alas, I've been writing too much C++. The following is correct C.

    typedef struct {int v[4];} Vec;
    Vec get_vec(void){Vec v={{3,2,1,0}}; return v;}

Re: Lisp-stick on a Python

#58
post #38
post #35

Why Hy? Hy (or “Hylang” for long; named after the insect order Hymenoptera, since Paul Tagliamonte was studying swarm behavior when he created the language) I'm spending my HN karma to make this petty comment that if the first sentence of your docs immediately opens up with the story of how you named your project, I instantly don't want to use it or read any more. It's like when you open a cooking recipe on a website…

I’m going to follow up with a slightly more pertinent question: Why use a cuttlefish as the logo when the language is named after another animal? Missed opportunity to spread the knlowledge about the Hymenopteras…

No expert, but the shape of the head of the cuttlefish (as drawn) somewhat suggests a pair of parentheses.

Re: Lisp-stick on a Python

#59
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

Considering Lisp was here first, shouldn't the real question be "why use Rust/C++/Python when there's Lisp?" You can't even create a real closure in Rust.

I'd love to see 10 lines of Rust that showed me something that:

1. I can't easily do in Lisp.

2. Actually matters in practice.

Re: Lisp-stick on a Python

#60
post #52

I've been hearing claims my entire programming career about how Lisp is supposedly "superior" to mainstream programming languages, but I've never seen a concise code example that actually demonstrates this. For instance, it's easy to demonstrate how Rust is superior to C: Just show a short piece of code where an array is returned from a function. In C, this will involve raw pointers and manual memory management with…

I can, without restarting my program:

1. Gather assembly level profiling information

2. Redefine & recompile a function

3. Gather new assembly level profiling

I can iterate dozens of times between #2 and #3 in the time of a single incremental production build in rust (debug builds are not useful for gathering profiling data).

Generally speaking it takes less than a second to recompile and load a source file, and it can be done while the program is running.

Post reply on HN