Mar. 27th, 2006

juan_gandhi: (Default)

  public <T> Iterable<T> iterate(final Iterator<T> iterator) {
    return new Iterable<T>() {
      public Iterator<T> iterator() {
        return iterator;
      }
    };
  }

java stuff

Mar. 27th, 2006 03:29 pm
juan_gandhi: (Default)
A File, a Url are an Iterables, a stream, a reader are Iterators. A directory is an iterable.

A name is an iterable, a value is an iterator. We need them for lazy evaluation. Encapsulation is a kind of lazy evaluation.
juan_gandhi: (Default)
I know already that in Haskell, the language of the future, it is all expressed as a one-liner.
But there are 2 million poor old Java programmers that are having hard time reading even this; we have to be kind to them. I am one of them.

So, I rewrote sieve again, this time it is a little bit more beautiful.

Note that if sieve() could return a pair (prime, itsnumber), life would be easier. But returning tuples is something Java will never do (probably). (Instead, it has NavigableMap now.)

Read more... )

puzzle

Mar. 27th, 2006 03:51 pm
juan_gandhi: (Default)
1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999 - what is it?

Read more... )

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

November 2025

S M T W T F S
       1
23456 7 8
9 1011 12 1314 15
16171819 20 2122
23 24 2526272829
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Nov. 27th, 2025 11:43 pm
Powered by Dreamwidth Studios