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: gret anonmus 2007-06-05 23:54 ID:4jOvgOBT

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

Name: Anonymous 2007-06-06 1:07 ID:/qDzmbRi

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

Name: Anonymous 2007-06-06 6:27 ID:cO0N6Qlv

>>42
Dynamic scopes suck :(

Name: Anonymous 2007-06-06 17:58 ID:Heaven

>>39
PROTIP: THREAD OVER.

Name: Anonymous 2007-06-06 18:51 ID:6zvnlSDI

>>35
ITT: YOU PROCEED TO MOLEST A COMMA

Name: Anonymous 2007-06-07 7:29 ID:sbmpmjdi

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

Name: Anonymous 2007-06-07 9:14 ID:E+ira8jh

>>46
PROTIP: NO SUCH DIFFERENCE EXISTS

Name: Anonymous 2007-06-07 9:35 ID:sbmpmjdi

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

Name: Anonymous 2007-06-07 11:28 ID:t8b0OTn2

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

Name: Anonymous 2007-06-07 12:30 ID:sbmpmjdi

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

Name: Anonymous 2007-06-07 13:21 ID:KvPUtp5l

FORCED INCORRECTNESS OF CODE. THREAD INCORRECT.

Name: Anonymous 2007-06-07 15:05 ID:hJjTRNFV

>>50
(eq 'CLisp 'Scheme)
NIL

Name: Anonymous 2007-06-07 15:50 ID:YqKNLHSm

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

Name: Anonymous 2007-06-07 20:55 ID:mdbEznZ/

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

Name: Anonymous 2007-06-07 21:33 ID:riUCCjol

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

Name: Anonymous 2007-06-08 0:19 ID:RQBBSx6E

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.

Name: Anonymous 2007-06-08 0:21 ID:JKsST6n+

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

Name: Anonymous 2007-06-08 9:47 ID:sUn+91Pw

>>54
that's not currying

Name: Anonymous 2007-06-08 9:56 ID:468A6sJW

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

Name: Anonymous 2007-06-08 10:03 ID:468A6sJW

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

Name: Anonymous 2007-06-08 11:02 ID:sUn+91Pw

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.

Name: Anonymous 2007-06-08 11:08 ID:JKsST6n+

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

Name: Anonymous 2007-06-08 11:12 ID:8Crn92nJ

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

Name: Anonymous 2007-06-08 11:14 ID:468A6sJW

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

Name: Anonymous 2007-06-08 11:15 ID:Heaven

>>64
40h GET

Name: Anonymous 2007-06-08 16:44 ID:gf7Nf1s8

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

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

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

Name: Anonymous 2007-06-11 4:48 ID:WNxYW4hD

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

Name: Anonymous 2007-06-11 5:31 ID:4xmulQjY

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

Name: Anonymous 2007-06-11 6:34 ID:WNxYW4hD

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

Name: Anonymous 2007-06-14 20:12 ID:x4u/ti8q

fucjjk

Name: Anonymous 2007-06-14 22:12 ID:rFF+qsK4

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

Name: Anonymous 2007-06-14 23:10 ID:MuGJaBXj

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

Name: Anonymous 2007-06-14 23:40 ID:GEsVaSaK

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

Name: Anonymous 2007-06-15 2:54 ID:RpNDIvkM

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

Name: Anonymous 2007-06-15 4:06 ID:Y/aoFQbX

>>74 is American

Name: Anonymous 2007-06-15 10:00 ID:chOR6O/O

>>76

I'm argentine

Name: Anonymous 2008-05-04 1:59

butts lol

Name: Anonymous 2008-05-04 2:21

new Integer(5)

Java is truly a language worthy of ENTERPRISE.

Name: Anonymous 2008-05-04 2:29

[[NSNumber alloc] initWithInt:5]

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