Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
;; This efficient sort method uses the list library for permutations
|
||||
|
||||
(lib 'list)
|
||||
(define (in-order L)
|
||||
(cond
|
||||
((empty? L) #t)
|
||||
((empty? (rest L)) #t)
|
||||
(else (and ( < (first L) (second L)) (in-order (rest L))))))
|
||||
|
||||
(define L (shuffle (iota 6)))
|
||||
→ (1 5 4 2 0 3)
|
||||
|
||||
(for ((p (in-permutations (length L ))))
|
||||
#:when (in-order (list-permute L p))
|
||||
(writeln (list-permute L p)) #:break #t)
|
||||
|
||||
→ (0 1 2 3 4 5)
|
||||
Loading…
Add table
Add a link
Reference in a new issue