;; -*-theme-*-

;; Copyright (C) 2024 Tommi Höynälänmaa
;; Distributed under GNU Lesser General Public License version 3,
;; see file doc/LGPL-3.

(define-proper-program (examples fold)
  
  (import (standard-library core)
          (standard-library list-utilities)
          (standard-library console-io))
  
  (define-main-proc (() <none> nonpure)
    (console-display-line (fold1 + 0 '(1 4 6 10 11)))
    (console-display-line
     (fold1 cons
            (static-cast (:uniform-list <integer>) null)
            '(1 4 6 10 11)))
    (console-display-line (fold-right1 + 0 '(1 4 6 10 11)))
    (console-display-line
     (fold-right1 cons
                  (static-cast (:uniform-list <integer>) null)
                  '(1 4 6 10 11)))))

