help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp Live buffer


From: Emanuel Berg
Subject: Re: Lisp Live buffer
Date: Tue, 27 Dec 2022 02:12:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

> (defun world-set (world pos to)
>   (if (= 1 (length pos))
>       (setcar (nthcdr (car pos) world) to)
>     (setcar
>       (nthcdr (car pos) world)
>       (world-set (car (nthcdr (car pos) world)) (cdr pos) to) ))
>   world)

Also not right ...

(defun world-set (world pos to)
  (if (= 1 (length pos))
      (setf (nth (car pos) world) to)
    (setcar
      (nthcdr (car pos) world)
      (world-set (nth (car pos) world)
                 (cdr pos)
                 to) ))
  world)

(defun world-set-test ()
  (let ((ttt (make-world 2 3)) )
    (world-set ttt '(0 1) "a") ))

;; (world-set-test) ; (("." "a" ".") ("." "a" ".") ("." "a" "."))

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]