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

functional programming considered stupid

Name: Anonymous 2007-08-26 22:27 ID:FF/bd/VM

learn a real language morans

Name: Anonymous 2007-08-27 22:27 ID:73wJdw8T

>>40
read it outloud

Name: Anonymous 2007-08-27 22:49 ID:dHvPCqr4

>>40

It's way smaller and with far less punctuation.  How is that less readable?

Name: Anonymous 2007-08-27 22:51 ID:0vpZNGVe

>>40
Well, by "readable enough" I really meant that a four line function is a lot easier to come to terms with than a umpty-ump line thing that provides no hint of what it's meant to do.

Name: Anonymous 2007-08-27 22:55 ID:Heaven

>>42
))))

Name: Anonymous 2007-08-27 22:57 ID:dHvPCqr4

Don't forget to add in the complexity of determining what size of array you need to pass in (*snicker*), allocating and deallocating it if it's on the heap (*laugh*), and having no good terminator so you have to (*haha*) manually pass around the length in a separate variable! (*BWAHAHAHAH!*)

Name: Anonymous 2007-08-27 22:59 ID:sjDaTVFi

Your mom loves the C

Name: Anonymous 2007-08-27 23:06 ID:73wJdw8T

>>45
You're an idiot, ever heard of sizeof you stupid shit.

Name: Anonymous 2007-08-27 23:13 ID:S5UfSz07

>>47
what?!

Name: Anonymous 2007-08-27 23:17 ID:Heaven

>>45
passing around the length has it's advantages. it makes the time complexity of determining the length of the list once you've filled it O(1) instead of O(n), for example.
also, for any number n, there aren't going to be more than log2(n) prime factors.

Name: Anonymous 2007-08-27 23:21 ID:S5UfSz07

then again...
typedef struct { int car; List* cdr; } List;
List* cons(int car, List* cdr)
{
   List* a;
   a = malloc (sizeof(List));
   a->car = car;
   a->cdr = cdr;
   return a;
}

List* factorAux(int n, int i)
{
      if (i > n) return NULL;
      else if divisible(n,i) return cons(i, factor(n/i, i));
      else return factor(n, i + 1);
}
List * factor(int n) { return factorAux(n,2); }

Name: Anonymous 2007-08-27 23:23 ID:Heaven

>>49
s/log2(n)/floor(log2(n))/

Name: Anonymous 2007-08-27 23:28 ID:dHvPCqr4

>>47

1) sizeof doesn't tell you how much memory is allocated to an array passed by int*.

2) even if it did, sizeof doesn't tell you how many entries are actually used in an array.

3) you stupid shit.

Name: Anonymous 2007-08-27 23:29 ID:dHvPCqr4

>>50

Yeah, now clean up your allocations after your done.  Now imagine that with a tree structure, and branches that might not have remained in the final result.

Name: Anonymous 2007-08-27 23:33 ID:S5UfSz07

still don't like it?
int factor(int n, int* array)
{
    int i = 2;
    int* begin = array;
    while(!(i > n))
    {
        if(divisible(n,i)
        {
           *array++ = i;
           n \= i;
        }
        else i++;
    }
    return array - begin;
}

Name: Anonymous 2007-08-27 23:47 ID:73wJdw8T

>>52
you've proven yourself a worthy ... IDIOT.

sizeof(x)/sizeof(x[0])

Did you lose your brains? Ever heard of division, you simpering mental midget?

Name: Anonymous 2007-08-27 23:48 ID:73wJdw8T

ITT You're stupid to understand C

Name: Anonymous 2007-08-27 23:52 ID:dHvPCqr4

>>55

LOL.  Sure, buddy.  Pop quiz:  what does "sizeof(x)" return when x is an int*?

Name: Anonymous 2007-08-27 23:57 ID:Heaven

>>57
4, lol

Name: Anonymous 2007-08-28 0:14 ID:9ZIqYA1o

>>57
int* is not an array you fucking retard

Name: Anonymous 2007-08-28 0:49 ID:bli9XnBp

LOL ok there buddy, so what would happen if I replaced sizeof with malloc?

Name: Anonymous 2007-08-28 1:44 ID:BnpZkfT/

>>60

#include <stdio.h>


int main(int argc, char **argv)
{
    int * x;
    x = (int *)malloc(sizeof(int));


    printf("%d", malloc(x)/malloc(x[0]));
    return 0;
}


LOL ok buddy heres what happens!

Name: Anonymous 2007-08-28 1:54 ID:3raWT+jv

>>59

>>47 was claiming sizeof would work for the "array" parameter in >>34 which is actually int*.

PROTIP, 73wJdw8T:  int* is not an array you fucking retard

Name: Anonymous 2007-08-28 5:54 ID:Heaven

int * is the same as array of int

Name: Anonymous 2007-08-28 6:15 ID:ztW4NFvI

Not quite. But very nearly.

Name: Anonymous 2007-08-28 7:14 ID:zT4e3GLX

>>61
LOL, You casted malloc NOOB

Name: Anonymous 2007-08-28 7:56 ID:Heaven

>>63
no it is not.
int * is a pointer to an int
int[] is an array of int's of unspecified size

read the first example at http://4-ch.net/code/kareha.pl/1187046689/17
(i'm 17 there)

Name: Anonymous 2007-08-28 8:34 ID:BnpZkfT/

>>66

array[3] == *(array + 3)

you damn dirty n00b

Name: Anonymous 2007-08-28 8:53 ID:e6cTFjmc

volatile auto const *(int(** const ********const [][]*const int(****void[])*[]int[][])) var

OMG I THINK I FOUND JESUS

Name: Anonymous 2007-08-28 9:13 ID:ob/wfa2c

>>68
OMG I don't see him, where‽ Can you give us a pointer?

Name: Anonymous 2007-08-28 9:25 ID:Heaven

>>69
I lol'd

Name: sage 2007-08-28 9:36 ID:9ZIqYA1o

>>61
>>63
>>67
Wow, you're such an idiot. You don't understand the semantic difference do you. They are similar yet in the standard they are not the same. You fail. Even worse your stupid idiotic code:

printf("%d", malloc(x)/malloc(x[0]));

Good job asshole, printing %d of whatever random value is in x? You just probably just tried to allocate millions of bytes of memory, twice! Or divide by zero if you're lucky.

You're owned, beaten, embarassed, even worse: YOU'RE WRONG. Get the fuck out of /prog/ you goddamn idiot, you can't even code your way out of an example.

Name: Anonymous 2007-08-28 9:45 ID:Kc1/6BO7

>>61
>>63
>>67
Wow, you're such an idiot. You don't understand the semantic difference do you. They are similar yet in the standard they are not the same. You fail. Even worse your stupid idiotic code:

<?php echo "welcum 2 my website"; HitCounter(); ?>

Good job asshole, printing a dumb welcome message. You just probably just tried to allocate millions of bytes of memory, twice! Or divide by zero if you're lucky.

You're owned, beaten, embarassed, even worse: YOU'RE WRONG. Get the fuck out of /prog/ you goddamn idiot, you can't even code your way out of an example.

Name: Anonymous 2007-08-28 10:44 ID:NlNof81+


>>71
well, >>63 isn't me but >>67 and >>61 are the same troll. so congratulations you won

Name: Anonymous 2011-08-31 14:11

Evidence >>>/prog/ was never good

Name: Anonymous 2011-08-31 14:36

>>74
That's evidence /prog/ was programming related at some point.

Name: Anonymous 2011-08-31 15:39

This thread is considered stupid.

Learn to safe faggots.

Name: Anonymous 2011-08-31 15:42

DUBZTEP

Name: Anonymous 2011-08-31 15:45

>>77
I laughed, but then I vomitted a little in my mouth.

Name: Anonymous 2011-08-31 15:50

>>78
I hope you choke on it.

Name: 1000 posts 2011-08-31 19:35


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