Apr. 6th, 2014

davv: The bluegreen quadruped. (Default)
Oh dear, am I tired. (I made some pretty silly test mistakes a few weeks ago, also. Always read the questions in detail, folks![1])

I will say this, however: The functional programming I'm learning about (not what I had a test in) seems to be coloring my thoughts pretty significantly at the moment, because I used some of today's time wondering how to make a C-alike language that would support a more functional style... and I came up with odd syntax like

void foo(int x, int y) = { cout << x << ", " << y << endl; }

("And all functions are simply variables in the global scope") and

void bar() = {
    void foo(int a) = { return(a + 1); }

    int an_array[3] = {1, 2, 3};

    // increments every element in an_array by 1.
    imperative_map(an_array, foo, 3);

    for (int i = 0; i < 3; ++i) {
        cout << a_list[i] << endl;
    }
}


But there might be a language that does this already. Though to be powerful enough, this hypothetical C variant should also support type inference, so that higher order functions like imperative_map can work on any and all types. Either that, or it's typename<T> time!

Er, yeah.

Read more... )

March 2018

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 2nd, 2025 11:47 pm
Powered by Dreamwidth Studios