Look for invalid ids.
This commit is contained in:
parent
e1ffc98c53
commit
e6d383b020
2 changed files with 16 additions and 4 deletions
|
@ -92,7 +92,8 @@
|
|||
(import (chicken string)
|
||||
(chicken sort))
|
||||
(define (print-members-base-info mb)
|
||||
(let ((nicks (list-members-nicks mb)))
|
||||
(let ((nicks (list-members-nicks mb))
|
||||
(ids (list-members-ids mb)))
|
||||
(print "Members ("
|
||||
(length nicks)
|
||||
"): "
|
||||
|
@ -100,7 +101,16 @@
|
|||
(sort
|
||||
nicks
|
||||
string<?)
|
||||
", "))))
|
||||
", "))
|
||||
(print "Total IDs: "
|
||||
(length ids)
|
||||
" (" (length (filter is-4digit-prime? ids)) " valid)")
|
||||
(let ((invalid-ids (filter (compose not is-4digit-prime?) ids)))
|
||||
(when (not (null? invalid-ids))
|
||||
(print " Invalid (" (length invalid-ids) "): "
|
||||
(string-intersperse
|
||||
(map number->string invalid-ids)
|
||||
", "))))))
|
||||
|
||||
(define (print-member-record-info mr)
|
||||
(let* ((id (dict-ref mr 'id))
|
||||
|
|
|
@ -55,8 +55,10 @@
|
|||
#t))))))
|
||||
|
||||
;; Generates list of primes less than given argument.
|
||||
(define (gen-primes less-than)
|
||||
(let loop ((primes '(2))
|
||||
(define (gen-primes less-than . init)
|
||||
(let loop ((primes (if (null? init)
|
||||
'(2)
|
||||
init))
|
||||
(number 3))
|
||||
(if (< number less-than)
|
||||
(loop (if (check-prime primes number)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue