Welcome to the CHICKEN Scheme pasting service

sia-supply.scm added by atweiden on Fri Jul 14 07:17:49 2017

(use srfi-1)

(define-constant genesis-subsidy 300000)
(define-constant minimum-subsidy  30000)
(define-constant genesis-height       0)
(define-constant maximum-height  500000)

(define (get-subsidy height)
  (let ((num (- genesis-subsidy height)))
    (if (>= num minimum-subsidy) num minimum-subsidy)))

(define-constant subsidy
  (map get-subsidy (iota (- maximum-height genesis-height) genesis-height)))

(define (sum-subsidy maximum)
  (if (= maximum 0)
    (list-ref subsidy 0)
    (+ (list-ref subsidy maximum)
       (sum-subsidy (- maximum 1)))))

(define-constant total-subsidy
  (map sum-subsidy (iota (- maximum-height genesis-height) genesis-height)))

; (printf "~A\n" (get-subsidy 500000))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Type in the text below:
     _             _               _     
  __| |_   _ _ __ | |__  _ __  ___| |__  
 / _` | | | | '_ \| '_ \| '_ \|_  / '_ \ 
| (_| | |_| | |_) | | | | | | |/ /| |_) |
 \__,_|\__, | .__/|_| |_|_| |_/___|_.__/ 
       |___/|_|                          
Visually impaired? Let me spell it for you (wav file) download WAV