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

Pages: 1-4041-

It's time to troll some more...

Name: Anonymous 2011-08-07 2:25

Symta:

chr [0..127]


Perl:

say map {chr($_)} 0..255;


Ruby:

(0..127).each { |n| p n.chr }



PHP:

echo join(array_map('chr', range(0, 127)));


Scheme:

(build-list 127 (lambda (x) integer->char(+ x 1)))


Haskell:

main = print $ map (toEnum :: Int -> Char) [0..127]


Python:

print reduce(lambda x, y: x + chr(y), xrange(1,128), "")


Bash:

for i in `seq 1 127`; do printf \\$(printf '%03o' $i); done


C/C++:

#include <stdio.h>
int main()
{
    char c;
    for (c = 0; c < 127; c++)
        putchar(c);
    putchar('\n');
    return 0;
}

Name: Anonymous 2011-08-07 2:28

and this shall tell us...?

Name: Anonymous 2011-08-07 2:33

>>2
...that ur mom is a whore.

Name: Anonymous 2011-08-07 2:35

im ← ∘.=⍨∘⍳

Name: Anonymous 2011-08-07 6:17

255
127


WHBT

Name: Anonymous 2011-08-07 12:01

lol, over-implicit shit languages everywhere!
HAIL C!

also: putchar('\n'); - does this mean that the other languages do a newline after they print out all the chars or after every single char...?

Name: Anonymous 2011-08-08 0:06

>>6>>5
It is a crosspost from http://www.0chan.ru/c/res/193865.html

I did only the Symta one, which, btw, is equivalent to matlab's char(0:127), due to similarities between two languages.

Name: Anonymous 2011-08-08 0:54

Haskell:

['\0'..'\127']

Name: Anonymous 2011-08-08 1:00

>>8
HQ9+A:

A

Name: Anonymous 2011-08-08 2:32

(^256)>>.chr

Name: Anonymous 2011-08-08 3:48

Python:
print "".join(map(chr, xrange(0, 127)))

On second thought, it looks exactly like the PHP one.

Name: Anonymous 2011-08-08 4:44

what an interesting piece of code, but can you write these examples in Visual Basic or ADA?

Name: Anonymous 2011-08-08 7:40

"characters are numbers" is a pretty useless abstraction.

Name: Anonymous 2011-08-08 10:02

$ wget http://www.golfscript.com/golfscript/golfscript.rb
2011-08-08 15:58:37 (53.6 KB/s) - “golfscript.rb.1” saved
$ echo "128,+" >code.gs
$ ruby golfscript.rb code.gs
<>"


 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~


5 bytes, In Lisp Guy. Now go away.

Name: Anonymous 2011-08-08 10:34

>>9
faggot


Prelude> ['\0'..'\127']
"\NUL\SOH\STX\ETX\EOT\ENQ\ACK\a\b\t\n\v\f\r\SO\SI\DLE\DC1\DC2\DC3\DC4\NAK\SYN\ETB\CAN\EM\SUB\ESC\FS\GS\RS\US !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\DEL"

Name: Anonymous 2011-08-08 13:41

>>11
This is the Pythonic way:
print ''.join(chr(n) for n in xrange(127))
Python's map returns a list while [elem] for [elem] in [iterable] returns a more efficient generator.

Name: Anonymous 2011-08-08 13:51

I prefer the C implementation (I don't know why OP called it "C/C++" except to troll I guess).  I like the fact that you have to #include an I/O library.  I don't like the fact that the other languages all just assume that I'm doing text-based I/O, whether I am or not.

Name: Anonymous 2011-08-08 14:12

>>17
#include an I/O library
One doesn't #include a library, one does #include header files declaring the library's functions and defining related macros, inline functions, or types.

Name: Anonymous 2011-08-08 14:27

>>16
no the Pythonic way is to import an alphabet printing function.

Name: Anonymous 2011-08-08 15:18

>>18
But you still have to link it in.

Name: Anonymous 2011-08-08 15:57

1.1.  Author's Note

   This document is written in XML using an NNTP-specific DTD.  Custom
   software is used to convert this to RFC 2629 [RFC2629] format, and
   then the public "xml2rfc" package to further reduce this to text,
   nroff source, and HTML.

   No perl was used in producing this document.

Name: Anonymous 2011-08-08 16:00

program a;
{$mode objfpc}
var i: byte;
begin
   for i in [0..127] do
      write(chr(i));
   readln;
end.

Name: Anonymous 2011-08-08 16:05

>> 22
Shit. Forget the readln;

Name: Anonymous 2011-08-08 16:19

Perl reloaded:
say map chr,60..127

Name: Anonymous 2011-08-08 16:38

Java?

Name: Anonymous 2012-03-02 10:08

//package org.4chan.dis.prog;

import java.nio.CharBuffer;
import java.nio.BufferUnderflowException;
import java.nio.BufferOverflowException;

public class PrintChars {
    public static void main(String[] args) {
        Integer minimumBound = new Integer(0),
                maximumBound = new Integer(128);

        CharBuffer agile = CharBuffer.allocate(maximumBound.intValue());
        for (int i = minimumBound.intValue();
                i < maximumBound.intValue();
                i = i + new Integer(1).intValue())
        {
            int codepoint = i;
            int width = Character.charCount(codepoint);
            if (width > 1) {
                Integer integerCodepoint = new Integer(width);
                String integerCodepointString = integerCodepoint.toString();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("Codepoint ");
                stringBuilder.append(integerCodepointString);
                stringBuilder.append(" is too long for CharBuffer");
                stringBuilder.ensureCapacity(stringBuilder.length());
                stringBuilder.trimToSize();
                String message = stringBuilder.toString();
                IllegalArgumentException illegalArgumentException =
                    new IllegalArgumentException(message);
                throw illegalArgumentException;
            }

            char[] characters = Character.toChars(codepoint);
            assert(characters != null);

            if (characters.length < 1)
                throw new BufferUnderflowException();
            if (characters.length > 1) {
                BufferOverflowException nullPointerException;
                nullPointerException = new BufferOverflowException();
                try {
                    nullPointerException.printStackTrace();
                } catch (Exception exception) {
                    // Returns false
                }
                nullPointerException = null;
                throw nullPointerException;
            }

            agile.append(characters[0]);
        }
        System.out.println(agile);
        System.exit(0);
        // for (char c = '\u0000'; c < '\u0127'; c++)
        //     System.out.print("" + c);
    }

}

Name: Anonymous 2012-03-02 10:26

Now in D !

void main(){import std.stdio; for(int i=0;i<127;i++) writeln(i);}

Name: Anonymous 2012-03-02 10:27

>>27

void main(){import std.stdio; for(char i=0;i<127;i++) writeln(i);}

Name: Anonymous 2012-03-02 10:48

C99:
#include <stdio.h>
int main(void) { for (char c = 0; c < 127; c++) putchar(c); }


Perl:
my $x; #needlessly declare variable outside of loop
foreach $x (0..127)
{ #put brace on next line to give appearance of more code
     print(chr($x));
}
print "\n"; #add a newline - one more line of code
exit 0; #redundantly specify default exit status

Name: Anonymous 2012-03-02 11:05

>>29
u w0t m8?
say map chr,60..127

Name: Anonymous 2012-03-02 11:22

>>30
syntax error at - line 1, near "say map"
Execution of - aborted due to compilation errors.

That isn't Perl 5, ``faggot''.

Name: Anonymous 2012-03-02 11:34

J: u:i.127

Step off.

Name: Anonymous 2012-03-02 11:38

My own toy language:


>>{0,127,u1,x}<<

Name: Anonymous 2012-03-02 11:51

My own toy language:

x

Name: Anonymous 2012-03-02 12:01

My own toy language:

Name: Anonymous 2012-03-02 13:00

APL:
Atomic Vector (Implementation-dependent):
⎕AV[⍳127]
Unicode:
⎕UCS ⍳127

Name: Anonymous 2012-03-02 13:47

>>31
use feature 'say';

Name: Anonymous 2012-03-02 14:45

>>37
Then the code would be:
use feature 'say';
say map chr,60..127

Name: Anonymous 2012-03-02 14:45

>>37
So the real script is...

use feature 'say';
say map chr,60..127;


Two lines.

Name: 39 2012-03-02 14:46

>>38
....motherfucker

Name: Anonymous 2012-03-02 17:06

>>39
print map chr,60..127;

Name: Anonymous 2012-03-02 19:34

>>15
putStrLn ['\0'..'\127']

Name: Anonymous 2012-03-02 20:45

>>44
nice dubs bro

Name: Anonymous 2012-03-02 20:59

hax my anus

Name: Anonymous 2012-03-03 0:17

>>44
Wasted dubs.

Name: Anonymous 2012-03-03 0:24

>>45
Dasted wubs.

wubwubwubwubwubBASSDROPWUBWUBWUBWUB

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