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

..and you said java dont curry

Name: Anonymous 2007-06-03 15:49 ID:xvzgDsaZ

   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)));
       }
   }

Name: Anonymous 2007-06-03 16:11 ID:iUJ4jCDg

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.

Name: Anonymous 2007-06-03 17:11 ID:Seez+SpX

What if it has more than two arguments?

Name: Anonymous 2007-06-03 17:29 ID:gNirnxgd

The second argument becomes another curried object.

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

Name: Anonymous 2007-06-03 19:00 ID:e5Xum01e

LOL LINKED FROM REDDIT

HI REDDIT

Name: Anonymous 2007-06-03 19:23 ID:V8pKJRc7

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

Name: Anonymous 2007-06-03 19:38 ID:C1j6ZD/p

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!???!

Name: Anonymous 2007-06-03 19:39 ID:C1j6ZD/p

VIP QUALITY

Name: Anonymous 2007-06-03 19:57 ID:iUJ4jCDg

>>6
This isn't Fight Club.

Name: Anonymous 2007-06-03 20:13 ID:78CwFusA

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

Name: Anonymous 2007-06-03 20:29 ID:MPddzBxZ

>>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.

Name: Anonymous 2007-06-03 21:38 ID:xDP6R3xQ

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

Name: Hacksell 2007-06-03 22:30 ID:ATgwdXXv

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.

Name: Java_Monkey 2007-06-03 22:36 ID:ATgwdXXv

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)));     }   }

Name: Anonymous 2007-06-03 22:38 ID:Heaven

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

Name: Anonymous 2007-06-04 0:36 ID:Heaven

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

Name: Anonymous 2007-06-04 0:46 ID:mt3ZZjUR

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

Name: Anonymous 2007-06-04 2:29 ID:jzv7hegM

HI EVERYBODY!

Name: Anonymous 2007-06-04 3:18 ID:7fqB/OKQ

HEY SUP!

Name: John 2007-06-04 3:46 ID:b3+AdbPm

<script>alert('hello ass');

Name: John 2007-06-04 3:46 ID:b3+AdbPm

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

Name: Anonymous 2007-06-04 4:22 ID:QIG4yE5g

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

Name: Anonymous 2007-06-04 4:42 ID:g/zeDzig

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

Name: Anonymous 2007-06-04 7:46 ID:joAyk20X

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

Name: Anonymous 2007-06-04 10:15 ID:DwnicjCp

>>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.

Name: Anonymous 2007-06-04 11:34 ID:WwdF2Pp8

Mmmm curry.....

Name: Anonymous 2007-06-04 11:37 ID:mt3ZZjUR

>>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.

Name: Anonymous 2007-06-04 12:33 ID:QIG4yE5g

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

Name: Anonymous 2007-06-04 15:44 ID:g/zeDzig

>>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.

Name: cvnxcvnc 2007-06-04 19:34 ID:0PaksWgM

Name: Anonymous 2007-06-04 20:10 ID:60lsiCGd

>>28
Er,

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

Name: Anonymous 2007-06-04 23:34 ID:zq1r+6nC

>>29
you're very rite.

Name: Anonymous 2007-06-05 5:02 ID:xXvJfXWC

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

Name: Anonymous 2007-06-05 6:02 ID:Heaven

>>33
PROTIP: NO SUCH DIFFERENCE EXISTS.

Name: Anonymous 2007-06-05 6:15 ID:xXvJfXWC

>>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.

Name: Anonymous 2007-06-05 6:46 ID:xMBsQtbA

....Much like a pile of curry

Name: Anonymous 2007-06-05 9:31 ID:XrMo7x5G

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

Name: Anonymous 2007-06-05 10:24 ID:88TKoITQ

>>37
PROTIP: NO SUCH DIFFERENCE EXISTS.

Name: Anonymous 2007-06-05 17:14 ID:fSLDQ1+L

>>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.

Name: Anonymous 2007-06-05 23:36 ID:9BiZ64pk

>>39
ha!

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