#lang racket
(require (only-in srfi/1 lset-adjoin))
; copy-list
(define (our-copy-list lst)
(foldr (lambda (x f) (cons x f)) '() lst))
; remove-duplicates
(define (our-remove-duplicates lst)
(foldr (lambda (x f) (lset-adjoin eqv? f x)) '() lst))
; find-if
(define (our-find-if fn lst)
(foldr (lambda (x f) (if (fn x) x f)) #f lst))
; some
(define (our-some fn lst)
(foldr (lambda (x f) (or (fn x) f)) #f lst))
;; ใในใ
; our-copy-list
(define *lst* (list 1 (list 2 3)))
(define *clst* (our-copy-list *lst*))
(eq? *clst* *lst*)
(equal? *clst* *lst*)
; our-remove-duplicates
(our-remove-duplicates '(a b c b d d e))
; our-find-if
(our-find-if even? '(3 1 4 1 5 9))
; our-some
(our-some integer? '(1 3 b 2.7))
(our-some integer? '(a 3.1 b 2.7))