Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -0,0 +1,31 @@
|
|||
;; Iterate over all permutations of a list, and
|
||||
;; call a function on each.
|
||||
(define (permute permute.seq permute.func (permute.built '()))
|
||||
(if (null? permute.seq)
|
||||
(permute.func permute.built)
|
||||
(let (seq (copy permute.seq))
|
||||
(dotimes (i (length seq))
|
||||
(unless (zero? i) (rotate seq -1))
|
||||
(permute
|
||||
(rest seq)
|
||||
permute.func
|
||||
(cons (first seq) permute.built))))))
|
||||
|
||||
(define (adjacent a b lst)
|
||||
(= 1 (abs (- (find a lst)
|
||||
(find b lst)))))
|
||||
|
||||
(define (check lst)
|
||||
(if
|
||||
(and
|
||||
(< (find 'baker lst) 4)
|
||||
(> (find 'cooper lst) 0)
|
||||
(not (member (find 'fletcher lst) '(0 4)))
|
||||
(> (find 'miller lst) (find 'cooper lst))
|
||||
(not (adjacent 'smith 'fletcher lst))
|
||||
(not (adjacent 'cooper 'fletcher lst)))
|
||||
(println lst)))
|
||||
|
||||
(permute '(baker cooper fletcher miller smith) check)
|
||||
|
||||
(smith cooper baker fletcher miller)
|
||||
Loading…
Add table
Add a link
Reference in a new issue