Hatena::Groupcadr

わだばLisperになる このページをアンテナに追加 RSSフィード

2004 | 12 |
2005 | 01 | 02 | 07 | 10 | 11 |
2006 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2007 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2008 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2009 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2010 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2011 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 11 |

2007-07-21

.10

| 22:58 | .10 - わだばLisperになる を含むブックマーク はてなブックマーク - .10 - わだばLisperになる

日課練習、日課練習、日課練習、append-map

(defun append-map (f &rest clists)
  (apply #'append (apply #'mapcar f clists)))

(defun append-map (f &rest clists)
  (prog (result)
    L   (cond ((some #'endp clists) (return (apply #'append (nreverse result)))))
        (push (apply f (mapcar #'car clists)) result)
        (setq clists (mapcar #'cdr clists))
        (go L)))

(defun append-map (f &rest clists)
  (prog (result splice)
        (setq result (apply f (mapcar #'car clists)))
        (setq splice result)
    L   (setq clists (mapcar #'cdr clists))
        (cond ((some #'null clists) (return result)))
        (setq splice (last (rplacd (last splice) (apply f (mapcar #'car clists)))))
        (go L)))

(defun append-map (f &rest clists)
  (let ((result (apply f (mapcar #'car clists))))
    (do ((l (mapcar #'cdr clists) (mapcar #'cdr l))
	 (splice result (last (rplacd (last splice) (apply f (mapcar #'car l))))))
	((some #'null l) result))))

ゲスト



トラックバック - http://cadr.g.hatena.ne.jp/g000001/20070721