;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/mvc/model.el (defun make-world (dim len &optional init) (or init (setq init ".")) (if (= 1 dim) (make-list len init) (let ((world)) (dotimes (_ len) (push (make-world (1- dim) len init) world) ) world) )) (defun world-size (world) (length (flatten-list world)) ) (defun world-set (world pos to) (if (= 1 (length pos)) (setf (nth (car pos) world) to) (world-set (nth (car pos) world) (cdr pos) to) )) (defun world-get (world pos) (if (= 1 (length pos)) (nth (car pos) world) (world-get (nth (car pos) world) (cdr pos)) )) (provide 'model)