I have a function that can return either false or a node. I have to check four
permutations:
both nodes false,
left node false,
right node valid, left node false
both node valid
I am doing it using cond like this:
(define (lines t)
(cond [(and (false? (node-l t)) (false? (node-r t))) <<do no children
thing>>] ;; if no children
[(and (false? (node-l t)) (not (node-r t))) <<left child only>>] ;;
if left child only
[(and (node-l t) (false? (node-r t))) <<right child only>> ] ;; if
right child only
[else <<both children>> ])) ;; if both children
the first cond line using and and false? works ok and the last cond line using
else works ok. But how do I check for the middle two occurrences?
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.