packages feed

sifflet-lib-1.0: data/sifflet.scm

;;; Sifflet function library for Scheme
;;;
;;; All symbols beginning with "sifflet-" or "*sifflet-" are
;;; reserved by Sifflet.
;;;
;;; The symbol *sifflet-undefined* is expected NOT to be defined!

;;; Adding and subtracting 1

(define (sifflet-add1 n) (+ n 1))

(define (sifflet-sub1 n) (- n 1))

;;; Scheme's quotient function is incompatible with Haskell div.
(define (sifflet-div x y) (floor (/ x y)))

;;; Scheme's / operation typically gives exact results:
;;; should this make any difference?
(define sifflet-/
  (if (exact? (/ 3 2))
      (lambda (x y) (exact->inexact (/ x y)))
      /))

;;; == and /= belong to the Eq class, which implies general
;;; equality, not limited to numbers.
(define (sifflet-not-equal? x y) (not (= x y)))