hi all, http://adventofcode.com/2015/day/13 Brute force solution is find max of sums of items inside Cartesian product.
There is my implementation, create list of all products on rosetta: http://rosettacode.org/wiki/Cartesian_product_of_two_or_more_lists#PicoLisp Test input of task is 81 items in list, its ok for rosetta's variation. Cartesian product of real input is 37B items in list. Time to implementation Cartesian iterator, like in python: https://docs.python.org/3/library/itertools.html#itertools.product https://bitbucket.org/mihailp/tankfeeder/src/default/cartesian.l?at=default&fileviewer=file-view-default There are three variations with the same original engine inside: o) on coroutines - product o) manual sum all numbers of product - cartesian-sum o) find max of sums of items of product - cartesian-maxi Tests over each other and against rosettacode variation. Current bench, 4M items in product, sum all numbers: o) coroutines - 1.9secs o) manual - 1.4secs Its ok. Happy coding, (mike) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe