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

Stuff that annoys you...

Name: Anonymous 2010-09-03 12:45

when reading code not written by yourself. For example, I cannot stand it when  people use

if (condition)
    ...
else if (condition)
    ...
else if (condition)
    ...
else if (condition)
    ...
else


instead of the much more readable


if (condition)
    ...
else
    if (condition)
        ...
    else
        if (condition)
            ...
        else
            if (condition)
                ...
            else

Name: Anonymous 2010-09-04 0:43

>>38
If his point was that "it's too much syntax" or something silly like that, most of that syntax is both in Scheme and CL, and it's there since many many years ago. Frankly, this syntax simplifies a lot of things. I could write it all in symbols, atoms and lists, without using any of the extra syntax(you know why? reader macros just execute code at readtime, which generate an object, the object is usually your usual cons linked list which can be represented as a s-exp, although that's not ALWAYS the case, it's true for the good majority of cases, with a few notable exceptions(such as read-time eval)), but I don't. Why? Because, they considerably cut down on the amount of code you have to write, and are more descriptive (they represent a more high level way to write certain common operations). Here's an example of the backquote(CL)/quasiquote(Scheme) reader macro:

`(this is useless) equal '(this is useless) equal (QUOTE (THIS IS USELESS)) equal (LIST 'THIS 'IS 'USELESS) equal (LIST (QUOTE THIS) (QUOTE IS) (QUOTE USELESS))

`(what (about ,@this or . ,this) or THIS and ((THIS)))
-> ;; I'm already getting too lazy to write that by hand without using multiple forms to build up that list, which is trivial to understand in its first form... here's what that backquote translates to:
(LIST* (QUOTE WHAT) (CONS (QUOTE ABOUT) (APPEND THIS (CONS (QUOTE OR) THIS))) (QUOTE (OR THIS AND ((THIS)))))

I know which forms I prefer. The first is readable and makes sense, the second forces me to imagine manually consturcting the list. actually '(stuff) is different from (list 'stuff), in the way that one is consed at read-time, and the other at runtime, but that's besides the point since I said equal.

I can write either one by hand, but one form remains readable, while the other doesn't. Of course, in situations where writing it plainly makes more sense, I'll do that. Pick whichever makes more sense for the code you're writing and depending on your personal preferences.

newLISP
That's barely even a real Lisp, but I'm not going to talk about it anymore, instead I suggest you try to learn some of the other languages in the Lisp family so you could actually make an informed choice.

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