git @ Cat's Eye Technologies Decoy / master junk / list.scm
master

Tree @master (Download .tar.gz)

list.scm @masterraw · history · blame

; SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
; For more information, please refer to <https://unlicense.org/>
; SPDX-License-Identifier: Unlicense

(define module "list")

(import-from "stdenv" (list car cdr equal?))

(define null? (lambda (x)
  (equal? x (list))))

(define _fold (lambda (_fold fun acc lis)
  (if (null? lis) acc (_fold _fold fun (fun (car lis) acc) (cdr lis)))))

(define fold (lambda (fun acc lis)
  (_fold _fold fun acc lis)))