Changeset 38250 in project


Ignore:
Timestamp:
03/14/20 18:39:01 (2 weeks ago)
Author:
Kon Lovett
Message:

fx% & fx! (joke)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/fx-utils/trunk/fx-utils.scm

    r38103 r38250  
    138138        (loop (cdr fxs) (fxmax mx cur) (fxmin mn cur)) ) ) ) )
    139139
     140#|
     141;;
     142
     143(: fx% (fixnum fixnum --> fixnum))
     144;
     145(define (fx% n p)
     146  (fx/ (fx* p n) 100) )
     147
     148;;
     149
     150(: fx! (fixnum --> fixnum))
     151;
     152(define (fx! n)
     153  (cond
     154    ((fx>= 0 n) 0)
     155    ((fx= 1 n)  1)
     156    ((fx= 2 n)  1)
     157    (else
     158      (fx+ (fx! (fx- n 1)) (fx! (fx- n 2))) ) ) )
     159|#
     160
    140161) ;fx-utils
Note: See TracChangeset for help on using the changeset viewer.