aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-268/asherbhs/hy/ch-2.hy12
1 files changed, 8 insertions, 4 deletions
diff --git a/challenge-268/asherbhs/hy/ch-2.hy b/challenge-268/asherbhs/hy/ch-2.hy
index 6cd2a29218..74f305be52 100644
--- a/challenge-268/asherbhs/hy/ch-2.hy
+++ b/challenge-268/asherbhs/hy/ch-2.hy
@@ -3,10 +3,14 @@
itertools *
)
-(defn number-game [ints] (lfor
- #(x y) (batched (sorted ints) 2)
- z #(y x)
- z
+(require hyrule *)
+
+(defn number-game [ints] (as-> ints it
+ (sorted it)
+ (batched it 2)
+ (map reversed it)
+ (chain.from-iterable it)
+ (list it)
))
(pprint (number-game [2 5 3 4]))