From d7ec7ed65bdf16e03524aa5126d777d52d39200c Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Sat, 23 Dec 2017 17:23:29 -0800 Subject: [PATCH] Day 17 - very slight performance improvement by making oneth strict --- 17.hs | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/17.hs b/17.hs index 76775b2..6762f28 100644 --- a/17.hs +++ b/17.hs @@ -11,7 +11,7 @@ postNth n pos list = oneNth :: Int -> Int -> Int -> Int oneNth 50000001 _ oneth = oneth -oneNth n pos oneth = +oneNth n pos !oneth = let !newPos = (pos + steps % n + 1) % n !newOneth = if newPos == 0 then n else oneth in oneNth (n + 1) newPos newOneth diff --git a/README.md b/README.md index c00399b..c6550b6 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,6 @@ These are the runtimes of only one trial but the variances are fairly small and Problems that should be optimized further: 15 -Problems that could use some work: 05, 22, 14, 21 +Problems that could use some work: 05, 22, 14, 21, 17 -Problems that are good enough with optimizations: 17, 13 +Problems that are good enough with optimizations: 13