@phoopio/

subst

Scheme

replaces either first occurrence of o1 or o2 with new

fork
loading
main.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
(define subst
  (lambda(new o1 o2 lat)
    cond
      ((null? lat) quote())
      (else 
        (cond
          or(
            (eq? (car lat) o1)
            (eq? (car lat) o2)
          )
          (cons new (cdr lat))
        else (cons (car lat) (subst new o1 o2 (cdr lat)
      )))))
BiwaScheme Interpreter version 0.6.4 Copyright (C) 2007-2014 Yutaka HARA and the BiwaScheme team