Live data from Hacker News

Is Lisp a Blub Language?

coding.derkeiler.com

61–70 of 81 posts

Re: Is Lisp a Blub Language?

#61
post #37
post #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!)

Some features are not easy to add. For example, one important feature of Python is that the language is designed with consistency and readability in mind, and combined with the "preferably one obvious way to do it"-ideal means that code written by other people is easier to read and understand. This makes code and knowledge sharing easier, and the network effect creates a blooming ecosystem for libraries. How do you e…

1.) that's not a feature. a sufficiently bad programmer can write Obfusca in any language.

2.) (if you must) you add the 'feature' by writing python in lisp, as your argument amounts to 'lisp isn't python'.

http://common-lisp.net/project/clpython/

Re: Is Lisp a Blub Language?

#62
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?

Take is a really terrible example, even python has take built into the syntax (Take[lst, 2] -> lst[0:2]). But Mathematica does have nice pattern matching which few lisps have: SolvePoly[a_*x+b_=0] := { -b/a } SolvePoly[a_*x^2+b_*x+c_=0] := \ { (-b + sqrt(b^2-4*a*c))/2a, (-b - sqrt(b^2-4*a*c))/2a } SolvePoly[_] := "I only took high school algebra" Of course, in principle one could write a pattern matching macro in lis…

how would one define SolvePoly or even Take for that matter in terms of Mathematica if it were not "built in"? I am not saying it is impossible (I really do not know and thus I am curious).

Re: Is Lisp a Blub Language?

#63
post #53

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…

Wow, Lisp has Take. I wrote one. It took me a few minutes: CL-USER 58 > (take '(a b c d) 2) (A B) CL-USER 59 > (take '(a b c d) -2) (C D) CL-USER 60 > (take '(a b c d) '(0 3)) (A B C) CL-USER 61 > (take '(a b c d) '(0 -1 2)) (A C) CL-USER 62 > (take '((a b c d) (1 2 3 4) (5 6 7 8)) 2 2) ((A B) (1 2)) That was easy.

would you mind posting your definition?

Re: Is Lisp a Blub Language?

#64
post #46

Earlier quoted context omitted.

The philosophy is hardcoded in the design of the language. For example, the BDFL has explicitly stated he doesn't want macros because it will hurt the readability (1), and he rejected support for multi-line anonymous functions because he didn't find a syntax which he thought was clear and readable enough. Clearly this is a very different philosophy than the one behind Lisp. (1) The quote from Guido: Programmable synt…

Programmable syntax is not in Python's future -- or at least it's not for Python 3000. The problem IMO is that everybody will abuse it to define their own language. And the problem with that is that it will fracture the Python community because nobody can read each other's code any more I like Python and use it everyday, and I this is simply FUD. Sadly it's the kind of argument I hear coming too often from people in…

Is it really FUD though? Having gone through a few bruising experiences with different libraries having incompatible object systems built in Javascript, I have come to appreciate the advantages of only having one way to implement certain types of structures.

It doesn't need to be hard-coded into the language though - a decent Standard Library showing how things should be done, and a culture maintained by the community would be enough. That would allow everyone the freedom to do what they want if they say a definate advantage in breaking with convention, whilst making it easy for people to generate libraries that are interoperable...

Re: Is Lisp a Blub Language?

#65
post #46
post #38

Earlier quoted context omitted.

Your example is a feature of the Python philosophy (or community) not the Python language.

The philosophy is hardcoded in the design of the language. For example, the BDFL has explicitly stated he doesn't want macros because it will hurt the readability (1), and he rejected support for multi-line anonymous functions because he didn't find a syntax which he thought was clear and readable enough. Clearly this is a very different philosophy than the one behind Lisp. (1) The quote from Guido: Programmable synt…

Well it's easy to disagree with him on many points.

The use of macros that I've seen in CL source doesn't indicate that people are creating other programming languages out of Lisp. In fact, it makes the source easier to read by allowing a natural level of terseness by way of abstraction.

Python's method of abstraction is via encapsulation in it's class/meta-class/object model.

However, this is an argument for another post.

Funny how these Lisp posts continue to flame across the net.

Re: Is Lisp a Blub Language?

#66

No. I'll explain why: all languages are in some sense equally expressive, because they are Turing-complete. But some languages don't have particular abstractions, for example classes; so in that sense they are not expressive, because you can't express those abstractions. But Lisp has macros. This means that any abstraction it doesn't yet support, you can add.

Macros aren't always a great solution. I think Haskell is the best example: many features, such as the lazy evaluation, the type system, and especially referential transparency would be very hard to add on Lisp without making it very verbose and ugly. Here's an example:

http://marijn.haverbeke.nl/monad.html

Re: Is Lisp a Blub Language?

#67
post #53

Earlier quoted context omitted.

Wow, Lisp has Take. I wrote one. It took me a few minutes: CL-USER 58 > (take '(a b c d) 2) (A B) CL-USER 59 > (take '(a b c d) -2) (C D) CL-USER 60 > (take '(a b c d) '(0 3)) (A B C) CL-USER 61 > (take '(a b c d) '(0 -1 2)) (A C) CL-USER 62 > (take '((a b c d) (1 2 3 4) (5 6 7 8)) 2 2) ((A B) (1 2)) That was easy.

would you mind posting your definition?

    (defun take-1 (it what)
      (cond ((eq what :all) it)
            ((eq what :none) nil)
            ((and (numberp what) (plusp what))
             (subseq it 0 what))
            ((and (numberp what) (minusp what))
             (last it (- what)))
            ((and (consp what)
                  (= (length what) 1)
                  (numberp (first what)))
             (nth (first what) it))
            ((and (consp what)
                  (= (length what) 2)
                  (numberp (first what))              
                  (numberp (second what)))
             (let ((end (if (minusp (second what))
                            (+ (length it) (second what))
                          (second what))))
               (subseq it (first what) end)))
            ((and (consp what)
                  (= (length what) 3)
                  (numberp (first what))
                  (numberp (second what))
                  (numberp (third what)))
             (let ((end (if (minusp (second what))
                            (+ (length it) (second what))
                          (second what))))
               (loop for e = (subseq it (first what)) then (nthcdr (third what) it)
                     for i from (first what) below end by (third what)
                     collect (first e))))))


    (defun take (thing &rest description)
      (cond ((null description) nil)
            ((and (consp description)
                  (= (length description) 1))
             (take-1 thing (first description)))
            (t (loop for e in (take-1 thing (first description))
                     collect (apply #'take e (rest description))))))

Re: Is Lisp a Blub Language?

#68

Earlier quoted context omitted.

Take is a really terrible example, even python has take built into the syntax (Take[lst, 2] -> lst[0:2]). But Mathematica does have nice pattern matching which few lisps have: SolvePoly[a_*x+b_=0] := { -b/a } SolvePoly[a_*x^2+b_*x+c_=0] := \ { (-b + sqrt(b^2-4*a*c))/2a, (-b - sqrt(b^2-4*a*c))/2a } SolvePoly[_] := "I only took high school algebra" Of course, in principle one could write a pattern matching macro in lis…

how would one define SolvePoly or even Take for that matter in terms of Mathematica if it were not "built in"? I am not saying it is impossible (I really do not know and thus I am curious).

Same way you would do it in lisp - you'd build a function to do pattern matching and use conditionals to test which pattern is matched.

    (defun solve-poly (p)
        (if (match '(+ (* ?a x) ?b) poly))
            (-b/a  where b, a come from (extract-values-from-pattern-match poly))
           (some code for second order)
     ))
(Some code borrowed from lispm's comment. Not sure which library the match function comes from.)

Re: Is Lisp a Blub Language?

#69
post #46
post #38

Earlier quoted context omitted.

Your example is a feature of the Python philosophy (or community) not the Python language.

The philosophy is hardcoded in the design of the language. For example, the BDFL has explicitly stated he doesn't want macros because it will hurt the readability (1), and he rejected support for multi-line anonymous functions because he didn't find a syntax which he thought was clear and readable enough. Clearly this is a very different philosophy than the one behind Lisp. (1) The quote from Guido: Programmable synt…

I actually wound up in an email discussion about that with Guido. He made it clear that it wasn't just that he didn't find a syntax he liked, but that he didn't try hard because he's not convinced that code that makes heavy use of anonymous functions is a good idea. And the latter seems to me to be his real objection.

Re: Is Lisp a Blub Language?

#70
post #56

Aren't all languages blub languages depending on the usecase? If you write AI programs c++ is a blub language. How can you get anything done without macros? If you program drivers PHP is a blub language. How can you get anything done without direct access to the hardware? If you're doing webapps lisp is a blub language. How can you get anything done with a syntax that's so different from HTML and so difficult to read…

Disclaimer noted, but as to your lisp/HTML example, HTML and lisps actually have a lot in common - if you strip away the end tags and the angle brackets, you get something very lispy looking

    
      Hello
    
has the same (prefix) order of operators and operands as

    (div
      (span "Hello"))
Off the top of my head, the "hiccup" package for Clojure has an 'html' function (macro?) that translates just that sort of stuff directly into html
Post reply on HN