Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; ====== Problem 5.2 ======
- ;; creation of predicates
- ;; categorie=?: product symbol -> bool
- ;;
- ;; example: (categorie=? tea 'drink) ergibt true
- (define (categorie=? prod categ)
- (if (symbol=? (product-categorie prod) categ) true
- false)
- )
- ;; cheaper?: product number -> bool
- ;;
- ;; example: (cheaper? apple 0.5) ergibt false
- (define (cheaper? prod value)
- (if (< (product-price prod) value) true
- false)
- )
- (check-expect (categorie=? apple 'fruit) true)
- (check-expect (categorie=? tea 'fruit) false)
- (check-expect (cheaper? apple 0.5) false)
- (check-expect (cheaper? banana 55) true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement