juan_gandhi: (Default)
[personal profile] juan_gandhi
See what people, I mean, [livejournal.com profile] dtm, can do with our Java::

  // Look, it's an anonymous recursive function!
  public void testY() {
    assertEquals(720,
        new Function<Function<Fii, Fii>, Fii>() {
          public Fii apply(final Function<Fii, Fii> f) {
            return new Branch() {
              public Fii apply(final Branch x) {
                return f.apply(new Fii() {
                  public Integer apply(Integer y) {
                    return x.apply(x).apply(y);
                  }
                });
              }
            }.apply(new Branch() {
              public Fii apply(final Branch x) {
                return f.apply(new Fii() {
                  public Integer apply(Integer y) {
                    return x.apply(x).apply(y);
                  }
                });
              }
            });
          }
        }.apply(new Function<Fii, Fii>() {
          public Fii apply(final Fii f) {
            return new Fii() {
              public Integer apply(Integer i) {
                return (i <= 0) ? 1 : i * f.apply(i - 1);
              }
            };
          }
        }).apply(6).intValue());
  }
}

Date: 2008-03-07 05:58 pm (UTC)
From: [identity profile] mikkim08.livejournal.com
Да я и сам понимаю, что это все несерьезно. Но заедает все равно :)

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25 262728 293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 31st, 2025 08:53 am
Powered by Dreamwidth Studios