Compare commits

..

No commits in common. "19a7b4a287be6556f3a3de4cc7daa7edace92588" and "f5977e41e1a267410b16399db6a7fa66d36de411" have entirely different histories.

2 changed files with 10 additions and 12 deletions

View File

@ -5,7 +5,7 @@
(import (srfi srfi-1)
(srfi srfi-60))
(export log2 clog2 round-to
(export log2 clog2
one? power-of-two?
curry curry-r
transpose
@ -36,11 +36,6 @@
;;; Check for (x == 1)
(define (one? x) (= x 1))
;;; Round to the 'n' decimal place
(define (round-to n num)
(let ((k (expt 10 n)))
(/ (round (* num k)) k)))
;;; Currying
;;; Example: ((curry-r f 1) 2 3) -> (f 1 2 3)
(define (curry f . args)

View File

@ -8,7 +8,7 @@
;;;
;;; Remove redundant (zero range) constraints.
;;; Limit the weight value in positive range
;;; Limit weight in range (0..1]
;;;
(define (clean-constraints constrs)
(remove (lambda (c)
@ -20,11 +20,14 @@
(map (lambda (c)
(let ((from (inexact->exact (round (car c))))
(to (inexact->exact (round (cadr c))))
(w (let ((w (caddr c)))
(if (< w 0) 0 w))))
(if (> from to)
(list to from w)
(list from to w))))
(w (caddr c)))
(let ((w (cond
((< w 0) 0)
((> w 1) 1)
(else w))))
(if (> from to)
(list to from w)
(list from to w)))))
constrs)))
;;;
;;; Make constrained random number generator.