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

Pages: 1-

JavaLisp

Name: Anonymous 2012-06-25 3:32


function Account(balance) {
    function deposit(amount) {
        balance += amount;
    }
    function withdraw(amount) {
        balance -= amount;
    }
    function dispatch(msg) {
        switch (msg) {
            case 'deposit': return deposit;
            case 'withdraw': return withdraw;
        }
    }
    return dispatch;
}

acc = Account(300);
acc('deposit')(50);
acc('withdraw')(10);

Name: Anonymous 2012-06-25 4:13

Disgusting!

Name: Anonymous 2012-06-25 4:28

I'd rather program in JavaHaskell.

It combines cutting-edge best practices of OOP (Objection-oriented programming for you CS types) with the most novel and hip features such as lambada calculus and list comprehensions.

Name: Anonymous 2012-06-25 7:23


<?php

$account = function ($balance) {
    $deposit = function ($amount) use ($balance) {
        $balance += $amount;
        return $balance;
    };
    $withdraw = function ($amount) use ($balance) {
        if ($amount > $balance) {
            return 'Insufficient Funds';
        } else {
            $balance -= $amount;
            return $balance;
        }
    };
    $dispatch = function ($message) use ($deposit, $withdraw) {
        $table = ['deposit' => $deposit, 'withdraw' => $withdraw];
        return $table[$message];
    };
    return $dispatch;
};

$acc = $account(500);

// PHP doesn't allow function chaining...
$deposit = $acc('deposit');
$deposit(50); // => 550

$withdraw = $acc('withdraw');
$withdraw(50); // => 500

Name: Anonymous 2012-06-25 7:29


forgot to pass by ref
<?php

$account = function ($balance) {
    $deposit = function ($amount) use (&$balance) {
        $balance += $amount;
        return $balance;
    };
    $withdraw = function ($amount) use (&$balance) {
        if ($amount > $balance) {
            return 'Insufficient Funds';
        } else {
            $balance -= $amount;
            return $balance;
        }
    };
    $dispatch = function ($message) use ($deposit, $withdraw) {
        $table = ['deposit' => $deposit, 'withdraw' => $withdraw];
        return $table[$message];
    };
    return $dispatch;
};

$acc = $account(500);

// PHP doesn't allow function chaining...
$deposit = $acc('deposit');
echo $deposit(50); // => 550

$withdraw = $acc('withdraw');
echo $withdraw(50); // => 500

Name: Anonymous 2012-06-25 7:32

PHP doesn't allow function chaining...
Even C allows it. PHP truly is amazingly bad.

#include <stdio.h>

int (*get_puts(void))(const char*)
{   
        return puts;
}

int main()
{
        get_puts()("Hello, world!");
        return 0; 
}

Name: Anonymous 2012-06-25 7:59

WHY ARE YOU WRITING CODE LIKE THIS

Name: Anonymous 2012-06-25 8:31

>>6
Hello, get_puts, can you return Eric Raymond for me?

Name: Anonymous 2012-06-25 9:13

get_putsch(Munich, 1923);

Name: Anonymous 2012-06-25 12:15

摢ᅇ挄儅熈睐树㥳ѹܤ灅剦᝴蔠啥㝠Γ夆妒ᙕ灖㑨閇ጵ㞇䄥᥂ڂ桳値げ衘ᆉ衑㜅脣‡℆瑹膒䤨襉牦䘒䄙䉃鈁ل㌔㚃圵蕉攖䝶⍲靅銀扔蜶器ࡵܶ瘢兂蕅瘧坄舅␥瞃爘ႆॣ‚䖗⡷ᝰ熃研酱碀ㄒ玆膔皓ሥ蜇䂇瞗䥥䘴血ᜒቈ戅荕疗ɱᄴ䀒㦃悄噔咄薔頡蜹ံ䌥•蒒所ፁ桴ঃ⁐ر䌕畴ᝂᦙ⁴桓犖酅晐➅㔀ͨ॓錠⁙ᒂ⑈扖陀甶Ιद剁咁ለ靐⊀ᄤ匹㤢硶▓ࡶ啂ᙠ䜶套餙爴噖掔ၹ牂╤আ㞒☓芔䉸戨鈵熐㘉ࡲ═Y晧酑㑄ㄅ閆玀眴ႄࠧᎃぢ礣ᔒ〔頖䦀卂耨蜉ݕ〷恔ᢘ肇睂‑癤梂晧ᝆ≹靨蜳ؕ鍧覑┃ु覀⡖砈险ᙒ儂ᅙ䚈碔襤㘑慦ᄃ㞃〧鍕ᔡ᠁⦔眱恈圖捆㑃в㡇楗桁䚐夤坧鄹匵虡㚙楃霂ŸهⅥ舓䍨⍠հㆈ㞕ᄡV┥禃瘳吉頔ґ昈ŗ㜗慘ܙ℆鍔ሦᡳ撉靗♓啉䑗朵䖈㍨䂈⢑牃ր硇襓も䕨睦戵㡅睂蠢充⥂虧䞆㊒

Name: Anonymous 2012-06-25 12:42

≅⥷呢蜑ሱ戡茹h各ᜂ剨䆀镢Ɂᤐ怠ख़傂ᢇ颉䙄ॴㅐ扉蘱撔晓ቄ眦瑈䝙ᄐ堠昱┴匆≅䘐睔ⁱᒀ礈刳䍓й腠⁨掐ᔔ؁餢扢瀖ेㅱ塉倲㜣։䝇│ㅨ嘠∡ᝐ蕲偆▐鉴䅹钆䁃䖀聗頣螃青閇艳虘䡦㊘᠔ԗ⍱饗倡噑鑨楇䄦茰ၕ✒㡐茙匣䌸陴坥葰ↁ〣奆Ȇ㑳散ƈ虓ㄔ䙃䤕墅጗榕ք瀲㌸獇战䕓ᤵ瀢榀ㄠ᝘╒ȴ琕唑锵㖃眷㖁㉩ᖑ⤳圐焗ā夢敷楠枃ٙބ馆噰▐٢䔷妈䖉㄰搸噈䦗䞔፩㡃ݖ嚔䔆䔖ち唀䠡钓ࡱ䕳鑥錉恉⦂逘愳ᔁ㝱䌴鄵䘤䌹㑧蠐悄蔙ŗ愖戰ᦄ摰馅ኆ᝸嘂؈嘱Ģ虗ᦗ鄓厗䝅㥰㠗ɘ⍕摅⦀㙘➑᝙厂垀㡩晥聉䜧倃₄቉鈨Ē㝵ↅᢉ䔧㘤ĸ匦砓愃㥆ŕ瑹㌗霦耓䑱遀摒ȡ钓蝶い慄ى%ႀ禁а㄁餙䆂酲栀眷݃猈堀Ѕ㥣酙❹ቡ噃ᅹ㙖㜶鞑░炙䤐㡹↙㊄ᐔ⦙ࡩ牗桴砗ᐹ霂敐傁琵䎖瑦㈔ᠥ⌂ᜀ灲㊓䑀聒⡘ࠣ᥈

Name: bampu pantsu 2012-06-26 3:01

bampu pantsu

Name: bampu pantsu 2012-07-06 5:02

bampu pantsu

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