Remove bak
This commit is contained in:
parent
1bbccb2644
commit
707cf4a382
1 changed files with 0 additions and 207 deletions
207
test.bak
207
test.bak
|
|
@ -1,207 +0,0 @@
|
||||||
#lang racket
|
|
||||||
;(define (fib n) (
|
|
||||||
; if (= n 0)
|
|
||||||
; 0
|
|
||||||
; (
|
|
||||||
; if (= n 1)
|
|
||||||
; 1
|
|
||||||
; (+ (fib (- n 1)) (fib (- n 2)))
|
|
||||||
; )
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(fib 10)
|
|
||||||
|
|
||||||
|
|
||||||
;(define (fib n) (
|
|
||||||
; (cond
|
|
||||||
; [(= n 0) 0]
|
|
||||||
; [(= n 1) 1]
|
|
||||||
; [else
|
|
||||||
; (+ (fib (- n 1)) fib (- n 2))
|
|
||||||
; ]
|
|
||||||
; )
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(fib 10)
|
|
||||||
|
|
||||||
;(define list1 ( list 1 2 3 4 ))
|
|
||||||
;
|
|
||||||
;(define (sum list) (
|
|
||||||
; if (empty? list)
|
|
||||||
; 0
|
|
||||||
; ;else
|
|
||||||
; (
|
|
||||||
; +
|
|
||||||
; (first list)
|
|
||||||
; ( sum(rest list) )
|
|
||||||
; )
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(sum list1)
|
|
||||||
|
|
||||||
;(define (list-with-length len) (
|
|
||||||
; if (= len 0)
|
|
||||||
; empty
|
|
||||||
; (
|
|
||||||
; cons 0 (list-with-length (- len 1) )
|
|
||||||
; )
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(list-with-length 10)
|
|
||||||
|
|
||||||
;(filter (lambda (x) (> x 10) ) (list 0 5 10 15 20) )
|
|
||||||
|
|
||||||
;(map (lambda (x) (+ x 10)) (list 0 1 2 3) )
|
|
||||||
|
|
||||||
;(define (repeat fct times) (
|
|
||||||
;
|
|
||||||
;))
|
|
||||||
|
|
||||||
;(define-struct abc (a b))
|
|
||||||
;
|
|
||||||
;;; Type: abc -> list
|
|
||||||
;;; Returns: bla bla
|
|
||||||
;(define (foo p) (
|
|
||||||
; ;(
|
|
||||||
; if (abc? p)
|
|
||||||
; (
|
|
||||||
; if (list? (abc-b p))
|
|
||||||
; ;(
|
|
||||||
; (list (abc-a p) (abc-b p))
|
|
||||||
; ;)
|
|
||||||
; ;else
|
|
||||||
; ;(
|
|
||||||
; #f
|
|
||||||
; ;)
|
|
||||||
; )
|
|
||||||
; ; else
|
|
||||||
; #f
|
|
||||||
; ;)
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;;(define test (make-abc ("asdf" (list 1 2 3 4))))
|
|
||||||
;
|
|
||||||
;(foo (make-abc 123 (list 1 2 3 4)))
|
|
||||||
;
|
|
||||||
;(foo 123)
|
|
||||||
;
|
|
||||||
;(foo (make-abc 123 1234))
|
|
||||||
;
|
|
||||||
|
|
||||||
;(define (contains-x? liste x) (
|
|
||||||
; cond
|
|
||||||
; [(list? x) #f]
|
|
||||||
; [(not (list? liste)) #f]
|
|
||||||
; [(empty? liste) #f]
|
|
||||||
; [
|
|
||||||
; (= (first liste) x)
|
|
||||||
; #t
|
|
||||||
; ]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (contains-x? (rest liste) x)
|
|
||||||
; ]
|
|
||||||
;
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(contains-x? (list 12) (list 12 5))
|
|
||||||
|
|
||||||
|
|
||||||
;(define (contains-x? liste x) (
|
|
||||||
; cond
|
|
||||||
; [(list? x) #f]
|
|
||||||
; [(not (list? liste)) #f]
|
|
||||||
; [(empty? liste) #f]
|
|
||||||
; [
|
|
||||||
; (= (first liste) x)
|
|
||||||
; #t
|
|
||||||
; ]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (contains-x? (rest liste) x)
|
|
||||||
; ]
|
|
||||||
;
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(define (duplicate? lst) (
|
|
||||||
; cond
|
|
||||||
; [(not (list? lst)) #f]
|
|
||||||
; [(empty? lst) #f]
|
|
||||||
; [
|
|
||||||
; (contains-x? (rest lst) (first lst))
|
|
||||||
; #t
|
|
||||||
; ]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (duplicate? (rest lst))
|
|
||||||
; ]
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(duplicate? (list 1 2 3 4 5 6 7 3))
|
|
||||||
|
|
||||||
|
|
||||||
;(define (contains-x? liste x) (
|
|
||||||
; cond
|
|
||||||
; [(list? x) #f]
|
|
||||||
; [(not (list? liste)) #f]
|
|
||||||
; [(empty? liste) #f]
|
|
||||||
; [
|
|
||||||
; (= (first liste) x)
|
|
||||||
; #t
|
|
||||||
; ]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (contains-x? (rest liste) x)
|
|
||||||
; ]
|
|
||||||
;
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(define (duplicate? lst) (
|
|
||||||
; cond
|
|
||||||
; [(not (list? lst)) #f]
|
|
||||||
; [(empty? lst) #f]
|
|
||||||
; [
|
|
||||||
; (contains-x? (rest lst) (first lst))
|
|
||||||
; #t
|
|
||||||
; ]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (duplicate? (rest lst))
|
|
||||||
; ]
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(define (collect lst oracle) (
|
|
||||||
; cond
|
|
||||||
; [(empty? lst) oracle]
|
|
||||||
; [
|
|
||||||
; else
|
|
||||||
; (if (list? (first lst))
|
|
||||||
; (collect (rest lst) (collect (first lst) oracle))
|
|
||||||
; (
|
|
||||||
; collect (rest lst) (cons (first lst) oracle)
|
|
||||||
; ))
|
|
||||||
; ]
|
|
||||||
;))
|
|
||||||
;
|
|
||||||
;(collect (list 1 2 3 (list 1 4 6)) empty)
|
|
||||||
;
|
|
||||||
;;(define (duplicates-deep? deep-lst) (
|
|
||||||
;;
|
|
||||||
;;))
|
|
||||||
;
|
|
||||||
;
|
|
||||||
;;; Type: ( list of ANY ) -> number
|
|
||||||
;;; Returns: the sum of the fees of all student in the list
|
|
||||||
;( define ( sum-of-student-fees list )
|
|
||||||
;( my-fold
|
|
||||||
;( lambda ( x y ) ( + x y ) )
|
|
||||||
;0
|
|
||||||
;( my-map
|
|
||||||
;( lambda ( stud ) ( student-fee stud ) )
|
|
||||||
;( my-filter ( lambda ( x ) ( student? x ) ) list ) ) ) )
|
|
||||||
|
|
||||||
|
|
||||||
(define asdf 10)
|
|
||||||
|
|
||||||
(check-expect asdf 10)
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue