CommonLisp Scheme Part12
■ このスレッドは過去ログ倉庫に格納されています
0073デフォルトの名無しさん
NGNG(define operator-prec-alist
'((* 20)
(/ 20)
(+ 10)
(- 10)))
(cadr (assq '+ operator-prec-alist))
(define (compare-operators-by-precedence comp op1 op2)
(comp
(cadr (assq op1 operator-prec-alist))
(cadr (assq op2 operator-prec-alist))))
(define (parse exp)
(cond
((not (list? exp)) exp)
((= (length exp) 1) (car exp))
(else
(parse-op (parse (list-ref exp 0))
(cdr exp)))))
■ このスレッドは過去ログ倉庫に格納されています