; scheme:
(define seqL
(lambda (new old l)
(cons new (cons old l))))
(define insert-g
(lambda (seq)
(lambda (new old l)
(cond
((null l) (quote ()))
((eq? (car l) old) (seq new old (cdr l)))
(else (cons (car l)
((insert-g seq) new old (cdr l))))))))
(define insertL (insert-g seqL))
; lisp:
(defun seqL (new old l)
(cons new (cons old l)))
(defun insert-g (seq)
(lambda (new old l)
(cond
((null l) nil)
((eq (car l) old) (funcall seq new old (cdr l)))
(t (cons (car l)
(funcall (insert-g seq) new old (cdr l)))))))
(defun insertL (new old l)
(funcall (insert-g (function seqL)) new old l))