[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
List not getting filled up
From: |
uzibalqa |
Subject: |
List not getting filled up |
Date: |
Fri, 28 Jul 2023 23:21:42 +0000 |
I have the recursive function 'permutor'. When the condition '(<= k 1)' is
reached I add
word to the list 'mylist'. I only get one value, yet the '(message "%s" word)'
give me all
the words that I need. What is happening and what can I do ?
(defvar mylist '())
(defun permutor (k word)
"Generate all permutations of WORD."
(let ( (i 0) )
(if (<= k 1)
(progn
(message "%s" word)
(add-to-list 'mylist word))
(while (< i k)
(permutor (1- k) word)
(if (evenp i) ; even integer
(setq word (swap word i (1- k)))
(setq word (swap word 0 (1- k))))
(setq i (1+ i)))) )
word)
- List not getting filled up,
uzibalqa <=
- Re: List not getting filled up, tpeplt, 2023/07/30
- Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30
- RE: [External] : Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30
- RE: [External] : Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30