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

How to do this in Sepples?

Name: Anonymous 2011-08-14 12:58

iHaskal:
Data.Ix> range ((0,0), (3,4))
[(0,0),(0,1),(0,2),(0,3),(0,4),(1,0),(1,1),(1,2),(1,3),(1,4),(2,0),(2,1),(2,2),(2,3),(2,4),(3,0),(3,1),(3,2),(3,3),(3,4)]

Name: Anonymous 2011-08-14 16:50


// faggot_iteration.cpp
#include <cstdio>
int main() {
    std::printf("[");
    for (int i = 0; i <= 3; ++i)
        for (int j = 0; j <= 4; ++j)
            std::printf("(%d,%d)%c", i, j, (i * j) == 12 ? ']' : ',');
    std::printf("\n");
    return 0;
}

$ g++ -O2 -s -o faggot_iteration faggot_iteration.cpp
$ ./faggot_iteration
[(0,0),(0,1),(0,2),(0,3),(0,4),(1,0),(1,1),(1,2),(1,3),(1,4),(2,0),(2,1),(2,2),(2,3),(2,4),(3,0),(3,1),(3,2),(3,3),(3,4)]

Name: Anonymous 2011-08-14 16:57

>>10
Sorry, >>11-san here, I wrote up my response without first reading yours. My apologies. However, mine is more terse and does exactly what the OP's does, plus it's written in Sepples, at the cost of not being as flexible.

Name: Anonymous 2011-08-15 0:17

idjits

#include <string>

std::string A(int x1, int y1, int x2, int y2)
{
    std::string res = "[";
    char asdf[100];

    for (int x = x1; x <= x2; x++) for (int y = y1; y <= y2; y++) {
        sprintf(asdf, "(%d, %d),", x, y);
        res += asdf;
    }

    return res.substr(0, res.size()-1)+"]";
}

Name: Anonymous 2011-08-15 0:25

>>13
Enjoy your useless memory allocations on the heap.

Name: Anonymous 2011-08-15 0:48

>>14
implying heap allocations are slower than stack allocations

Name: Anonymous 2011-08-15 1:33

Shut up SHUT UP SHUT UP!! ALL OF YOU JUST SHUT THE FUCK UP

Name: Anonymous 2011-08-15 2:06

>>16
I will when you learn how to sage properly.

Name: Anonymous 2011-08-15 2:44

>>17
amidoinitrite?

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