From c5fcf7179a83ef65c86c6a4a390029149e518649 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Tue, 5 Oct 2021 21:49:54 +0200 Subject: Duzy commit ze smieciami --- Semestr 2/racket/lista6/solution.bak | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 Semestr 2/racket/lista6/solution.bak (limited to 'Semestr 2/racket/lista6/solution.bak') diff --git a/Semestr 2/racket/lista6/solution.bak b/Semestr 2/racket/lista6/solution.bak deleted file mode 100644 index 0805991..0000000 --- a/Semestr 2/racket/lista6/solution.bak +++ /dev/null @@ -1,27 +0,0 @@ -#lang racket - -(provide (struct-out complex) parse eval) - -(struct complex (re im) #:transparent) - -(define value? - complex?) - -;; Ponizej znajduje sie interpreter zwyklych wyrazen arytmetycznych. -;; Zadanie to zmodyfikowac go tak, by dzialal z liczbami zespolonymi. - -(struct const (val) #:transparent) -(struct binop (op l r) #:transparent) - -(define (op->proc op) - (match op ['+ +] ['- -] ['* *] ['/ /])) - -(define (eval e) - (match e - [(const n) n] - [(binop op l r) ((op->proc op) (eval l) (eval r))])) - -(define (parse q) - (cond [(number? q) (const q)] - [(and (list? q) (eq? (length q) 3) (symbol? (first q))) - (binop (first q) (parse (second q)) (parse (third q)))])) \ No newline at end of file -- cgit v1.2.3