removed functions that exist in racket
This commit is contained in:
parent
cead718a1a
commit
a88c6e0218
1 changed files with 9 additions and 6 deletions
15
rhs/rhs.rkt
15
rhs/rhs.rkt
|
@ -13,6 +13,9 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
|
|
||||||
|#
|
|#
|
||||||
|
|
||||||
|
|
||||||
|
(provide (all-defined-out))
|
||||||
|
|
||||||
;; prelude.scm ;;;;;;;;;;;;;;;;;;;;;;
|
;; prelude.scm ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; enumFromThenTo :: a -> a -> a -> [a]
|
;; enumFromThenTo :: a -> a -> a -> [a]
|
||||||
|
@ -236,7 +239,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(find-indices (lambda (y) (equal? x y)) l)))
|
(find-indices (lambda (y) (equal? x y)) l)))
|
||||||
|
|
||||||
;; find :: (a -> Bool) -> [a] -> Maybe a
|
;; find :: (a -> Bool) -> [a] -> Maybe a
|
||||||
(define find
|
#;(define find
|
||||||
(lambda (f l)
|
(lambda (f l)
|
||||||
(if (null? l)
|
(if (null? l)
|
||||||
#f
|
#f
|
||||||
|
@ -268,7 +271,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(g f l 0))))
|
(g f l 0))))
|
||||||
|
|
||||||
;; filter :: (a -> Bool) -> [a] -> [a]
|
;; filter :: (a -> Bool) -> [a] -> [a]
|
||||||
(define filter
|
#;(define filter
|
||||||
(lambda (f l)
|
(lambda (f l)
|
||||||
(if (null? l)
|
(if (null? l)
|
||||||
nil
|
nil
|
||||||
|
@ -381,7 +384,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(last xs)))))
|
(last xs)))))
|
||||||
|
|
||||||
;; length :: [a] -> Int
|
;; length :: [a] -> Int
|
||||||
(define length
|
#;(define length
|
||||||
(lambda (l)
|
(lambda (l)
|
||||||
(if (null? l)
|
(if (null? l)
|
||||||
0
|
0
|
||||||
|
@ -413,7 +416,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(cons x (cons y (cons z (cons a (cons b nil)))))))
|
(cons x (cons y (cons z (cons a (cons b nil)))))))
|
||||||
|
|
||||||
;; (!!) :: [a] -> Int -> a
|
;; (!!) :: [a] -> Int -> a
|
||||||
(define list-ref
|
#;(define list-ref
|
||||||
(lambda (l n)
|
(lambda (l n)
|
||||||
(if (= n 0)
|
(if (= n 0)
|
||||||
(head l)
|
(head l)
|
||||||
|
@ -499,7 +502,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(all (lambda (y) (not (equal? x y))) l)))
|
(all (lambda (y) (not (equal? x y))) l)))
|
||||||
|
|
||||||
;; null :: [a] -> Bool
|
;; null :: [a] -> Bool
|
||||||
(define null?
|
#;(define null?
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(equal? x nil)))
|
(equal? x nil)))
|
||||||
|
|
||||||
|
@ -535,7 +538,7 @@ Licensed under GPL (2 or 3? FIXME)
|
||||||
(cons x (replicate (- n 1) x)))))
|
(cons x (replicate (- n 1) x)))))
|
||||||
|
|
||||||
;; reverse :: [a] -> [a]
|
;; reverse :: [a] -> [a]
|
||||||
(define reverse
|
#;(define reverse
|
||||||
(lambda (l)
|
(lambda (l)
|
||||||
(foldl (flip cons) nil l)))
|
(foldl (flip cons) nil l)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue