/usr/share/doc/stalin/benchmarks/deriv.sc is in stalin 0.11-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; File: deriv.sc
;;; Description: The DERIV benchmark from the Gabriel tests.
;;; Author: Vaughan Pratt
;;; Created: 8-Apr-85
;;; Modified: 10-Apr-85 14:53:50 (Bob Shaw)
;;; 23-Jul-87 (Will Clinger)
;;; 9-Feb-88 (Will Clinger)
;;; 21-Mar-94 (Qobi)
;;; 31-Mar-98 (Qobi)
;;; Language: Scheme
;;; Status: Public Domain
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; DERIV -- Symbolic derivative benchmark written by Vaughan Pratt.
;;; It uses a simple subset of Lisp and does a lot of CONSing.
;;; Returns the wrong answer for quotients.
;;; Fortunately these aren't used in the benchmark.
(define (deriv-aux a) (list '/ (deriv a) a))
(define (deriv a)
(cond ((not (pair? a)) (cond ((eq? a 'x) 1) (else 0)))
((eq? (car a) '+) (cons '+ (map deriv (cdr a))))
((eq? (car a) '-) (cons '- (map deriv (cdr a))))
((eq? (car a) '*) (list '* a (cons '+ (map deriv-aux (cdr a)))))
((eq? (car a) '/)
(list '-
(list '/ (deriv (cadr a)) (caddr a))
(list '/
(cadr a)
(list '* (caddr a) (caddr a) (deriv (caddr a))))))
(else 'error)))
(define (run)
(do ((i 0 (+ i 1))) ((= i 1000))
(deriv '(+ (* 3 x x) (* a x x) (* b x) 5))
(deriv '(+ (* 3 x x) (* a x x) (* b x) 5))
(deriv '(+ (* 3 x x) (* a x x) (* b x) 5))
(deriv '(+ (* 3 x x) (* a x x) (* b x) 5))
(deriv '(+ (* 3 x x) (* a x x) (* b x) 5))))
(do ((i 0 (+ i 1))) ((= i 1000)) (run))
|