News for hackers. Stuff that matters.
Re:Metabase: Why we picked Clojure by dragonwriter on Wednesday December 02, 2015 @06:22PM (#10666631)
Right, sorry, in python that's something like:

  from itertools import chain, repeat

  chain.from_iterable([repeat(i % 2 != 0, i) for i in range(1,1000)])
In Java 8, I think the solution with streams would be fairly straightforward, something like:

  IntStream.range(1,1001).flatMap(i -> Stream<Boolean>.generate( () -> (x & 1) != 0 ).limit(i))
Re:Metabase: Why we picked Clojure by sokoloff on Wednesday December 02, 2015 @07:11PM (#10666860)
Doesn't that python code give you a list of 500,500 elements, rather than a list of 1000 elements as originally specified?
Re:Metabase: Why we picked Clojure by dragonwriter on Wednesday December 02, 2015 @07:13PM (#10666871)
In both cases yes, and in both cases because I made the same stupid mistake when both languages have good means to do infinite streams and "take" equivalents. (And that's worse in the Java case, since I used those in the inner function but not the outer one.)

So, I think I need to take a break from comment-box programming for a while; its clearly not working out for me today.