archives

Functional libraries for Java

Over the past few months I have collected a few links for Java functional libraries (I haven't actually used any of them yet in any major project). Thought it might interest people here:


http://www.cs.chalmers.se/~bringert/hoj/ programmer (includes Java 5.0 generics support). Little documentation.


http://jakarta.apache.org/commons/sandbox/functor/ doesn't look like it is maintained, doesn't support generics. Little documentation.


http://devnet.developerpipeline.com/documents/s=9851/q=1/ddj0511i/0511i.html
library.


http://functionalj.sourceforge.net

http://www.functologic.com/orbital/

http://jga.sourceforge.net/ programming in java (includes generics). Looking forward to more documentation, perhaps better organization of the API.




Java 5.0 also has an interesting interface (same as Oz, AliceML?):
java.util.concurrent.Future with the following description:

"A Future represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation"


I read one rumor (on theserverside.com...can't find it any more) that Java 7.0 will have something like C#'s delegates.


There was another comment from Javalobby.org about simulating continuation using a new library in Java 5.0 (I believe from java.util.concurrent.*)...can't find that either.



Googling for "functional c#" brings up some blog enteries where people show how to do functional style programming in C#. ACM has a couple of papers on functional programming in Java/C#, I'm trying to find those again.

Towards the best collection traversal interface

This has been discussed before on LtU, but I don't think you can add new messages to threads in the "classic" section. I came across this presentation while I was contemplating ways to generalise a SAX-style interface to a parser I was writing and realised that I'd practically written a fold already. The API proposal is excellent and I think would make a good fit for some collections I've been thinking of writing for Tcl (I'd adapt the fold to be able to optionally make use of Tcl's event loop for doing traversals in the background, and use Tcl's break/continue/error exceptions rather than an explicit continue/don't continue indicator in the result). However, I thought I'd just check to see whether there is any new research on this that I should be aware of. Also, I'm struggling somewhat with the Haskell code demonstrating the enumeration->cursor transform without call/cc. Specifically, I'm wondering if it would be possible to translate the example into a language like Tcl which is strict and has relatively weak support for functional programming techniques? I think I could probably get my head around the Haskell enough to try and make a cheap+dirty imperative version, but any ideas on good ways to go about it would be useful.

What is considered source code?

I have seem many posts about technology that lets you change the behavior of a program with changing the code. They claim that changes to production environments can be made as easily as changing a config file. Many times these config files hold import details like database queries.

My question is, what is considered source code?

Obviously, anything written in a programming language and compiled is source code. But what about non-compiled code?

Are SQL statements considered source code? What if they are in a config file?

Should the database structure be considered "source code"? What about the stored procedures it contains?

How about a config file that makes minor changes the way the program works? For example, using a different factory class based on a flag.

What if the changes are major? For example, one that injects code in the fashion used in Aspect Oriented Programming.

This is important because, in the real world, all changes to source code need to be documented and tested.