From 79edb0475322c1090597983d34e53a11056af0b8 Mon Sep 17 00:00:00 2001
From: Neil Smith <neil.git@njae.me.uk>
Date: Wed, 19 Jul 2017 00:58:01 +0100
Subject: [PATCH 1/1] More golfing

---
 02-lifts/lifts-solution.ipynb | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/02-lifts/lifts-solution.ipynb b/02-lifts/lifts-solution.ipynb
index 723d33e..dc7724f 100644
--- a/02-lifts/lifts-solution.ipynb
+++ b/02-lifts/lifts-solution.ipynb
@@ -509,6 +509,51 @@
     "max(exits(instructions[:20]))"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 12,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "(209, 215)"
+      ]
+     },
+     "execution_count": 12,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "import functools\n",
+    "ds = {'^': +1, 'v': -1, '=': 0}\n",
+    "def s(p, c): return p[0] + ds[c], p[0] if c == '=' and p[0] > p[1] else p[1]\n",
+    "functools.reduce(s, open('02-lifts.txt').read().strip(), (0, float('-inf')))"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 13,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "(209, 215)"
+      ]
+     },
+     "execution_count": 13,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "import functools\n",
+    "ds = {'^': +1, 'v': -1, '=': 0}\n",
+    "functools.reduce(lambda p, c: (p[0] + ds[c], p[0] if c == '=' and p[0] > p[1] else p[1]), open('02-lifts.txt').read().strip(), (0, 0))"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
-- 
2.43.0