Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lisp

Name: Anonymous 2011-08-15 22:06

What is so good about Lisp?

It seems rather unnatural

Name: Anonymous 2011-08-16 23:39

>>21

For reasons I personally consider to be obvious to the mere lot. From your question, though, it either might not be as obvious, or you wholly disagree with them, which is very acceptable.

Lisp is a functional language. Grossly speaking, functional languages combines elements in the language to form relations (or functions) between such elements, in contrast with actively modifying or calculating things with these elements. In Lisp, there's no such thing as 'incrementing a variable' (disregard momentarily 'setq' and others); instead, you unary relate a variable to return a new element, which happens to be the successor of such variable. In Lisp, there's no 'remove a node from a tree'; instead, a tree, a node and another tree are tied together in a relationship called 'remove'. Lisp semantics are of correlating symbols to form another symbols. Strictly speaking, there wouldn't even be any output from a Lisp program if it were purely functional (that is, side-effect expressions weren't introduced).

I believe you're fully aware of this explanation.

Some applications are much better expressed in terms of what the computer should do, instead of which relations should the computer perform. Webservers and device drivers are examples of such applications: it's more natural, it's easier to express the program in a list of do this, do that instead of trying to combine symbols in lambda-relations. Databases, on the other hand, are not -- that's a reason why there are some models of database systems, and different languages to access them. It's easier to express a database access through another set of primitives of thought; in other words, it's easier to express database access in another paradigm.

Computer languages are all about expression, but are affected by other issues in practice, such as performance. In this case, though, writing a webserver in Lisp is against the language's expression. It's not a matter of performance or other implementation issues. Writing imperative programs in Lisp is inexpressive.

>>23

I'm not aware what would a 'continuation-based' web browser be, although I believe this is the exact same case as above. Scripting support inside webpages, or content-generation, however, is a different matter, and maybe Lisp has some sane horizon inside web deployment.

Name: Anonymous 2011-08-16 23:57

>>22
You mean things like syntax highlighting, code completion, automatic indenters, two big ``COMPILE DEBUG AND RUN'' and ``COMPILE AND RUN'' buttons, or more with customizable esoteric compiler flags and automatic makefile generation because the language has no support for reflection, can't talk with the compiler, doesn't have modules, dependecies between files and libraries cannot be automatically tracked and has an explicit compilation step with overly complicated tools?

Name: Anonymous 2011-08-16 23:59

>>24
Lisp is a functional language.
Stopped reading right there.
Your post is bullshit. You are bullshit. Go immediately back to reddit.

Name: Anonymous 2011-08-17 0:07

>>26
[quote]Stopped reading right there.[/quote]

Oh, God. I didn't know there were really illiterate people around here.

Name: Anonymous 2011-08-17 0:08

>>24
Not sure if trolling or ignant.

Name: Anonymous 2011-08-17 1:57

>>24

One of the most common mischaracterisations of lisp is calling it a functional programming language. Lisp is not functional. In fact it can be argued that lisp is one of the least functional languages ever created. This misunderstanding has interesting roots and is a good example of how a small misnomer can have long-lasting influence and end up causing confusion long after the reasons behind the misnomer have passed into irrelevance. What is a functional language? The only definition that makes sense is

A functional language is a programming language made up of functions.

So what is a function? A function is a concept from math that has been with us for centuries:

A function is a static, well-defined mapping from input values to output values.

It seems like we use defun to define new functions in lisp. For example, the following seems to be a function that uses summation to map the set of all numbers to a new set, one that also includes all numbers:

(defun adder (x)
  (+ x 1))

Obviously we can apply this object to any number and get the mapped result from its return value, but is adder really a function? Well, confusingly, lisp tells us that it is1:

* (describe #'adder)

#<Interpreted Function> is a function.

But calling this object a function is one of the deepest-rooted misnomers in lisp history. What defun and lambda forms actually create are procedures or, more accurately still, funcallable instances[AMOP]. Why the distinction? Procedures don't necessarily have anything to do with mapping values, but instead are pieces of code, possibly with stored environment, that can be executed (funcalled). When lisp programmers write in a certain style called functional style, then the resulting procedures can be thought of and combined together pretending that they are math-style functional maps.

The reason why lisp is so often incorrectly described as a functional language has to do with history. Believe it or not but there was once a time when most languages didn't even support the concept of a procedure that modern programmers in any language take for granted. Very early languages didn't provide a suitable abstraction for locally naming arguments in a piece of re-usable code and programmers had to manually allocate registers and manipulate stacks to achieve this behaviour. Lisp, a language that had procedures all along, seemed way more functional than these languages.

Next, once procedural abstraction was given the attention it deserved and incorporated into almost all programming languages, people started to slowly run up against barriers due to the limited nature of the procedures they had implemented. Programmers started to realise that they would like to be able to return procedures from other procedures, embed them in new environments, aggregate them in data-structures, and, in general, treat them as any old regular value. A slogan sprang up to mobilise programmers for this next big abstraction push: a society without classes, first-class procedures. In comparison to languages that relegated the procedure to an inferior second class, lisp, a language that has had these first-class procedures all along, seemed way more functional.

Finally, many languages make a pointless distinction between expression and statement, usually to support some horrible Blub syntax like infix assignment. In lisp, everything returns something2 and there are no (syntactic) restrictions on what you can nest or combine. It is a simple question with an obvious answer: what is more important in a language, newbie-friendly syntax or real flexibility? Any language that uses infix syntax is reducing the possibilities of its abstractions in many ways. Luckily most modern languages have decided to trust their users enough to allow them to combine expressions mostly as they see fit. In comparison to languages that make these sorts of brain-dead syntax decisions, lisp seems way more functional.

After having become comfortable with this ubiquitous yet misguided terminology, programmers started to realise that the notion of function that had been used in the great functional vs non-functional programming language debate is not only confusing, but is actually fundamentally backwards. To correct this, programmers and academics alike went back to the drawing board, returning to the mathematical definition of a function: a map from input values to output values. If lisp is in any way a functional language, it is only as much so as modern languages such as Perl and Javascript.

Clearly lisp procedures are not functions. Lisp procedures can return non-static values, that is you can call them multiple times with the same arguments and receive different return values each time. As in our examples from previous chapters, lisp procedures can store state by closing over variables. Procedures like rplaca can change values in memory or elsewhere (such as registers). Lisp procedures like terpri and format create output (newlines in the case of terpri) directed to terminals or files3. Lisp procedures like yes-or-no-p can read input from a terminal and return values depending on what the user entered. Are these procedures static, well-defined mappings?

Because lisp procedures are not mathematical functions, lisp is not a functional language. In fact, a strong argument can be made that lisp is even less functional than most other languages. In most languages, expressions that look like procedure calls are enforced by the syntax of the language to be procedure calls. In lisp, we have macros. As we've seen, macros can invisibly change the meaning of certain forms from being function calls into arbitrary lisp expressions, a technique which is capable of violating referential transparency in many ways that simply aren't possible in other languages.

After considering that most languages are in fact not at all functional, some language designers decided to find out what programming in a really functional language would be like. As you would expect, programming functional languages is mostly annoying and impractical. Almost no real-world problems can be usefully expressed as static, well-defined mappings from input values to output values. That being said, functional programming is not without merit and many languages have been designed to take advantage of a functional style of programming. What that means is finding a convenient way of isolating the functional parts of a program from the (actually interesting) non-functional parts. Languages like Haskell and Ocaml use this isolation as a means of making aggressive optimisation assumptions.

But this is lisp. We're very non-functional and very proud of it. To the extent that this isolation of side-effects is useful, lisp programmers can and do implement it with macros. The real purpose behind functional programming is to separate the functional description of what should happen from the mechanics of how it actually does happen. Lisp is definitely not functional, but, because of macros, there is no better platform or material for implementing functional languages than lisp.

Name: Anonymous 2011-08-17 2:09

>>29
I was going to write up a similar response to >>24-baka, but you've saved me the trouble and also went the extra mile.

Name: Anonymous 2011-08-17 2:17

>>29
I was going to write up a similar response to >>24-baka, but you've saved me the trouble and also went the extra mile.

However, I then spotted.

>from previous chapters
And realized I had been duped.

Name: Anonymous 2011-08-17 2:31

``functional'' considered harmful.

Name: Anonymous 2011-08-17 3:22

>>1
It seems rather unnatural
Lisp, Smalltalk, Factor and Nial - all pretty natural languages, meaning their syntax can be parsed in a few lines of code.

Name: Anonymous 2011-08-17 3:25

>>25
Dude, back the fuck off.  First of all, while I do enjoy syntax highlighting and word completion in my text editors, they aren't meant to be workarounds for language deficiencies.  Second of all, I never said Lisp isn't a great language in itself; all I said is that S-expressions are an ugly, unnatural and unreadable way of writing source code.

Name: Anonymous 2011-08-17 3:26

>>34
"unnatural" for whom?

Name: Anonymous 2011-08-17 3:34

>>34
Proof? That's right, faggot, you can't prove shit, because everything you say is relative to the user's preferences.

I'm saging this shitty thread.

Name: Anonymous 2011-08-17 3:39

>>36
Proof? That's right, faggot, you can't prove shit either, because everything you say is relative to the user's preferences.

I'm bumping this shitty thread just to spite you.

Name: Anonymous 2011-08-17 4:34

>>34
Well, paren matching is the easiest thing a text editor can do, even simpler than syntax highlighting. If your text editor has syntax highlighting but doesn't match parens, consider switching the option on, you faggot, and shut up.

Name: Anonymous 2011-08-17 5:15

>>19
Identing code is for pig disgusting python ``programmers''

Name: Anonymous 2011-08-17 5:16

I like turtles

Name: Anonymous 2011-08-17 5:25

>>38
Are you fucking retarded?  I just want proper syntax that doesn't require shitloads of extraneous parentheses.  Surely that's not asking for too much!

Name: Anonymous 2011-08-17 5:34

>>41
Of course not, my liege!
($) :: (a -> b) -> a -> b
f $ x =  f x
(.) :: (b -> c) -> (a -> b) -> a -> c
f . g =  \ x -> f (g x)

Name: Anonymous 2011-08-17 5:42

>>42
I wouldn't trade mutability for syntax!

Name: Anonymous 2011-08-17 5:47

>>41
Try Applescript, then.

Name: Anonymous 2011-08-17 11:40

If it ain't Lisp, it's crap.

Name: Anonymous 2011-08-17 12:40

If it's Lisp, it's crappier.

Name: Anonymous 2011-08-17 13:10

If it's LISP, it's awesome. If it's Haskell, it's even better.

Name: Anonymous 2011-08-17 14:33

>>30
>>24-baka
>baka

GTFO.

Name: Anonymous 2011-08-17 14:49

>>29

I believe the terminology explanation went way beyond purism, though I comprehend the importance of settling right words for concepts in order to avoid confusion. The terms 'statement' and 'expression' were created for the same reason.

The text displays another misnomer. 'Macro' is another word representing at least two different concepts in programming. For example, C preprocessor function-like definitions are also called 'macros', and cannot be compared with Lisp macros.

Name: Anonymous 2011-08-17 15:27

>>48
No you, piece of shit-kun.

Name: Anonymous 2011-09-29 0:14

LOL SEXPRESSIONS

Name: Anonymous 2011-09-29 6:55

List has GC and GC is shit. Lisp is shit.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List