mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 11:26:25 +02:00
SE3-KL: Klausurvorbereitung
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
#lang racket
|
#lang lazy
|
||||||
|
|
||||||
#|
|
#|
|
||||||
SE 3 Funktional Blatt 10
|
SE 3 Funktional Blatt 10
|
||||||
@ -43,8 +43,6 @@ Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
|||||||
(cdr x)))
|
(cdr x)))
|
||||||
))))
|
))))
|
||||||
r))))
|
r))))
|
||||||
(not t1)))
|
|
||||||
r))
|
|
||||||
|
|
||||||
(define (reflexiv? r)
|
(define (reflexiv? r)
|
||||||
(every (λ (x)
|
(every (λ (x)
|
||||||
|
|||||||
72
se3/G08_B12_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
72
se3/G08_B12_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#lang racket
|
||||||
|
|
||||||
|
#|
|
||||||
|
SE 3 Funktional Blatt 12
|
||||||
|
Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
||||||
|
|#
|
||||||
|
|
||||||
|
; 1)
|
||||||
|
|
||||||
|
; 1.
|
||||||
|
(define (wert-rec xs)
|
||||||
|
(letrec ((rec (λ (ys potenz acc)
|
||||||
|
(if (empty? ys)
|
||||||
|
acc
|
||||||
|
(rec
|
||||||
|
(cdr ys)
|
||||||
|
(+ 1 potenz)
|
||||||
|
(+ (* (car ys) (expt 10 potenz)) acc))))))
|
||||||
|
(rec xs 0 0)))
|
||||||
|
; 2.
|
||||||
|
(define (wert-higher xs)
|
||||||
|
(foldl
|
||||||
|
+
|
||||||
|
0
|
||||||
|
(map * xs
|
||||||
|
(let ((l (length xs)))
|
||||||
|
(letrec ((rec (λ (x acc)
|
||||||
|
(if (= x 0) acc
|
||||||
|
(rec (- x 1)
|
||||||
|
(cons
|
||||||
|
(expt 10 (- x 1))
|
||||||
|
acc))))))
|
||||||
|
(rec l '()))))
|
||||||
|
))
|
||||||
|
|
||||||
|
; 2)
|
||||||
|
|
||||||
|
; 2.1
|
||||||
|
(define kryptoStructure
|
||||||
|
'((A . 1)
|
||||||
|
(B . 2)
|
||||||
|
(C . 3)
|
||||||
|
(D . 4)
|
||||||
|
(E . 5)
|
||||||
|
(F . 6)
|
||||||
|
(G . 7)
|
||||||
|
(H . 8)
|
||||||
|
(I . 9)
|
||||||
|
(J . 10)
|
||||||
|
(K . 11)
|
||||||
|
(L . 12)
|
||||||
|
(M . 13)
|
||||||
|
(N . 14)
|
||||||
|
(O . 15)
|
||||||
|
(P . 16)
|
||||||
|
(Q . 17)
|
||||||
|
(R . 18)
|
||||||
|
(S . 19)
|
||||||
|
(T . 20)
|
||||||
|
(U . 21)
|
||||||
|
(V . 22)
|
||||||
|
(W . 23)
|
||||||
|
(X . 24)
|
||||||
|
(Y . 25)
|
||||||
|
(Z . 26)))
|
||||||
|
|
||||||
|
(define (key->wert key struktur)
|
||||||
|
(cdr (assoc key struktur)))
|
||||||
|
|
||||||
|
; 2.2
|
||||||
|
|
||||||
|
(andmap (λ (x) #t) '(1 2 3))
|
||||||
31
se3/probeklausur0809.rkt
Normal file
31
se3/probeklausur0809.rkt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#lang swindle
|
||||||
|
|
||||||
|
(require swindle/setf
|
||||||
|
swindle/misc)
|
||||||
|
|
||||||
|
; CLOS
|
||||||
|
|
||||||
|
(defclass* messgeraet ())
|
||||||
|
(defgeneric* einheit ((messgeraet))
|
||||||
|
:combination generic-append-combination)
|
||||||
|
(defgeneric* messwert ((messgeraet))
|
||||||
|
:combination generic-append-combination)
|
||||||
|
(defgeneric* genauigkeit ((messgeraet))
|
||||||
|
:combination generic-min-combination)
|
||||||
|
|
||||||
|
(defclass* thermometer (messgeraet))
|
||||||
|
(defclass* barometer (messgeraet))
|
||||||
|
(defclass* regenmesser (messgeraet))
|
||||||
|
|
||||||
|
(defclass* wetterstation (thermometer barometer regenmesser))
|
||||||
|
|
||||||
|
; Logik
|
||||||
|
|
||||||
|
(?- (kamera ?kamID ? ? 24 ?))
|
||||||
|
(?- (kamera ?kamID ? ? 18 ?)
|
||||||
|
(angebot ?kamID ? ?preis))
|
||||||
|
(?- (anbieter ?anbID ?anbName ?lieferzeit ? ?)
|
||||||
|
(test (<= ?lieferzeit 1))
|
||||||
|
(angebot ?kamID ?anbID ?)
|
||||||
|
(kamera ?kamID ?kameraname ?hersteller ? ?))
|
||||||
|
|
||||||
Reference in New Issue
Block a user