Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Bjorn Bringert <bringert <at> cs.chalmers.se>
Subject: Re: FunctionalJ - a library for Functional Programming in Java
Newsgroups: gmane.comp.lang.haskell.cafe
Date: Wednesday 11th January 2006 13:03:57 UTC (over 12 years ago)
Graham Klyne wrote:
> A colleague alerted me to this, which I thought might be of interest
here:
> 
>   http://www.theserverside.com/news/thread.tss?thread_id=38430
> 
> (I have already found that my Haskell experiences have influenced my
Python
> programming;  maybe there's also hope for my Java?)

I've haven't seen this before, thanks!

I wrote a similar library, Higher-Order Java (HOJ), a few years ago:

http://www.cs.chalmers.se/~bringert/hoj/

My library is less polished but seems to have more static typing. It 
uses parametrized classes (as introduced in Java 1.5) to achieve this.

FunctionalJ seems to lack static typing, for example map has the type:

List map(Function p_function, List p_list)

In HOJ, it has this type:

 Iterator map(Fun f, Iterator xs)


In the end, I never published anything about this, since it seems too 
cumbersome to use in practice. A simple lambda expressions requires a 
lot of typing overhead. This function from the Pizza paper [1]:

fun boolean(char c) {
       n++; return '0' <= c && c < '0' + r;
     }

becomes this in HOJ:

new Fun () {
          public Boolean apply (Character c) {
             n++;
             return '0' <= c && c < '0' + r;
          }
       }

/Björn

[1] Pizza into Java: Translating Theory into Practice, M. Odersky and P. 
Wadler, 1997
 
CD: 3ms