Wednesday 27 October, 2010
#
Nothing earth shaking. just a small handful of predicates and a sequence. The new predicates are Nand, Nor, Xor, and Xnor which perform the logical operations you expect and OneOf, which evaluates a number of other predicates and returns true if one and only one of those is true. The new sequence is the NullSequence, which returns null after null after null.
- mango-bin.zip (68,267 bytes)
- mango-bin.tar.gz (68,277 bytes)
- mango-src.zip (88,097 bytes)
- mango-src.tar.gz (30,930 bytes)
javadoc build target, and the current Javadoc is available online, but you can grab the Javadoc seperately too. - mango-javadoc.zip (104,691 bytes)
- mango-javadoc.tar.gz (42,454 bytes)
The Mango code lives in a Bazaar repository. You can pull the code from :
bzr branch http://jezuk.dnsalias.net/bzr/mango/trunk
The previous non-generic release, built with Java 1.4, is still available.
[Add a comment]
Friday 21 May, 2010
#
Here's a Groovy version of the Java code below. It's more or less identical to the Python original.
import uk.co.jezuk.mango.Iterators
def prev_this_next(items) {
chain = Iterators.ChainIterator(null, items, null)
(prev, current, next) = Iterators.TeeIterator(chain, 3)
current.next()
next.next()
next.next()
return Iterators.ZipIterator(prev, current, next)
}
long_weekend = ["Friday", "Saturday", "Sunday", "Monday"]
yesterday_today_tomorrow = prev_this_next(long_weekend)
for(ytt in yesterday_today_tomorrow)
println ytt
Zippy, fruity, groovy ... YEAH!
[Add a comment]
#
Here's a fairly direct transliteration of some of the code presented in Thomas Guest's Zippy Triples served with Python. As you might anticipate, it's a little wordier than the Python original, but it's still a nice example of using iterators in an unusual way to neatly solve a problem.
import java.util.Iterator;
import java.util.List;
import uk.co.jezuk.mango.Collections;
import uk.co.jezuk.mango.Iterators;
public class ZippyTriples
{
static public void main(final String[] args)
{
List<String> long_weekend = Collections.list("Friday", "Saturday", "Sunday", "Monday");
Iterator<List<String>> yesterday_today_tomorrow = prev_this_next(long_weekend);
while(yesterday_today_tomorrow.hasNext())
{
List<String> ytt = yesterday_today_tomorrow.next();
for(String d : ytt)
{
System.out.print(d);
System.out.print(" ");
}
System.out.println();
}
}
static Iterator<List<String>> prev_this_next(final List<String> items)
{
Iterator<String> chain = Iterators.ChainIterator(null, items, null);
List<Iterator<String>> prev_this_next = Iterators.TeeIterator(chain, 3);
Iterator<String> prev = prev_this_next.get(0);
Iterator<String> current = prev_this_next.get(1);
Iterator<String> next = prev_this_next.get(2);
current.next();
next.next();
next.next();
return Iterators.ZipIterator(prev, current, next);
}
}
Hello,very nice example. Are You also programming in PHP?
It is better and more friendly than Python I think.
Regards,
[Add a comment]
Thursday 13 May, 2010
#
- mango-bin.zip (64,441 bytes)
- mango-bin.tar.gz (64,476 bytes)
- mango-src.zip (80,379 bytes)
- mango-src.tar.gz (30,600 bytes)
javadoc build target, and the current Javadoc is available online, but you can grab the Javadoc seperately too. - mango-javadoc.zip (103,181 bytes)
- mango-javadoc.tar.gz (40,282 bytes)
The Mango code lives in a Bazaar repository. You can pull the code from :
bzr branch http://jezuk.dnsalias.net/bzr/mango/trunk
The previous non-generic release, built with Java 1.4, is still available.
[Add a comment]
Thursday 05 November, 2009
#
Over the past three or four weeks I've restarted work on Mango, dragging it into the modern age by throwing out the deprecated bits, making one or two little nips and tucks, and by generifying (if that's a real word) the library. So, I've cut a new release.
- mango-bin.zip (54,231 bytes)
- mango-bin.tar.gz (54,285 bytes)
- mango-src.zip (68,847 bytes)
- mango-src.tar.gz (25,146 bytes)
javadoc build target, and the current Javadoc is available online, but you can grab the Javadoc seperately too. It's not overflowing with words, if I'm honest, because the concepts Mango uses are pretty straightforward, but hopefully the Javadoc's not without its uses.
- mango-javadoc.tar.gz (101,603 bytes)
- mango-javadoc.tar.gz (38,392 bytes)
The Mango code is now lives in a Bazaar repository. You can pull the code from :
bzr branch http://jezuk.dnsalias.net/bzr/mango/trunk
The previous non-generic release, built with Java 1.4, is still available.
[Add a comment]
Monday 20 August, 2007
#The LGPL and Java - ... the LGPL works as intended with all known programming languages, including Java ...
Describes exactly why Mango is released under the LGPL.
[Add a comment]
Friday 17 August, 2007
#
Uploaded a new Mango release.
It adds a couple of new iterators. The Javadocs are up-to-date, but the web pages are lagging a little.
[Add a comment]
Wednesday 15 August, 2007
#
[Add a comment]
Friday 16 March, 2007
#
I'm in the middle of writing a conference presentation which talks about some of what Mango does, I'm struggling for an example, and bam! There it is, what I need is an iterator that traverses a list in reverse order. So I wrote a test, wrote an iterator, then wrote it again in under five minutes. It's in subversion now.
You can pull the Mango code from
svn co svn://jezuk.dnsalias.net/jezuk/mango/trunk
hello from google...
google [e] [w], 19th Mar 2007
[Add a comment]
Friday 13 October, 2006
#
My recent development rush has wound down so I've packaged a new Mango release. Online Javadoc is up-to-date. Other documentation currently lacks some of the new things.
[Add a comment]
Friday 29 September, 2006
#Updated SelectingIterator to support the
remove method.Hi i needed to know something for a class project if eny one knows who invented the steam locomotive pleas contact me.
kim [e], 24th Mar 2008
[Add a comment]
Thursday 28 September, 2006
#Added
int findPositionIf(Collection coll, Predicate pred)
[Add a comment]
Monday 25 September, 2006
#
Added Partition, an algorithm for splitting a collection into two. Iterates over the collection, applying a predicate to each element. Objects matching the predicate are removed and added to a results collection.
[Add a comment]
Friday 22 September, 2006
#
The changes keep coming. Yesterday saw set intersection, and today I've just committed symmetric difference. My initial feeling was to call it disjunction, but that's clearly the latent logician in me talking.
[Add a comment]
Thursday 21 September, 2006
#
Kicked out a new Mango release. Online Javadoc is up-to-date. Other documentation currently lacks the new things.
[Add a comment]
#
Mango has suddenly become work relevant again. In the last couple of days I've committed a new iterator that works over Strings, and a new algorithm for stripping duplicates from a sorted collection.
I expect more to follow, and will drop a new release soon.
Added an algorithm to find the intersection of two collections.
jez, 21st Sep 2006
Added a variation on find which returns the index of the object in the collection
jez, 23rd Sep 2006
[Add a comment]
Wednesday 08 September, 2004
#
* A
NullIterator iterates over nothing. That is, hasNext * always returns
false.*/
static public java.util.Iterator NullIterator();In CVS (mail me for access) now.
[Add a comment]
Friday 28 May, 2004
#
Cool! Will the next version have a MincingIterator ? :-)
Seriously(ish) - any thought about integrating with Jakarta Commons Collections ? The two libraries share some common concepts and it would be nice to be able to use them together...
kal, 1st Jun 2004
It's worth another look I suppose. I did track the commons-dev mailing list for some time a while back, but there seemed to be no movement on Collections at the time. (It was all Bean this and Jelly that.)Commons Collections and Mango have similar iterators and unary predicates, so perhaps the algorithms part would fit with them.
I'll have another go at their mailing list perhaps.
jez, 2nd Jun 2004
Well, I'm a bit late to the conversation, but I also am a bit curious about the Commons Functor work. Do they make sense to you??
I'm not at all clear if they've become less verbose, one of the main reasons for Functors etc.
Hope all is well,
Owen
backspaces, 6th Sep 2006
[Add a comment]
Wednesday 19 May, 2004
#
To: Jez Subject: Mango Status? Greetings: I came across your website some time ago. I am the author of a similar libary, jga, found at http://jga.sf.net/ I'll be speaking at the next JavaOne on applying functors to desktop programming, and one of my slides lists the available functor-based libraries that I have been able to find. I thought I'd touch base with you to find out what the status of Mango is at this point. Is this still an on-going project? David HallI replied
To: David Subject: Re: Mango Status? Hello David, > > I came across your website some time ago. I am the author of a > similar libary, jga, found at > > http://jga.sf.net/ > We certainly seem to have been be working along similar lines. I knew somebody had to be somewhere :) > I'll be speaking at the next JavaOne on applying functors to desktop > programming, and one of my slides lists the available functor-based > libraries that I have been able to find. I thought I'd touch base with > you to find out what the status of Mango is at this point. > > Is this still an on-going project? > It's still on-going in as much as I haven't stopped working on it. I just haven't been working on it, if you see what I mean. The library started as a result of some other work I was doing at the time, and I've added to it in dribs and drabs over time. Checking now, it has been some time. Over the last year or so, I've done much less work in Java and rather more in C++, so the motivation to work on it hasn't been there. I'll no doubt come back to it at some point. Simply receiving this mail may prod me a bit. Best, Jez
[Add a comment]
Friday 18 July, 2003
#LGPL may be viral for Java? -
The FSF's Executive Director, Brad Kuhn adds "LGPL's S. 6 allows you to make new works that link with the LGPL'ed code, and license them any way you see fit. Only the LGPL'ed code itself must remain Free. Such 'client code' can even be proprietary; it need not be LGPL'ed."To clarify the Mango position - I licensed it under the LGPL because I want the library to remain free while allowing people to do whatever the hell they want with it. Basically, what I want to maintain is that Mango code stays in the Mango jar file, and isn't bundled into some other jar instead. So go ahead, use the code in whatever application you like, under whatever license you like.
[Add a comment]