;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/tent.el (require 'cl-lib) (when nil (cl-loop with gear = '(("tent" 2530) ("backpack 50L" 1320) ("sleeping bag" 1215) ("Trangia" 1030) ("sleeping pad" 895) ("rubber mallet" 460) ("book" 440) ("head torch 3*AAA" 110) ("knife" 110) ("bottle 1L" 100) ("map" 60) ("BBQ lighter" 58) ("scissors" 45) ("extra 4*AAA" 44) ("flashlight 1*AAA" 33) ("methylated spirit" nil) ; consumables ("mosquito repellent" nil) ) with weight = 0 with items = (length gear) for (_ w) in gear do (when (numberp w) (cl-incf weight w) ) finally return (format "%s items, %s g" items weight) ) ) ;; eval ^ ;; 17 items, 8450 g (provide 'tent)