#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))
I2xhbmcgcmFja2V0CgoocmVxdWlyZSAob25seS1pbiBzcmZpLzEgbHNldC1hZGpvaW4pKQoKOyBjb3B5LWxpc3QKKGRlZmluZSAob3VyLWNvcHktbGlzdCBsc3QpCiAgKGZvbGRyIChsYW1iZGEgKHggZikgKGNvbnMgeCBmKSkgJygpIGxzdCkpCgo7IHJlbW92ZS1kdXBsaWNhdGVzCihkZWZpbmUgKG91ci1yZW1vdmUtZHVwbGljYXRlcyBsc3QpCiAgKGZvbGRyIChsYW1iZGEgKHggZikgKGxzZXQtYWRqb2luIGVxdj8gZiB4KSkgJygpIGxzdCkpCgo7IGZpbmQtaWYKKGRlZmluZSAob3VyLWZpbmQtaWYgZm4gbHN0KQogIChmb2xkciAobGFtYmRhICh4IGYpIChpZiAoZm4geCkgeCBmKSkgI2YgbHN0KSkKCjsgc29tZQooZGVmaW5lIChvdXItc29tZSBmbiBsc3QpCiAgKGZvbGRyIChsYW1iZGEgKHggZikgKG9yIChmbiB4KSBmKSkgI2YgbHN0KSkKCjs7IOODhuOCueODiAo7IG91ci1jb3B5LWxpc3QKKGRlZmluZSAqbHN0KiAobGlzdCAxIChsaXN0IDIgMykpKQooZGVmaW5lICpjbHN0KiAob3VyLWNvcHktbGlzdCAqbHN0KikpCihlcT8gKmNsc3QqICpsc3QqKQooZXF1YWw/ICpjbHN0KiAqbHN0KikKCjsgb3VyLXJlbW92ZS1kdXBsaWNhdGVzCihvdXItcmVtb3ZlLWR1cGxpY2F0ZXMgJyhhIGIgYyBiIGQgZCBlKSkKCjsgb3VyLWZpbmQtaWYKKG91ci1maW5kLWlmIGV2ZW4/ICcoMyAxIDQgMSA1IDkpKQoKOyBvdXItc29tZQoob3VyLXNvbWUgaW50ZWdlcj8gJygxIDMgYiAyLjcpKQoob3VyLXNvbWUgaW50ZWdlcj8gJyhhIDMuMSBiIDIuNykpCg==