aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHVukman <peterslopp@googlemail.com>2025-09-14 20:59:05 +0200
committerGitHub <noreply@github.com>2025-09-14 20:59:05 +0200
commitdee575cf8de51c6381551bf835516d50830b174c (patch)
tree4866a3c0b5ca5a0318897cc1b59a73ef20d871c1
parent0e85b6fb0d69195be01b6186a9e8fef51284418f (diff)
downloadperlweeklychallenge-club-dee575cf8de51c6381551bf835516d50830b174c.tar.gz
perlweeklychallenge-club-dee575cf8de51c6381551bf835516d50830b174c.tar.bz2
perlweeklychallenge-club-dee575cf8de51c6381551bf835516d50830b174c.zip
Create 338_p1.rkt
-rw-r--r--challenge-338/hvukman/racket/338_p1.rkt33
1 files changed, 33 insertions, 0 deletions
diff --git a/challenge-338/hvukman/racket/338_p1.rkt b/challenge-338/hvukman/racket/338_p1.rkt
new file mode 100644
index 0000000000..e7833dc9db
--- /dev/null
+++ b/challenge-338/hvukman/racket/338_p1.rkt
@@ -0,0 +1,33 @@
+#lang racket
+
+(require rackunit)
+(require srfi/1) ; for fold
+
+(define input '((4 4 4 4) (10 0 0 0)
+ (2 2 2 9)))
+
+(define input2 '((1 5) (7 3)
+ (3 5) ))
+
+(define input3 '((1 2 3) (3 2 1)
+ ))
+
+(define input4 '((2 8 7) (7 1 3) (1 9 5)
+ ))
+
+(define input5 '((10 20 30) (5 5 5) (0 100 0) (25 25 25)
+ ))
+
+
+(check-equal? '(16 10 6 17 100)
+(for/list ( [i (list input input2 input3 input4 input5)]
+ )
+ (apply max (map (lambda (x) (fold + 0 x)) i))
+ ))
+
+(for/list ( [i (list input input2 input3 input4 input5)]
+ )
+ (apply max (map (lambda (x) (fold + 0 x)) i))
+ )
+
+