Search found 2 matches
- Wed Oct 19, 2011 12:17 pm
- Forum: Common Lisp
- Topic: Generating lists of given length
- Replies: 3
- Views: 5804
Re: Generating lists of given length
I've written some code that generates lists of given length and consisting of 2 types of elements. The result is a list that consists of lists representing the chains of elements. When n=1,the result is ((a) (b)),when n=2 the result is ((a a)(b a)(a b)(b b)).Here is my code: (defun ota(c d)(if (null...
- Mon Sep 26, 2011 4:16 pm
- Forum: Common Lisp
- Topic: Generating lists of given length
- Replies: 3
- Views: 5804
Generating lists of given length
Hello.How can I generate all possible lists of length n,consisting of elements "a" and "b".For example,if n=5 there must be 32 lists of length 5,consisting of "a" and "b".