Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

main

(defun combination (l n k pos last)
    (if (eq pos k)
     	(list (copy-list l))
    
        (if (AND (< last n) (< pos k) ) 
	    (append (combination (cons last l) n k (+ pos 1) last) (combination l n k pos (+ last 1))   )
            	    
	    (combination (cons last l) n k (+ pos 1) last )	    	  
        )
    )
)

(defun generator (n k)
    (combination '() n k 0 1 )       
)

(generator 5 3)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.