Sha256: 2ec04035d6319e8d827b7d8484858238a2f6d2fdaa3600c7f93c622627932625
Contents?: true
Size: 605 Bytes
Versions: 396
Compression:
Stored size: 605 Bytes
Contents
(defmodule largest-series-product (export (from-string 2))) (defun from-string ([string n] (from-string (length string) string n))) (defun from-string ([length string n] (when (>= length n)) (lists:max (lists:map #'product/1 (sets length n string))))) (defun product ([set] (lists:foldl #'product/2 1 set))) (defun product ([c acc] (when (andalso (=< #\0 c) (=< c #\9))) (* (- c #\0) acc))) (defun sets ([length width (= (cons _ t) string)] (when (> length width)) (cons (lists:sublist string width) (sets (- length 1) width t))) ([_length _width string] `(,string)))
Version data entries
396 entries across 396 versions & 1 rubygems