Article View: fj.lang.lisp
Article #191Re: combination
From: Kazuhito NARITA
Date: Fri, 09 May 1997 00:00
Date: Fri, 09 May 1997 00:00
43 lines
1428 bytes
1428 bytes
$@$F$-$H!<$K:n$C$?$N$GL5BL$,B?$$$H;W$$$^$9$,!"$H$j$"$($:F0:n$7$^$9(J
(defun combination (a)
(interactive)
(cond ((cdr a)
(cond ((cdr (cdr a))
(combination (cons (subcombin (car a) (car (cdr a)))
(cdr (cdr a)))))
(t
(subcombin (car a) (car (cdr a))))))
((listp a)
(cond ((listp (car a))
(car a))
(t
a)))
(t
(list a))))
(defun subcombin (a b)
(cond ((nlistp a) (setq a (list a))))
(cond ((nlistp b) (setq b (list b))))
(let ((resultA nil)
(resultB nil)
(c nil))
(while (car a)
(setq resultB nil)
(setq c b)
(while (car c)
(setq resultB (append resultB (list (concat (car a) (car c)))))
(setq c (cdr c)))
(setq resultA (append resultA resultB))
(setq a (cdr a)))
resultA))
$@<B9T7k2L(J
(combination '(("A" "B") "1" ("X" "Y")))
-> ("A1X" "A1Y" "B1X" "B1Y")
--
==-----------==
Kazuhito Narita
==-----------==
Technical Details
Message-ID:
<KAZUKUN.97May9203048@africatwin.cv.sony.co.jp>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<19970430113102U.minakaji@osaka.email.ne.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 1421c0,cee8831244ce8046 X-Google-Attributes: gid1421c0,public From: kazukun@cv.sony.co.jp (Kazuhito NARITA) Subject: Re: combination Date: 1997/05/09 Message-ID: <KAZUKUN.97May9203048@africatwin.cv.sony.co.jp> X-Deja-AN: 240479605 Sender: news@sony.co.jp References: <19970430113102U.minakaji@osaka.email.ne.jp> Followup-To: fj.lang.lisp Organization: Sony Corporation, Consumer Video Group Newsgroups: fj.lang.lisp