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

Official Language Bashing Thread

Name: Anonymous 2011-01-03 13:52

I CHOOSE YOU MEGATROLL

Name: Anonymous 2011-01-07 3:05

>>34
Lousely copy-pasta'd >>29-san
0/10

Python also has a metacircular interpreter which is faster than the C one
You and me, my friend, know this is complete and utter bullshit.

Name: Anonymous 2011-01-07 3:10

>>41
Python
ONE WORD.

Note that >>29 didn't mention Lisp.

Name: Anonymous 2011-01-07 4:09

>>42
Because Lisp is universal and you can write an OS in it. But C/C++ is the standard, like COBOL or Java. One may not like C/C++, but he really have no choice, but to conform.

Name: Anonymous 2011-01-07 4:11

Name: Anonymous 2011-01-07 4:30

>>43
I like it how you imply that C and/or C++ weren't selected because they're well tested, but because they were "suddenly the standard". As if that happened as simple as that.

Name: Anonymous 2011-01-07 4:44

>>45
C/C++ was selected because of hype. Just like Java and COBOL.

Name: Anonymous 2011-01-07 4:50

>>46
Besides, many people love writing this endless `if ... then ... end` and "for (...;...;...) ..." boilerplate, because it makes them feel like they are doing a big amount of work. Unfortunately, most of their work is a useless struggling with their language.

Name: Anonymous 2011-01-07 4:52

>>46
And Go.

Name: Anonymous 2011-01-07 5:01

>>47
Control structures are the worst part about C. If they removed all those pointless ifs and fors the language would be much better!

Name: Anonymous 2011-01-07 5:02

>>48
No one really uses Go though.

Name: Anonymous 2011-01-07 5:04

>>49
if could be replaces with pattern matching and for with usual map and fold.

Name: Anonymous 2011-01-07 5:09


fac n -> n != 1 |> {true?  -> n*(fac n-1)
                    false? -> 1}

and no ifs at all.

Name: Anonymous 2011-01-07 5:43

>>52
Is that ``in Lisp''?

>>49
If C had True macros, if and goto would suffice for everything. And you would also have unless, until, etc.
Seriously, why don't they put a decent preprocessor in C1x?

Name: Anonymous 2011-01-07 5:45

>>53
C/C++ cant have closures and continuations.

Name: Anonymous 2011-01-07 5:46

>>54
Even crappy Pascal allows simple downward funargs, but not C/C++.

Name: Anonymous 2011-01-07 5:52

>>54
Something like:
#macro while (cond) { block }
  @start: // @labels are hygienic.
    { block }
    if (cond) goto @start;
#endmacro

doesn't need closures nor continuations.

Name: Anonymous 2011-01-07 5:53

>>56
garbage in, garbage out.

Name: Anonymous 2011-01-07 5:57

>>56
Nigga wanted while, not do while

Name: Anonymous 2011-01-07 6:03

>>58
M-x transpose-lines

Name: Anonymous 2011-01-07 6:09

Disregard >>59, @start: if (!cond) goto @end; { block } goto @start; @end:

Name: Anonymous 2011-01-07 7:56

>>52

int fac(int n){
  return (n <= 1? 1 : n * fac(n-1));
}


no ifs at all

you 'mirin my parentheses?

Name: Anonymous 2011-01-07 8:17

>>61
"?:" is an if

Name: Anonymous 2011-01-07 8:22

To simulate >>52 in C, one would have to do

fac_branches[n<=1](n)

Name: Anonymous 2011-01-07 8:22

>>62
Don't tell me, tell >>52. Although if >>52 didn't use a boolean, a switch/case statement would've been more suitable.

Name: Anonymous 2011-01-07 8:31

>>62
int fact(int n){
 return (n && (n*fact(n-1))) || 1;
}

Name: Anonymous 2011-01-07 8:39

>>65
There "&&" compiles to `if`.

Name: Anonymous 2011-01-07 8:44

>>66
``Pattern matching'' compiles to `if'.
There is no x86 instruction called `if'.

Name: Anonymous 2011-01-07 8:45

>>64
You should read about concatenative programming languages, bottom-up design and combinatory logic. Also, look at neural networks and ICs, they dont use the `if` concept. Historically `if` came from mathematics, because some old faggots wanted programming languages to look like math.

Name: Anonymous 2011-01-07 8:45

>>67
It can compile to table lookup.

Name: Anonymous 2011-01-07 8:57

>>69
int fact_0(int n) { return 1; }
int fact_n(int n) { return n*fact(n-1); }
int (*fact_t)(int) = { fact_0, fact_n };

int fact(int n) { return fact_t[n<=1](n); }

Name: Anonymous 2011-01-07 9:05


x.{positive? ->  1
   zero?     ->  0
   negative? -> ~1}

Name: Anonymous 2011-01-07 9:07

>>70
That int (*fact_t)(int) should be int (*fact_t[])(int).

Also, here's the Ackermann function, so you won't bitch about ``you can use it only with functions with one condition'':
int ack(int,int);
static inline int ack_00(int m, int n) { return n+1; }
static inline int ack_10(int m, int n) { return ack(m-1, 1); }
static inline int ack_11(int m, int n) { return ack(m-1, ack(m, n-1)); }

int (*ack_t[][])(int,int) = { { ack_00, ack_00 }, { ack_10, ack_11 } };

int ack(int m, int n) { return ack_t[m>0][n>0](m,n); }

Name: Anonymous 2011-01-07 9:08

>>71
As expected, see >>72.

Name: Anonymous 2011-01-07 9:12

>>71
int f(int x);
static inline int f_00(int x) { return 0; }
static inline int f_10(int x) { return 1; }
static inline int f_11(int x) { return ~1; }
int (*f_t[][])(int,int) = { { f_00, f_00 }, { f_10, f_11 } };

int f(int x) { return f[x!=0][x<0](x); }

Name: Anonymous 2011-01-07 9:14

>>74
*f_t[x!=0][x<0](x);

Name: Anonymous 2011-01-07 9:18

>>72>>74
Writing code it such style would get you fired.

Name: Anonymous 2011-01-07 9:22

>>76
I think the point is that this could be how some potential generated code for pattern matching looks. Generated code is rarely ever pretty, however I can't say his code is unreadable.

Name: Anonymous 2011-01-07 9:26

>>76
What? It's pattern matching, it's superior style![1]

---
[1] >>51

Name: Anonymous 2011-01-07 9:41

>>77
Yes. Pattern matching usualy implemented as a state machine (switching on tables), but evil team leads would forbid using generated code as well as generating it from your DSL, using YACC.

Name: Anonymous 2011-01-07 9:51

>>79
Say that to >>51,52,62,66,69,71,73.
Also, using goddamn ifs is saner.

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