mutating loop variables side effects in for-loop header language has null pointers
Pig disgusting.
Name:
Mentifex2015-05-03 13:54
#!/usr/bin/perl use strict; # PERL by Example (2015) p. 77 use warnings; # PERL by Example (2015) p. 85 our $cns = 32; # size of AI memory for central nervous system. our $IQ = 0; # PERL by Example (2015) p. 689 our @aud = " "; # PERL by Example (2015) p. 17: auditory array our $t = 0; # Lifetime experiential time "$t" sub AudInput; # PERL by Example p. 351 Forward declaration sub sensorium; # PERL by Example p. 351 Forward declaration sub think; # PERL by Example p. 351 Forward declaration sub VisRecog; # PERL by Example p. 351 Forward declaration TabulaRasa: { # PERL by Example (2015), p. 204: Labels my $trc = 0; # $trc variable is "tabula rasa counter". print "Size of experiential memory is $cns \n"; # Increase as needed. until ($trc == $cns) { # PERL by Example (2015), p. 193: "Loops". $aud[$trc] = " "; # Fill CNS memory with blank spaces. $trc++; # PERL by Example (2015) p. 21: autoincrement $trc. } # End of loop filling auditory memory with blank engrams. } # End of TabulaRasa "clean slate" sequence. EnBoot: { # http://mind.sourceforge.net/enboot.html $t = 0; # English Bootstrap sequence stretches over mental time "$t". print "English bootstrap is loading into memory... \n"; $t = 0; $aud[$t] = "H"; # Indexing of array begins with zero. $t = 1; $aud[$t] = "E"; # Single elements of array use $aud not @aud. $t = 2; $aud[$t] = "L"; # PERL by Example (2015), p. 95: Elements $t = 3; $aud[$t] = "L"; # AudMem() stores new words at higher $t values. $t = 4; $aud[$t] = "O"; # Bootstrap "HELLO" is not permanently here. $t = 5; # A blank gap is necessary between words. $t = 6; # More bootstrap words will be needed. }; # http://code.google.com/p/mindforth/wiki/EnBoot while ($IQ < 8) { # PERL by Example (2015), p. 190 sensorium(); # PERL by Example p. 350: () empty parameter list think(); # PERL by Example p. 350: () empty parameter list } # End of main loop calling mind.pl Strong AI subroutines sub sensorium() { # Start sensory input through sensory modalities. print " Sensorium: Calling AudInput subroutine: \n"; AudInput(); # PERL by Example p. 350: () empty parameter list # VisRecog(); -- non-existent subroutine is shown but commented out } # End of sensorium subroutine in Perl artificial intelligence sub AudInput() { # As if keyboard input were auditory hearing. print " AudInput: Enter new IQ: "; $IQ = <STDIN>; # PERL by Example (2015), p. 50 } # End of auditory input for human-computer interaction sub think() { # Start showing output as if generated by thinking. print "Think: My IQ is now $IQ"; } # http://ai.neocities.org/AiSteps.html
>>12 Why should it display any warnings? It looks okay to me.
Name:
Anonymous2015-05-04 17:33
>>14 Well, for example, print takes two parameters, i and j. Neither has type specified (defaults to int). And it's called with only one parameter.
It's insane that this even compiles at all. C is fucked up language.
Name:
Anonymous2015-05-04 17:34
//superior #include <stdio.h> #include <unistd.h> #define LEN 15 int print(i,j) { for (; i < LEN; ++i) putchar(' '); puts("O O O O"); usleep(20000); return 0; } int main(void) { int i, j; for(;;) { for (j = 0; j < LEN; print(i), ++j) i = j; for (j = 0; j < LEN; print(i), ++j) i = LEN-1-j; } return 0; }
} main(){ st:; int i,j; for ( j = 0; j++ < LEN; print(i=j)); for (j = 0; j++ < LEN; print(i=LEN-1-j)); goto st;}
Name:
Anonymous2015-05-04 18:25
Best so far.
#include <stdio.h> #include <unistd.h> #define LEN 15 int print(int i) { for (; i < LEN; ++i) putchar(' '); puts("O O O O"); usleep(20000); return 0; } int main(void) { int i, j; for(;;) { for (j = 0; j < LEN; print(i), ++j) i = j; for (j = 0; j < LEN; print(i), ++j) i = LEN-1-j; } return 0; }
Why would I even want that? The C program runs fine and probably orders of magnitude faster. And works by default with any standard C compiler in the OS, no need to all this Haskell mess. Say no to bloat.
Name:
Anonymous2015-05-04 20:54
>>30 Isn't Haskell compilers a bunch of .c/.h files in the end?
orders of magnitude faster most of the time is spent sleeping
Well aren't you the Shit-Coder Supreme.
Name:
Anonymous2015-05-05 19:32
>>38 You can't even form proper prose without recurring to imageboard memes, what makes you think you have the right to say that?
Name:
Anonymous2015-05-05 19:39
>>39 I've seen implicit quoting way before I came to imageboards, newfag. Also it's no more of a meme than BBCodes or putting dots at ends of sentences.