Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
13
Task/Combinations/Acornsoft-Lisp/combinations.lisp
Normal file
13
Task/Combinations/Acornsoft-Lisp/combinations.lisp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(defun comb (m n (i . 0))
|
||||
(cond ((zerop m) '(()))
|
||||
((eq i n) '())
|
||||
(t (append
|
||||
(mapc '(lambda (rest) (cons i rest))
|
||||
(comb (sub1 m) n (add1 i)))
|
||||
(comb m n (add1 i))))))
|
||||
|
||||
(defun append (a b)
|
||||
(cond ((null a) b)
|
||||
(t (cons (car a) (append (cdr a) b)))))
|
||||
|
||||
(map print (comb 3 5))
|
||||
|
|
@ -3,13 +3,13 @@ m = 3
|
|||
len result[] m
|
||||
#
|
||||
proc combinations pos val . .
|
||||
if pos <= m
|
||||
for i = val to n - m
|
||||
result[pos] = pos + i
|
||||
call combinations pos + 1 i
|
||||
.
|
||||
else
|
||||
print result[]
|
||||
.
|
||||
if pos <= m
|
||||
for i = val to n - m
|
||||
result[pos] = pos + i
|
||||
combinations pos + 1 i
|
||||
.
|
||||
else
|
||||
print result[]
|
||||
.
|
||||
.
|
||||
call combinations 1 0
|
||||
combinations 1 0
|
||||
|
|
|
|||
3
Task/Combinations/Phix/combinations-2.phix
Normal file
3
Task/Combinations/Phix/combinations-2.phix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">combinations</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"12345"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">),</span><span style="color: #008000;">','</span><span style="color: #0000FF;">)</span>
|
||||
<!--
|
||||
Loading…
Add table
Add a link
Reference in a new issue