(defun read-crab (name) (flow (file-get-string name) (tok #/\d+/) (mapcar toint))) (defun calc (input) (let* ((mn (find-min input)) (mx (find-max input)) (rg (range mn mx)) (cost (op sum input (op abs (- @1 @@1))))) [cost (find-min rg : cost)])) (defun calc2 (input) (let* ((mn (find-min input)) (mx (find-max input)) (rg (range mn mx)) (cost (op sum input (opip (- @@1) abs (* @1 (succ @1)) (trunc @1 2)) #;(lambda (x) (let ((n (abs (- x @1)))) (trunc (* n (succ n)) 2)))))) [cost (find-min rg : cost)]))