Am Mittwoch, 14. Januar 2015 09:42 CET, Urs Liska <address@hidden> schrieb:
Yes, I made some surprising progress with Scheme recently. I didn't even
get stuck in the ands and parens in the actual predicate I wrote
#(define (annotation? obj)
(and
(and (list? obj)
(every pair? obj))
(and (if (assoc-ref obj "type") #t #f)
(if (assoc-ref obj "location") #t #f))))
Proper indentation helps ;-)
But why so contrived? Your code is equivalent to:
#(define (annotation? obj)
(and
(list? obj)
(every pair? obj)
(if (assoc-ref obj "type") #t #f)
(if (assoc-ref obj "location") #t #f)))
HTH Ralf Mattes