CC: Compiler construction ESOP: FASE: FoSSaCS:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
%include polycode.fmt | |
\begin{document} | |
> import Array | |
> import Data.Bits | |
> import Data.Char | |
> import Data.Function | |
> import qualified Data.IntSet as IS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.IntMap as M | |
import Maybe | |
fillBin capacity ws@(w:ws') weight count | |
| newWeight > capacity = (ws, weight, count) | |
| otherwise = fillBin capacity ws' newWeight (succ count) | |
where newWeight = weight + w | |
go period capacity bins weights acc state seen | |
| bins == 0 = acc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
solution time [s] memory [bytes] | |
peter.hs .163 7479296 | |
radu.hs .160 7495680 | |
duncan.hs 176.97 7467008 | |
tim.hs .160 7471104 Files out and out.ref differ | |
nicolas.lhs .460 19001344 Files out and out.ref differ | |
lennart.hs 2134.98 7467008 Files out and out.ref differ | |
This was run in /dev/shm (that is, not using the HDD) on a computer with two cores at 4788 bogomips each (Intel i3 @2.4GHz), and 4GB of RAM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cache = dict() # cache[x] is a map from weights to paths s->x | |
s = 0 # source | |
def find(t): | |
if t in cache: return cache[t] | |
if t == s: | |
return dict([(0,[s])]) | |
r = dict() | |
for (x, w) in pred(t): | |
for (ww, path) in find(x): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Benchmark { | |
public final boolean run() { | |
if (++iteration == 1) prepare(); | |
if (validateOutput) { | |
System.setOut(out); // this is where System.out is redefined | |
out.openLog(); | |
} | |
try { iterate(); } | |
finally { | |
if (validateOutput) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r e5fa13aae1cc Python/bltinmodule.c | |
--- a/Python/bltinmodule.c Tue Dec 31 06:52:47 2013 -0500 | |
+++ b/Python/bltinmodule.c Wed Jan 01 15:46:01 2014 +0000 | |
@@ -1559,14 +1559,15 @@ | |
equivalent to (x**y) % z, but may be more efficient (e.g. for ints)."); | |
- | |
static PyObject * | |
builtin_print(PyObject *self, PyObject *args, PyObject *kwds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beginfig(1) | |
path digit; | |
numeric d; | |
string digit_string; | |
u := 5mm; | |
max_base = 10; | |
max_num = 99; | |
digit_string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
color c_d[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22225 13333 11444 | |
23333 12255 11444 | |
23333 22225 11444 | |
33333 12255 11444 | |
33333 22225 11444 | |
33333 22235 11444 | |
33333 22245 11444 | |
33333 22255 11444 | |
33333 22255 11445 | |
33333 22255 12444 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.base.Optional; | |
import com.google.common.collect.Lists; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
public class A { | |
public static <T> T getOnlyElement(Iterable<T> xs, Optional<T> e, Optional<T> xx) { | |
Iterator<T> i = xs.iterator(); | |
if (!i.hasNext()) { | |
if (e.isPresent()) return e.get(); |
OlderNewer