Live data from Hacker News

Why Lisp is now an acceptable scripting language

fare.tunes.org

71–80 of 138 posts

Re: Why Lisp is now an acceptable scripting language

#71
post #37

Earlier quoted context omitted.

Everything we know from centuries of design experience and all science knows about the eyes and how we read, tells us they made it better than the first site. There's not even a parallel universe where the first one is better -- and it's not a subjective issue either.

What papers say that low contrast is better than high contrast black on white? There is research to show that black on white is better than white on black, but I doubt there's any to show that poor contrast dark grey on light grey is better than black on white. It is just a fashion, there's no science to say that low contrast is better. http://contrastrebellion.com/ Shorter lines I might grant you, though.

Note that the website you linked doesn't have any sharp black on white.

Re: Why Lisp is now an acceptable scripting language

#72
post #47

Can anybody explain the advantages of switching to a functional language when it is not a pure one? For example, how is it better than Javascript? Is the uniformity of the syntax (and perhaps implicit currying) the main benefit?

I don't really think of Lisp as a functional language: it's really an imperative language with some functional features, and some OO features, and some aspect-oriented features and so forth.

The advantage that I see in switching to Lisp is that it's a nice, pleasant, powerful language in which to work. The standard is well-thought-out. The abstraction capabilities are wonderful.

Compared to JavaScript, there's no comparison:-) Just off the top of my head, Lisp has integers, ratios (e.g 1/2), big integers (e.g. (expt 2 2048) → a number so large it breaks the HN page wrap) and complex numbers (e.g. (sqrt -3) → #C(0.0 1.7320508)).

Lisp's error-handling system of conditions and restarts is profoundly powerful: one part of code hand signal an error, another can determine how to fix it, and execution can resume without unwinding the stack (as opposed to exceptions, where by the time a higher level of code determines what to do the function encountering the problem has already returned). Technically, one could implement this in JavaScript (it's all based on first-order functions), but since JavaScript doesn't have macros it'd be pretty hideous.

Which raises the point of macros, which are enabled by the uniform syntax. They're a powerful tool for syntactic abstraction, just like functions are a powerful tool for procedural abstraction. A language without macros is almost as primitive as one without functions.

There are also read-macros, which enable one to customise or even replace the parser (called a reader in lisp). Don't like Lisp? That's okay, you can write a reader which parses JavaScript and returns Lisp objects to be evaluated or compiled! Then there are compile macros, which enable compile-time optimisation. And there are symbol macros, which can make what looks like a variable access actually able to perform any operation. Imagine being able to write 'foo = bar' in JavaScript, and having that assignment be logged. In Lisp, you can do that.

One big advantage is that all of these macros systems are … just Lisp. They're not special: you can do anything in a read macro that you can do in your code. You don't have to learn a special syntax or a limited subset of the language: it's all there if you need it.

Then there's the object system (which is enabled by macros). CLOS is the most powerful, most convenient object system with which I'm familiar. JavaScript methods belong to a prototype, which means that in foo.bar(baz) only foo determines what bar is; in Lisp, methods are multimethods, and may be specialised on any and all arguments: (bar foo baz) could do different things depending on the type of foo, the type of baz or the types of both.

Places are an amazing concept. In most languages there's no way to say 'foo(bar) = baz', but in Lisp one can do (setf (foo bar) baz) with the right setf functions and it Just Works.

Lisp has optional type annotations, which can lead to extremely fast code.

Then there are little things like well-thought-out equality predicates, cleaner-looking code &c.

The advantage of JavaScript over Lisp is that because it is installed everywhere it has a much, much, much larger community, which means more libraries, wider support. But install base and community size are honestly the only real advantages I can think of.

Re: Why Lisp is now an acceptable scripting language

#73

Back in 2012 when I was sure I wanted to master some dialect of Lisp but wasn't sure which one yet, I read about 80% of Practical Common Lisp before I noped the heck out of there. The whole reason I was drawn to Lisp was for its semantic and syntactic purity, simplicity, and consistency, and out of the three popular Lisps at the time, CL felt like it had these the least. Ultimately I ended up going with Clojure after…

The Common Lisp standard is definitely neither pure, nor simple, nor consistent, but it is pragmatic, practical and powerful. Scheme is a fun learning toy, but I wouldn't use it for a production system.

As for Clojure? I'd like to get around to taking a serious look at it someday, but I do somewhat emotionally & irrationally blame it for stealing the momentum of the Lisp resurgence of the late 2000s. It probably has some good ideas, but it's also pretty radically different from Lisp, which is (under the parentheses) a fairly traditional language.

Re: Why Lisp is now an acceptable scripting language

#74
post #47

Can anybody explain the advantages of switching to a functional language when it is not a pure one? For example, how is it better than Javascript? Is the uniformity of the syntax (and perhaps implicit currying) the main benefit?

A disadvantage of intensional purity (limiting the language to guaranteed-pure constructs, which is enforceable by a compiler) is, ironically, that it gives the programmer less control over how extensionally pure functions (i.e., no observable effects, which is obviously undecidable) are evaluated. In ML (an impure functional language), you can evaluate extensionally pure functions strictly (the straightforward manner), lazily (which Haskell gives you out of the box, but in ML requires reference cells), memoizing previously computed results (which Haskell can't easily do, but in ML can be done with reference cells), etc.

Re: Why Lisp is now an acceptable scripting language

#75

Lisp is an acceptable language for a variety of things, not just "scripting". I work on many projects written in Guile Scheme that range from game engines to static site generators to dynamic web applications to package managers, and I write one-off scripting tasks with it, too. There's a lot of mystique around Lisp and Scheme, and people tend to write it off as a relic of academia, but I use it for practical needs e…

>> Lisps enable a type of development via live coding that I have yet to see a non-Lisp match.

How does it compare to using python for live coding?

Re: Why Lisp is now an acceptable scripting language

#76
post #75

Lisp is an acceptable language for a variety of things, not just "scripting". I work on many projects written in Guile Scheme that range from game engines to static site generators to dynamic web applications to package managers, and I write one-off scripting tasks with it, too. There's a lot of mystique around Lisp and Scheme, and people tend to write it off as a relic of academia, but I use it for practical needs e…

>> Lisps enable a type of development via live coding that I have yet to see a non-Lisp match. How does it compare to using python for live coding?

in lisps, data is code is data. So imagine you can edit your program while it's running, since it's just data.

How that compares to python, I'm not sure. But I don't think you can easily modify python code as easily as you can modify lisp programs.

Re: Why Lisp is now an acceptable scripting language

#77
post #72
post #47

Can anybody explain the advantages of switching to a functional language when it is not a pure one? For example, how is it better than Javascript? Is the uniformity of the syntax (and perhaps implicit currying) the main benefit?

I don't really think of Lisp as a functional language: it's really an imperative language with some functional features, and some OO features, and some aspect-oriented features and so forth. The advantage that I see in switching to Lisp is that it's a nice, pleasant, powerful language in which to work. The standard is well-thought-out. The abstraction capabilities are wonderful. Compared to JavaScript, there's no com…

>> The advantage of JavaScript over Lisp is .. more libraries, wider support.

Clojure solves that.

Re: Why Lisp is now an acceptable scripting language

#78
post #75

Lisp is an acceptable language for a variety of things, not just "scripting". I work on many projects written in Guile Scheme that range from game engines to static site generators to dynamic web applications to package managers, and I write one-off scripting tasks with it, too. There's a lot of mystique around Lisp and Scheme, and people tend to write it off as a relic of academia, but I use it for practical needs e…

>> Lisps enable a type of development via live coding that I have yet to see a non-Lisp match. How does it compare to using python for live coding?

If you want to compare Lisp Live Coding and you know Python, then let me compare it like this: How much faster can you get things done using something like ipython vs. a compiled static language like C(++/#) or Java? I don't want to go into a flamewar against the other languages, of course. Yet, if you favor an ipython repl against the compile/build/test cycle, then Lisp gives you just about the same order of magnitude more power.

I've done professional Python coding for 2.5 years, Ruby and JS for 7. I always believed that the REPL combined with those languages being dynamically typed can yield big advantages.

With a Lisp you can evaluate your code in real time in your editor. Also your app will re-load your code live without losing it's state. I've done that with Backends, Web Frontends and Mobile Apps. It's pretty awesome, not just compared to everything else^^

Take it for a spin and enjoy the ride(;

Re: Why Lisp is now an acceptable scripting language

#79
post #78
post #75

Earlier quoted context omitted.

>> Lisps enable a type of development via live coding that I have yet to see a non-Lisp match. How does it compare to using python for live coding?

If you want to compare Lisp Live Coding and you know Python, then let me compare it like this: How much faster can you get things done using something like ipython vs. a compiled static language like C(++/#) or Java? I don't want to go into a flamewar against the other languages, of course. Yet, if you favor an ipython repl against the compile/build/test cycle, then Lisp gives you just about the same order of magnitu…

What are the bread-and-butter (aka not sexy and cutting edge, but mature and stable) lisps used for web development?

Re: Why Lisp is now an acceptable scripting language

#80
post #75

Lisp is an acceptable language for a variety of things, not just "scripting". I work on many projects written in Guile Scheme that range from game engines to static site generators to dynamic web applications to package managers, and I write one-off scripting tasks with it, too. There's a lot of mystique around Lisp and Scheme, and people tend to write it off as a relic of academia, but I use it for practical needs e…

>> Lisps enable a type of development via live coding that I have yet to see a non-Lisp match. How does it compare to using python for live coding?

Lisp invented live coding.

Something like IPython was how the REPL from Lisp Machines and Interlisp-D used to work.

Plus Lisp is a compiled language.

Post reply on HN