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

Pages: 1-4041-

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-03 12:51

>>1
I can't stand it when C doesn't have cond, so programmers have to use nested ifs.

Name: Anonymous 2010-09-03 12:51

The first is more readable in your example.
Here's something to show that the first is even more annoying than the second in a language that has a macro for the first:

;;; 1
(cond
  (predicate1 executed-if-1)
  (predicate2 executed-if-2)
  (predicate3 executed-if-3)
  (t executed-if-all-else-fails))

;;; 2
(if predicate1
    (progn executed-if-1)
    (if predicate2
        (progn executed-if-2)
        (if predicate3
            (progn executed-if-3)
            (progn executed-if-all-else-fails))))

So far the only person who prefers IF to COND for nested IF's that I've heard of is Paul Graham, but not like his other preferences are very idiomatic.

Name: Anonymous 2010-09-03 12:56

WHBT

Name: Anonymous 2010-09-03 13:16

>>1
I prefer (1) where respectable alternatives do not exist or are not as useful.  (2) produces tree-like code if you nest if else statements in each other and that could affect how the code is displayed by your text editor or IDE (heaven help you if you use an IDE).  The "else if" conditional structure is an established feature in most languages.

Name: Anonymous 2010-09-03 14:15

>>1
1975 called, they sent you a [code]case[/case] statement.

Name: Anonymous 2010-09-03 14:15

s/\/case/\code/

Name: Anonymous 2010-09-03 14:16

>>5
else if is not a feature. it simply is an if statement nested in an else block. some languages however shorten it to a single statement, (e.g. python and elif) in which case it is a feature.

Name: Anonymous 2010-09-03 14:21

>>6
>^O

unrecognized control character

Name: Anonymous 2010-09-03 14:28

>>8
Sorry, "feature" was probably an overloaded word.  I only meant that there are no roadblocks that force you to separate your ifs from your elses and the ability to write else if (condition) is something often intentionally mentioned during lessons about conditional statements.

And, yeah, elif and elsif did come to mind when I wrote that.

Name: Anonymous 2010-09-03 14:45

>>10
Don't forget PHP's elseif.

Name: Anonymous 2010-09-03 14:48

>>11
I think every one of us would like to forget about PHP.

Name: Anonymous 2010-09-03 15:07

>>3
I actually quite like cond in cases of more than 2 ifs. The implicit begin and the => literal come in very handy.

Name: Anonymous 2010-09-03 15:55

>>13
Implicit begin/progn comes at the cost of too many parens, and it is not often useful, especially when writing functional code. Without it you can leave out parens between each branch, like the way arc does it; you only need to add parens if you want a progn (which Clojure and Arc both call (do)).

Name: Anonymous 2010-09-03 16:01

>>14
What the extra two around the clause? In simple cases, you pay an extra two, but it binds the test and the result together visually and that isn't a bad thing.
In complex cases, read 'the progn case' you don't pay anything, and instead drop the keyword.
I think we're just going to have to agree to disagree on this.

Name: Anonymous 2010-09-03 16:14

>>7
What is a code statement?

Name: Anonymous 2010-09-03 16:18

Stuff that annoys you...
When use if/else or switch/case instead of writing jump tables in assembly

Name: >>3 2010-09-03 17:01

>>13
I meant that I prefer COND to IF whenever I'm dealing with nested IF's. I made a mistake when writing that sentence
Here's something to show that the first is even more annoying than the second in a language that has a macro for the first
should have been
Here's something to show that the second is even more annoying than the first in a language that has a macro for the first

Name: Anonymous 2010-09-03 18:20

>>1

Heard of a switch before?

Name: Anonymous 2010-09-03 18:33

>>19
inb4 another argument how switches need to have compile-time constants in them.

Name: Anonymous 2010-09-03 18:37

>>20
Only if you want to be able to optimize the switch using a hashtable of a binary tree of conditionals. Good languages don't require it, and instead have the compiler check if all the cases are constant, and if they are, apply whatever optimizations are possible, if they're not, just convert them into the usual if/else forms (or whatever it prefers internally).

Name: Anonymous 2010-09-03 18:55

>>21
Oh, is that so? But since >>1 used C, does it allow for non-constant cases?
Good languages should have a case ... of construct and pattern matching.

Name: >>21 2010-09-03 19:02

Erm, I meant jumptable. Although, using a hashtable/dictionary is not uncommon when switching on strings in some highlevel languages.
>>22
Nope, C89 doesn't allow non-constant cases, I'm unsure about C99 or newer.

Name: Anonymous 2010-09-03 19:06

>>1
I like how you can write waves if you do it like in the second example.
That is kawaii.

Name: Anonymous 2010-09-03 19:17

I tried writing a userscript today. Turns out you can't parse HTML fetched via XHR and use XPath if it's not also valid XML. It only works on documents you actually load with your browser. Fucking crap.

Name: Anonymous 2010-09-03 19:37

>>14
Here's your faggy cond:

>(defmacro cond-for-fags (&body body)
  (labels ((build-cond (x acc)
         (if x
         (build-cond (cddr x)
                 (list 'if (cadr x)
                   (car x) acc))
         acc)))
    (build-cond (nreverse body) nil)))

=> cond-for-fags

(cond-for-fags
  (> 0 666) (vector 6 6 6)
  (< 0 666) (+ 6 6 6))

=> 18

Name: Anonymous 2010-09-03 19:46

>>25
some time ago i came across a way around this problem but now i can't find it sorry

Name: >>3,21 2010-09-03 19:51

>>26

(defmacro less-useful-cond (&body body)
  `(cond ,@(loop for (test form) on body by #'cddr collect `(,test ,form))))

Here's a loop variant of your COND.

Name: Anonymous 2010-09-03 20:03

Somebody explain to me how (2) is supposed to me more readable.  I really prefer (1).

Name: Anonymous 2010-09-03 20:05

>>29
IHBMT

Name: Anonymous 2010-09-03 20:22

>>28
(defmacro fond (&body body)
  (prog ((conds (list 'cond)))
   mo
     (push (list (pop body) (pop body)) conds)
     (when body (go mo))
     (return (nreverse conds))))

Here's a goto variant of your cond.

Name: >>28 2010-09-03 20:39

>>31
Here's a DO one, since you like it low-level:

(defmacro dond (&body body)
  `(cond
     ,@(do* ((form nil (list (first body) (second body)))
             (forms nil (cons form forms))
             (body body (cddr body)))          
           ((null body) (nreverse forms)))))

Name: Anonymous 2010-09-03 20:50

>>32
lol sicp: '.,#"@((((((lol lol))) lol)))

Name: Anonymous 2010-09-03 21:14

>>33
Obvious troll is obvious, but your syntax is non-sensical:
' - same as (QUOTE ...)
. - only makes sense as part of a list, it's usually used to denote an improper list or just the CDR part of the list. It makes no sense in your code as it's outside of context (not in a list).
, - unquote, again, outside of context, this only makes sense within a backquote (`)
# - the significance of this is different in Scheme and CL (we were talking about CL in the previous posts, not Scheme, as one should be able to tell by the defmacro, nreverse, push, prog/go and other CL-only macros/special operators/functions. In CL, # is the generic dispatch macro character, and #" is specified as undefined. For more information see CLHS 2.4, especially CLHS 2.4.8 ( http://www.lispworks.com/documentation/HyperSpec/Body/02_dh.htm ).
" - by itself it would be the start of a string, but it's out of context
@ - does nothing by itself, it only makes sense as part of unquote-at (,@) when part of a backquote(`).

After this pointless line-noise which has no meaning, you placed a bunch of balanced parens containg 3 symbols within them, however such symbols are undefined, and if they were meant to represent code and not data, they would not make any sense in CL, as CL is a Lisp-2, not a Lisp-1 (expressions like (((a))) are usually not allowed, although, you could easily make your own Lisp with different semantics where this would be valid without putting too much effort into it, and there are already such libraries and Lisps).

tl;dr: Your contribution is meaningless and you would do well to go back to /b/.

Name: Anonymous 2010-09-03 21:26

>>34
All your post proves is that >>33-san read the secret chapter of SICP and you did not.

Name: Anonymous 2010-09-03 21:33

>>35
May I interest you in some World4chan Premium Gold memberships sir?

Name: Anonymous 2010-09-03 21:42

>>35
The secret chapter of SICP was written by the Anticudder alone, and therefore not to be trusted.

Name: Anonymous 2010-09-04 0:08

>>34
I think you just supported >>33's point, which is why I'm going back to newLISP

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.

Name: Anonymous 2010-09-04 2:32

if return
else return
// No return in lesser scope

Name: Anonymous 2010-09-04 2:59

>>40
RETURN INSIDE MY ANUS

Name: Anonymous 2010-09-04 4:23

>>40
You're an idiot.

Name: Anonymous 2010-09-04 5:04

>>42
Let me just take a moment to care what you think. Oh wait.

Name: Anonymous 2010-09-04 6:18

>>43
If you didn't care what people thought, you wouldn't have posted >>40. You expected someone to pat you on the back for it, but instead your opinion is just stupid.

Name: Anonymous 2010-09-04 18:30

Indenting your else ifs is retarded because they are in the same scope.

Real programming lanugages have switch statements.

Name: Anonymous 2010-09-04 18:35

>>45
If you think the two are comparable you don't understand switch statements.

Name: Anonymous 2010-09-04 18:52

Hi

What the love are you guys talking about.

Name: Anonymous 2010-09-04 20:53

Ewww, nested if statements.

How about case or switch?

Name: Anonymous 2010-09-04 21:04

>>47
:3c

Name: Anonymous 2010-09-05 0:33

>>48
see >>46

Or possibly you don't understand nested ifs.

Name: Anonymous 2010-09-05 3:25

>>39
real Lisp
that's a good one 3/10

Name: Anonymous 2010-09-05 8:24

>>44
Yawn.
Stuff that annoys you...
Not
Stuff you want validation of "the crowd" for...
Reading comprehension, motherfucker, do you speak it?

Name: Anonymous 2010-09-05 13:28

>>43,52
This sort of thing wasn't supposed to happen anymore now that schools are back in session. Is the weekend the new summer?

Name: Anonymous 2010-09-05 16:39

>>53
Mm. The delicious taste of defeat.

Name: Anonymous 2010-09-05 16:48

>>54
Sure, if you count that nonsensical statement in >>52 as a defeat.

Name: Anonymous 2010-09-05 17:29

I hate it when people obsessively use switches (especially when there are <5 cases).

Name: Anonymous 2010-09-05 17:41

switch (people.switch_usage) {
case OBSESSIVE:
    hate();
}

Name: Anonymous 2010-09-05 17:44

>>56
What would you prefer they use?

Name: Anonymous 2010-09-05 18:14

>>58
Non-deterministic Touring machines, which branch to every possible outcome.

Name: Anonymous 2010-09-05 19:10

>>59
But there is only one possible outcome: an anus gets haxxed.

Name: Anonymous 2010-09-06 4:24

i hate it when people say "readable" rather than "legible"

Name: Anonymous 2010-09-06 10:31

>>61
That's because your command of English is not so good.

Name: Anonymous 2010-09-06 20:59

bothers me to though I would be using case of most times

Name: Anonymous 2010-09-06 21:31

LOL ENGLIZH FAILZ IN DIS THRED LOL ^_^

Name: Anonymous 2011-01-31 20:48

<-- check em dubz

Name: Anonymous 2011-02-03 7:25

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