Paste number 80513: Unknown list transform

Index of paste annotations: 1

Paste number 80513: Unknown list transform
Pasted by: meingbg
When:1 year, 3 months ago
Share:Tweet this! | http://paste.lisp.org/+1Q4H
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
(defun tassoc (path alist &key key (test nil) (test-not nil))
  "A recursive assoc to operate on tree structures."
  (let ((n (cond
	     ((and (not test) (not test-not))
	      (assoc (first path) alist :key key))
	     ((not test)
	      (assoc (first path) alist :key key :test-not test-not))
	     ((not test-not)
	      (assoc (first path) alist :key key :test test))
	     (t (assoc (first path) alist :key key
		       :test test :test-not test-not)))))
    (cond ((not (rest path)) n)
	  ((not n) n)
	  (t (tassoc (rest path) n :key key :test test :test-not test-not)))))

Annotations for this paste:

Annotation number 1: Seems to work now, with test and test-not mutually exclusive
Pasted by: meingbg
When:1 year, 3 months ago
Share:Tweet this! | http://paste.lisp.org/+1Q4H/1
Paste contents:
Raw Source | Display As
(defun tassoc (path alist &key key (test nil) (test-not nil))
  "A recursive assoc to operate on tree structures."
  (let ((n (cond
	     ((and (not test) (not test-not))
	      (assoc (first path) alist :key key))
	     ((not test)
	      (assoc (first path) alist :key key :test-not test-not))
	     (t (assoc (first path) alist :key key :test test)))))
    (cond ((not (rest path)) n)
	  ((not n) n)
	  (t (tassoc (rest path) n :key key :test test :test-not test-not)))))

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.