Live data from Hacker News

Is Lisp a Blub Language?

coding.derkeiler.com

11–20 of 81 posts

Re: Is Lisp a Blub Language?

#11
post #3

Earlier quoted context omitted.

Putting structure assumptions into function argument lists is not necessarily a good idea. One exposes the implementation. Pattern matching function definitions are easy to do in Lisp. But given the nature of Lisp, much of the pattern matching then needs to be done at runtime - which leads to less efficient code and invites people to write totally inefficient code.

Consider the Mathematica function Take[], which would save millions of man hours if it existed in other languages. Take[{a,b,c,d},2] --> {a,b} Take[{a,b,c,d},-2] -> {c,d} Take[{a,b,c,d},{1,3}] -> {a,b,c} Take[{a,b,c,d},{1,-1,2}] -> {a,c} Take[{{a,b,c,d},{1,2,3,4},{5,6,7,8}},2,2] -> {{a, b}, {1, 2}} etc. In my book this is clearly useful, and its only scratching the surface. ( {} is actually List[] in Mathematica Full…

Clojure and Scheme have take and drop, though the semantics are slightly different from those of Mathematica. They can be written in almost any language.

Re: Is Lisp a Blub Language?

#12
post #7

Earlier quoted context omitted.

It looks like you have never programmed in Lisp. A function like Take is easy to write in Lisp. Lisp has many similar functions like that - but with a better interface. > There is a reason you don't see meaning represented by structure in pretty much any other language besides Mathematica. Could it really be that you missed the AI software that has been written in Lisp in the last five decades?

What is ' other than a special mode? The fact is that symbols are treated more systematically in Mathematica, and that makes it easier to assemble and dissemble symbolic structures of all sorts. Sounds like a case of blub. You look at Mathematica and see some weird stuff that is probably equivalent in power to multimethods or whatever, I look at Lisp and think how can I possibly live without civilized pattern matchin…

What is ' other than a special mode?

I usually implement it as a reader macro. :)

Re: Is Lisp a Blub Language?

#13

Pattern matching is the missing feature. I keep thinking about switching to Clojure from Mathematica, but then I think "How can anyone get anything done in Clojure? It doesn't even have pattern matching." Its not something that can get patched in a library, because the way symbols and evaluation need to work is different (and simpler) than in a Lisp. There is no distinction between macro-s and nonmacros - everything…

What exactly do you mean by pattern matching? I understand it in the ML sense. The Lisp language I use, PLT Scheme, has extensible pattern matching: http://docs.plt-scheme.org/reference/match.html The implementation isn't simple but the techniques are published (see "Pattern matching for Scheme" http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.2... ) so any Lisp language could implement this. Clojure has le…

you might check sometimes the documentation of CL implementations for the advances that they provide over the standard

Re: Is Lisp a Blub Language?

#14
Blubness of a language comes from its practitioners not knowing about useful features from a higher-level language (or not grasping the utility of such a feature).

If your favorite Lisp lacks a certain feature you want, it's easy to add, making Lisp the anti-Blub.

(And if your favorite Lisp makes it hard to add it, you've picked the wrong favorite!)

Re: Is Lisp a Blub Language?

#15

Pattern matching is the missing feature. I keep thinking about switching to Clojure from Mathematica, but then I think "How can anyone get anything done in Clojure? It doesn't even have pattern matching." Its not something that can get patched in a library, because the way symbols and evaluation need to work is different (and simpler) than in a Lisp. There is no distinction between macro-s and nonmacros - everything…

What exactly do you mean by pattern matching? I understand it in the ML sense. The Lisp language I use, PLT Scheme, has extensible pattern matching: http://docs.plt-scheme.org/reference/match.html The implementation isn't simple but the techniques are published (see "Pattern matching for Scheme" http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.2... ) so any Lisp language could implement this. Clojure has le…

This is actually occurring. Most advances are made in cross-platform libraries (networking, regexps, threading, pattern matching, lazy evaluation, etc.) but some implementations have their own extra that make them interesting (by no means an exhaustive list):

ABCL (http://common-lisp.net/project/armedbear/) runs on the JVM.

CCL (http://www.clozure.com/clozurecl.html) has excellent integration with Objective-C and Cocoa on OS X.

ECL (http://ecls.sourceforge.net/) is easily embeddable in C / C++.

The commercial offerings Allegro CL (http://www.franz.com/products/allegrocl/) and LispWorks (http://www.lispworks.com/) keep on improving and extending their own implementations in interesting ways.

Re: Is Lisp a Blub Language?

#16

Pattern matching is the missing feature. I keep thinking about switching to Clojure from Mathematica, but then I think "How can anyone get anything done in Clojure? It doesn't even have pattern matching." Its not something that can get patched in a library, because the way symbols and evaluation need to work is different (and simpler) than in a Lisp. There is no distinction between macro-s and nonmacros - everything…

What exactly do you mean by pattern matching? I understand it in the ML sense. The Lisp language I use, PLT Scheme, has extensible pattern matching: http://docs.plt-scheme.org/reference/match.html The implementation isn't simple but the techniques are published (see "Pattern matching for Scheme" http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.2... ) so any Lisp language could implement this. Clojure has le…

Good question. Here is what I mean:

1. Pattern matching as the basis for function definition, to determine which code executes and expedite argument destructuring.

2. Patterns themselves should have first-class representation (preferably symbolic), so you can generate them in one place and use them in another.

3. Implicit in this is that the structure of the language is systematic enough to make this worthwhile, meaning something s-expression based, or perhaps something like Scala that achieves similar ends in a much different way.

Re: Is Lisp a Blub Language?

#17

Earlier quoted context omitted.

What exactly do you mean by pattern matching? I understand it in the ML sense. The Lisp language I use, PLT Scheme, has extensible pattern matching: http://docs.plt-scheme.org/reference/match.html The implementation isn't simple but the techniques are published (see "Pattern matching for Scheme" http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.2... ) so any Lisp language could implement this. Clojure has le…

Good question. Here is what I mean: 1. Pattern matching as the basis for function definition, to determine which code executes and expedite argument destructuring. 2. Patterns themselves should have first-class representation (preferably symbolic), so you can generate them in one place and use them in another. 3. Implicit in this is that the structure of the language is systematic enough to make this worthwhile, mean…

[deleted]

Re: Is Lisp a Blub Language?

#18
post #11

Earlier quoted context omitted.

Consider the Mathematica function Take[], which would save millions of man hours if it existed in other languages. Take[{a,b,c,d},2] --> {a,b} Take[{a,b,c,d},-2] -> {c,d} Take[{a,b,c,d},{1,3}] -> {a,b,c} Take[{a,b,c,d},{1,-1,2}] -> {a,c} Take[{{a,b,c,d},{1,2,3,4},{5,6,7,8}},2,2] -> {{a, b}, {1, 2}} etc. In my book this is clearly useful, and its only scratching the surface. ( {} is actually List[] in Mathematica Full…

Clojure and Scheme have take and drop, though the semantics are slightly different from those of Mathematica. They can be written in almost any language.

My point is that putting "structure assumptions in argument lists", though not a good idea 100% of the time, is often extremely useful, as illustrated by the example.

The greater point is that if this is so, one might as well deal in a model of computation that is a natural fit for that way of thinking.

I've been doing a lot of work in Scala and Actionscript. How I wish they had that family of functions in full generality. Why are they missing from most languages? Because that is not how people think in them.

Re: Is Lisp a Blub Language?

#19
post #4

Pattern matching is the missing feature. I keep thinking about switching to Clojure from Mathematica, but then I think "How can anyone get anything done in Clojure? It doesn't even have pattern matching." Its not something that can get patched in a library, because the way symbols and evaluation need to work is different (and simpler) than in a Lisp. There is no distinction between macro-s and nonmacros - everything…

I certainly miss ML-style pattern matching when I'm in Lisp. I sometimes find myself (poorly) simulating the idea with a whole bunch of multi-method specializers. Based on my limited experience, it seems like you'd really need a more static type system to make the most of pattern matching though. Are there any dynamically typed languages with powerful/useful pattern matching?

Erlang of course.

Re: Is Lisp a Blub Language?

#20

Pattern matching is the missing feature. I keep thinking about switching to Clojure from Mathematica, but then I think "How can anyone get anything done in Clojure? It doesn't even have pattern matching." Its not something that can get patched in a library, because the way symbols and evaluation need to work is different (and simpler) than in a Lisp. There is no distinction between macro-s and nonmacros - everything…

A little bit of googling gave me the sense that pattern matching in Mathematica is different from the pattern matching present in several functional languages. Please let me know how these Clojure features differ from that:

Clojure has pattern matching for the arguments in a function definition similar to ML or Haskell. It's often used as a more verbose alternative to optional args, but it's more powerful fundamentally.

Clojure has destructuring in binding forms like let, described here: http://clojure.org/special_forms

Clojure has multimethods which let you pick the method to use based on an arbitrary dispatch function.

There's a pattern matching macro that seems to be the beginning of a DSL for predicates: http://www.brool.com/index.php/pattern-matching-in-clojure

Post reply on HN