Return Entire Thread First 100 Posts Prev 100 Next 100 Last 50 Posts Report Thread Style: Yotsuba, Pseud0ch, Terminal

Pages: 1-40 41-80 81-

..and you said java dont curry

1

   public class Currier<ARG1, ARG2, RET> {
       public interface CurriableFunctor<ARG1, ARG2, RET> {
           RET evaluate(ARG1 arg1, ARG2 arg2);
       }
  
       public interface CurriedFunctor<ARG2, RET> {
           RET evaluate(ARG2 arg);
       }
  
       final CurriableFunctor<ARG1, ARG2, RET> functor;
  
       public Currier(CurriableFunctor<ARG1, ARG2, RET> fn) { functor = fn; }
      
       public CurriedFunctor<ARG2, RET> curry(final ARG1 arg1) {
           return new CurriedFunctor<ARG2, RET>() {
               public RET evaluate(ARG2 arg2) {
                   return functor.evaluate(arg1, arg2);
               }
           };
       }
  
       public static void main(String[] args) {
           Currier.CurriableFunctor<Integer, Integer, Integer> add
               = new Currier.CurriableFunctor<Integer, Integer, Integer>() {
                   public Integer evaluate(Integer arg1, Integer arg2) {
                       return new Integer(arg1.intValue() + arg2.intValue());
                   }
           };
          
           Currier<Integer, Integer, Integer> currier
               = new Currier<Integer, Integer, Integer>(add);
          
           Currier.CurriedFunctor<Integer, Integer> add5
               = currier.curry(new Integer(5));
          
           System.out.println(add5.evaluate(new Integer(2)));
       }
   }

2

Oh jeez, that's ALL it takes? Damn, I must switch to Java. That one line it takes in Haskell pales in comparison to this ENTERPRISE CODE.

3

What if it has more than two arguments?

4

The second argument becomes another curried object.

You can do a similar action in C++ but with a little less code.

5

LOL LINKED FROM REDDIT

HI REDDIT

6

Who the fuck posted this on reddit.
Rules 1 & 2?

7

ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!!

ahhhhk ack ack ack? ACK AAAACKKK!!!!


ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!

ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!

ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!ACK!! ahhhhk ack ack ack? ACK AAAACKKK!!!! ACK ACHHHHHK ack ackkkkkkk!!!! ack ack? ack ACKKKKKKKKKKKKKKKKK!!! ack ack AHHHHK AAAAAHHH AAAHHHHH ACK! ACK!???!

8

VIP QUALITY

9

>>6
This isn't Fight Club.

10

>>6
the first of 4chan is you do not talk about shitty posts outside of 4chan

11

>>1 is Enterprise Scalable Professional Business Curry 2.0. ACM (Advanced Curry Management) enables your enterprise to cut operation costs by discovering business logic earlier in the software management cycle, thus allowing for a higher return of investment in your business.

Java is VIP quality. It has about the worst programming language ever created after MS-DOS batch and Spectrum Basic.

12

Egads. I know this is Java, but srsly, how could they screw up this badly?

13

Oh jeez, that's ALL it takes? Damn, I must switch to Java. That one line it takes in Haskell pales in comparison to this ENTERPRISE CODE.

I can just see every ENTERPRISE switching to Haskell for all their needs since it can curry in one line. Ha Ha Ha Ha You chimps are killing me.

14

Java can do the same thing in one line too. Here's the program. It's word wrapped, but one line nevertheless:
public class Currier<ARG1, ARG2, RET> { public interface CurriableFunctor<ARG1, ARG2, RET> {  RET evaluate(ARG1 arg1, ARG2 arg2); } public interface CurriedFunctor<ARG2, RET> {    RET evaluate(ARG2 arg); }final CurriableFunctor<ARG1, ARG2, RET> functor;      public Currier(CurriableFunctor<ARG1, ARG2, RET> fn) { functor = fn; } public CurriedFunctor<ARG2, RET> curry(final ARG1 arg1) {          return new CurriedFunctor<ARG2, RET>() {            public RET evaluate(ARG2 arg2) {                   return functor.evaluate(arg1, arg2);               }           };       }public static void main(String[] args) {        Currier.CurriableFunctor<Integer, Integer, Integer> add               = new Currier.CurriableFunctor<Integer, Integer, Integer>() {                   public Integer evaluate(Integer arg1, Integer arg2) {                       return new Integer(arg1.intValue() + arg2.intValue());} };Currier<Integer, Integer, Integer> currier              = new Currier<Integer, Integer, Integer>(add); Currier.CurriedFunctor<Integer, Integer> add5               = currier.curry(new Integer(5));System.out.println(add5.evaluate(new Integer(2)));     }   }

15

It's word wrapped,
not if you use 6pt font on a 19" widescreen monitor at 1920x1200.

16

Am I the only one who was confused by the whole 'curry' thing? Lol.

17

hi!
partial aplication is just a shorcut for a lambda. If you have lambda, you don't really need partial application, of course it's convenient, but there is no need for an overlong definition of it.
KTHXBYE

18

HI EVERYBODY!

19

HEY SUP!

20

<script>alert('hello ass');

21

<script>alert('hello ass');</script>

22

>>17
Then again you don't have lambdas in Java, do you?

23

>>17
Data structures are also unnecessary because of lambdas. Shall we trash those, too?

24

>>12
>>16
>>17
>>18
>>19
>>20
>>21
GET THE FUCK OUT REDDIT FAGS

25

>>24
I can tell by your eloquence and powerful grasp of the English language that you're a man of formidable intelligence whose ideas and convictions are clearly deeply rooted in logic and fact, and deserve to be heralded as the towering pinnacle of thought in this debate.

26

Mmmm curry.....

27

>>22

yes you do

lambda (type x, type y, ...) { code }

>>23

No, cause they're convenient and cost little. Having curry or not having it is a design decision that affects many things, like, say, keyword parameters.

28

curryl = lambda f, x: lambda *a: f(x, *a)
curryr = lambda f, x: lambda *a: f(*list(a) + [x])

29

>>27
That turns into more of a cultural issue. When using easily currying languages, people (should) design their function families in a way that benefits from currying. When using languages with keyword parameters, it is often natural to design functions with a lot of `tweakability' behind keyword parameters that default to some sane commonly-used values.

30

http://vanoufreestyle.skyblog.com/

31

>>28
Er,

curryr = lambda f, x: lambda *a: f(*a + (x,))

32

>>29
you're very rite.

33

PROTIP: MOST PEOPLE IN THIS THREAD DON'T KNOW THE DIFFERENCE BETWEEN CURRYING AND PARTIAL APPLICATION

34

>>33
PROTIP: NO SUCH DIFFERENCE EXISTS.

35

>>34
INCORRECT. CURRYING MEANS CONVERTING A FUNCTION TAKING N ARGUMENTS TO A FUNCTION TAKING ONE ARGUMENT AND RETURNING ANOTHER CURRIED FUNCTION. IN OTHER WORDS CURRYING MAKES PARTIAL APPLICATION POSSIBLE.

36

....Much like a pile of curry

37

PROTIP: MOST PEOPLE IN THIS THREAD DON'T KNOW THE DIFFERENCE BETWEEN LAMBDAS AND ANONYMOUS CLOSURES

38

>>37
PROTIP: NO SUCH DIFFERENCE EXISTS.

39

>>38
INCORRECT. ANONYMOUS CLOSURES ARE FUNCTIONS DEFINED IN IMMEDIATE FORM WITHOUT A SYMBOL NAME FOR USE IN AN EXPRESSION, THEIR SCOPE SHARING OUTER LEXICAL SCOPES VARIABLES. LAMBDAS ARE GREEK LETTERS.

40

>>39
ha!

41

#include "mygretfuncs.h"
main() {
typedef int integre;
typedef char charmeleon;
typedef char[] __v_rly_long_charzard;
typedef struct { char a[1]; } rly_gret_suces;

rly_gret_suces testo[] = {{'r'},{'o'},{'f'},{'l'}};
integre wundafl = 22;
putchar(testo[0].a);
__v_rly_long_charzard gret = "gret";
printf(gret);
charmeleon ab = 'b';
putchar(ab);
return wundafl;
}

42

actually, he's rite. you can have lambdas without closures: see dynamically scoped lisp.

43

>>42
Dynamic scopes suck :(

44

>>39
PROTIP: THREAD OVER.

45

>>35
ITT: YOU PROCEED TO MOLEST A COMMA

46

PROTIP: MOST PEOPLE IN THIS THREAD DON'T KNOW THE DIFFERENCE BETWEEN Lisp AND LISP

47

>>46
PROTIP: NO SUCH DIFFERENCE EXISTS

48

>>47
INCORRECT. LISP AND Lisp ARE WRITTEN WITH DIFFERENT CHARACTERS.

49

>>47
INCORRECT LISP MEAN LIST PROCESSOR (THE ENTIRE FAMILY OF LANguAGES), Lisp IS ACTUALLY SHORT FOR THE COMMON LISP LANGUAGE

50

>>49
INCORRECT. (eq? 'Lisp 'LISP) yields #t.

51

FORCED INCORRECTNESS OF CODE. THREAD INCORRECT.

52

>>50
(eq 'CLisp 'Scheme)
NIL

53

Lisp is LISP in the same sense that tequila is alcohol.

54

How about some good old VB.Net instead of that Java shit?
    Dim add As Func(Of Integer, Integer, Integer) = Function(x, y) x + y
    Dim add5 As Func(Of Integer, Integer) = Function(y) add(5, y)
    Console.WriteLine(add5(2))

55

THE ONLY THING IN COMPUTER SCIENCE THAT CURRIES IS ALL THE FUCKING INDIANS TAKING OUR JARBS

56

curry = lambda f, *args: lambda x: f(x, *args)
add = lambda x, y: x + y
add5 = curry(add, 5)
print add5(2)

ONE WORD, THE FORCED INDENDTATION OF CODE. THREAD OVER.

57

>>56
this is gay, no one asked you how to do it in python. fuck off

58

>>54
that's not currying

59

>>58
It's the same. I just don't need that fucking class for that simple task. And I can easily have this:
    Dim f5 As Func(Of Func(Of Integer, Integer, Integer), Integer) = Function(f, y) f(5, y)
Isn't it the same?

60

>>58
It's the same. I just don't need that fucking class for that simple task. And I can easily have this:
    Dim F5 As Func(Of Func(Of Integer, Integer, Integer), Func(Of Integer, Integer)) = Function(f) Function(y) f(5, y)
    Dim add5 = F5(add)
Isn't it the same?

61

I agree there is no need for currying, it's just convenient. In fact, that's what I said earlier in the thread.
But what you're doing is not currying.

62

>>61
It's the same. I just don't need that fucking class for that simple task. And I can easily have this:
    Dim F5 As Func(Of Func(Of Integer, Integer, Integer), Func(Of Integer, Integer)) = Function(f) Function(y) f(5, y)
    Dim add5 = F5(add)
Isn't it the same?

63

>>62
It's the same. I just don't need that fucking class for that simple task. And I can easily have this:
    Dim F5 As Func(Of Func(Of Integer, Integer, Integer), Func(Of Integer, Integer)) = Function(f) Function(y) f(5, y)
    Dim add5 = F5(add)
Isn't it the same?

64

copypasta lol
But I think that >>60 is currying. We have some f(x,y) which happens to be add(x,y) (takes 2 arguements) and turn it into add5 function which takes 1 arguement via currification function f5.
Meybe I just don't know the definition of curryfication, but I thought it was makent the function take only 1 arguement.

f(x,y)->f(x)(y) or so...

65

>>64
40h GET

66

>>54
First class functions? And anonymous functions? In MY Basic?
Wow, suddenly I have a lot more respect for VB.
Previously, my respect for it was like "pure stinking cow shit".
Now it's like "shit".

67

>>66
Name the "awesome" so that we can start a holy war.

68

>>67
Naturally, I was talking about Python. I didn't feel it was necessary to say it's awesome.

69

>>68
ONE WORD, FORCED INDENTATION OF THE CODE, THREAD OVER

70

>>69
Shit! I wasn't expecting you to say that!

71

fucjjk

72

>>69
I am the creator of the `forced indentation' meme, and it's supposed to go:
``One word, the forced indentation of code. Thread over.''
Lookup the original `Bad things about Python' thread if you don't believe.

Such a failure of epic proportions.

73

>>72
I started the 'Bad things about Python' thread, I think I can claim responsibility for that meme actually.

74

I own the patent of the word "meme", United States Patent number 6530453, and I intent to monetize this intellectual property.

75

I founded this place, this /prog/, I have the rights to everything posted within.

76

>>74 is American

77

>>76

I'm argentine

78

butts lol

79

new Integer(5)

Java is truly a language worthy of ENTERPRISE.

80

[[NSNumber alloc] initWithInt:5]

81

int *x = new int;

83

MOLEST MY COMMA is now a meme

84

>>83
Wrong.

85

>>39
You got me this time, anon!

86

x :: Integer

87

x <- newIORef 5

88

I never said that

89

Yes I did

90

u saved my homework ! kool! hahaha thxs

91

...and you said C# dont curry


using System;

namespace Currying
{
    class Curried<T1, TResult>
    {
        Func<T1, TResult> func;

        public Curried(Func<T1, TResult> f)
        {
            func = f;
        }

        public TResult Run(T1 t1)
        {
            return func(t1);
        }
    }

    class Curried<T1, T2, TResult>
    {
        Func<T1, T2, TResult> func;

        public Curried(Func<T1, T2, TResult> f)
        {
            func = f;
        }

        public Curried<T2, TResult> Run(T1 t1)
        {
            return new Curried<T2, TResult>(t2 => func(t1, t2));
        }

        public TResult Run(T1 t1, T2 t2)
        {
            return func(t1, t2);
        }
    }

    class Curried<T1, T2, T3, TResult>
    {
        Func<T1, T2, T3, TResult> func;

        public Curried(Func<T1, T2, T3, TResult> f)
        {
            func = f;
        }

        public Curried<T2, T3, TResult> Run(T1 t1)
        {
            return new Curried<T2, T3, TResult>((t2, t3) => func(t1, t2, t3));
        }

        public Curried<T3, TResult> Run(T1 t1, T2 t2)
        {
            return new Curried<T3, TResult>(t3 => func(t1, t2, t3));
        }

        public TResult Run(T1 t1, T2 t2, T3 t3)
        {
            return func(t1, t2, t3);
        }
    }

    class Program
    {
        static int Add(int a, int b)
        {
            return a + b;
        }

        static int Add3(int a, int b, int c)
        {
            return a + b + c;
        }

        static void Main(string[] args)
        {
            var cAdd = new Curried<int, int, int>(Add);
            var cAdd3 = new Curried<int, int, int, int>(Add3);
            var added = cAdd.Run(5).Run(4);
            var added3 = cAdd3.Run(1).Run(2).Run(3);
            Console.WriteLine(added);
            Console.WriteLine(added3);
        }
    }
}


...and you can continue writing more Curried<> classes like so.

92

i like curry.

93

>>92
Go back to /jp/, Ciel.

94

>>91
Needs more boost preprocessor metaprogramming.

95

>>91
C#
Oh. I see now.

96

>>95
No, you see sharp.

97

>>96
That's it, thread over everyone. Pack up your stuff and go home.

98

>>97
But /prog/ is home.

99

Takes the creativity and   imagination that an   artist would have   is on paper   and what the   hell You know   I AM AN   Enterprise Programmer I   guarantee you it   will be instructional.

100

100 GET

101

This was a great thread, besides the reddit faggots.

102

Tradeinfo365 is a website that about exact, timely, and detailed global trade information,import and export data,the list of importers and exporters,customs data,supplier data.
http://www.tradeinfo365.com
http://www.tradeinfo365.com/page/TI365.html
http://www.tradeinfo365.com/page/Chinadata.html

103

anonymous classes are cool in some ways and fucking stupid excuses for real lambdas in other ways. C# is superior, although inner classes would be a nice touch to it.

104

>>,,,,,,,,,,,,,,,,,
Remember to sage your posts for the benefit of all /prog/ users.

105

三便宝:http://www.shanghaikanpo.com/view/1425.html
花痴:http://www.shanghaikanpo.com/view/1363.html
巨人倍増:http://www.shanghaikanpo.com/view/1334.html
威哥王:http://www.shanghaikanpo.com/view/1392.html
精力剤:http://www.shanghaikanpo.com/Energy.html
紅蜘蛛:http://www.shanghaikanpo.com/view/1195.html
福源春:http://www.shanghaikanpo.com/view/1228.html
五便宝:http://www.shanghaikanpo.com/view/1378.html
三體牛鞭:http://www.shanghaikanpo.com/view/1420.html
媚薬:http://www.shanghaikanpo.com/Charming-medicine.html
避妊薬:http://www.shanghaikanpo.com/Avoid-pregnanting.html

106

媚薬:http://www.bestkanpou.com/Charming/Charming-medicine.html
精力剤:http://www.bestkanpou.com/Energy/Energy.html
中絶薬:http://www.bestkanpou.com/product/121.html
威哥王:http://www.bestkanpou.com/product/437.html
三便宝:http://www.bestkanpou.com/product/349.html
五便宝:http://www.bestkanpou.com/product/41.html
天天素:http://www.bestkanpou.com/product/17.html
花痴:http://www.bestkanpou.com/product/392.html
女性用媚薬:http://www.bestkanpou.com/Charming/16.html
巨人倍増:http://www.bestkanpou.com/product/38.html
避妊薬:http://www.bestkanpou.com/Avoid/Avoid-pregnanting.html
紅蜘蛛:http://www.bestkanpou.com/product/8.html
三體牛鞭:http://www.bestkanpou.com/product/411.html
痩身1号:http://www.bestkanpou.com/product/367.html
痩身一号:http://www.bestkanpou.com/product/367.html
韓国痩身一号:http://www.bestkanpou.com/product/367.html
狼1号:http://www.bestkanpou.com/product/62.html
狼一号:http://www.bestkanpou.com/product/62.html

107

三体牛鞭:http://www.hikanpo.com/product.asp?id=166
五便宝:http://www.hikanpo.com/product.asp?id=75
女性用媚薬:http://www.hikanpo.com/jyosei.asp
媚薬:http://www.hikanpo.com/jyosei.asp
福源春:http://www.hikanpo.com/product.asp?id=51
避妊薬:http://www.hikanpo.com/hininn.asp
蟻力神:http://www.hikanpo.com/product.asp?id=200
巨人倍増:http://www.hikanpo.com/product.asp?id=121
威哥王:http://www.hikanpo.com/product.asp?id=162
三體牛鞭:http://www.hikanpo.com/product.asp?id=166
女性用媚薬:http://www.hikanpo.com/product.asp?id=7
三便宝:http://www.hikanpo.com/product.asp?id=79
精力剤:http://www.hikanpo.com/energy.asp
RU486:http://www.hikanpo.com/product.asp?id=341

108

108th post for BAD CHINESE KARMA!

109

110

ウィッグ:http://www.besttojapan.com/_c104
ショートウィッグ:http://www.besttojapan.com/_c105
ショートカール:http://www.besttojapan.com/_c321
男性用ウィッグ:http://www.besttojapan.com/_c134
女性用ウィッグ:http://www.besttojapan.com/_c135
耐熱ウィッグ:http://www.besttojapan.com/_c136
ロング ウィッグ:http://www.besttojapan.com/_c320
人毛ウィッグ : http://www.besttojapan.com/p12756.html
ロングカール:http://www.besttojapan.com/p12978.html
ロングストレート:http://www.besttojapan.com/p12981.html
ウィッグ ボブ:http://www.besttojapan.com/p12926.html
涼宮 抱き枕:http://www.besttojapan.com/_c305  
東方 抱き枕:http://www.besttojapan.com/_c303
一騎当千 抱き枕:http://www.besttojapan.com/_c304  
アニメ 抱き枕:http://www.besttojapan.com/_c302
コスプレ衣装:http://www.besttojapan.com/_c189
生薬:http://www.besttojapan.com/_c181
麻黄:http://www.besttojapan.com/p6983.html
五味子:http://www.besttojapan.com/p6970.html
アバクロ新作:http://www.besttojapan.com/_c315
アバクロ:http://www.besttojapan.com/_c314
アバクロ メンズ :http://www.besttojapan.com/p12555.html
アバクロ レディース:http://www.besttojapan.com/p12683.html
デジタル フォトフレーム:http://www.besttojapan.com/_c141
デジタル写真フレーム:http://www.besttojapan.com/_c146
デジタルアルバム:http://www.besttojapan.com/_c147
ベビーアルバム:http://www.besttojapan.com/_c142
子供アルバム:http://www.besttojapan.com/p2700.html
ミニデジタルフォト:http://www.besttojapan.com/_c143
USB デジタルフォトフレーム:http://www.besttojapan.com/_c144
7インチ デジタル写真フレーム:http://www.besttojapan.com/_c150
3.5インチデジタル写真フレーム:http://www.besttojapan.com/_c149


Newer Posts

Name: Email:
111
Entire Thread Last 50 Posts First 100 Posts Thread List Report Thread