Skip to content

Instantly share code, notes, and snippets.

@MarkShulhin
Last active September 27, 2017 14:56
Show Gist options
  • Save MarkShulhin/d2d92f164a2c0239a74b7110ea197c21 to your computer and use it in GitHub Desktop.
Save MarkShulhin/d2d92f164a2c0239a74b7110ea197c21 to your computer and use it in GitHub Desktop.
Scheme lab 3
#lang scheme
(define (reverse1 l)
(if (null? l)
null
(append (reverse1 (cdr l)) (list (car l)))))
(define (DFM atom list rezlist)
(cond ((or (equal? atom '())(equal? list '())) '(wrong input!))
((equal? atom (car list)) (reverse1 (cons (cdr list) rezlist)))
(#t (DFM atom (cdr list) (cons (car list) rezlist)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment