On Friday, December 11, 2015 at 4:15:13 AM UTC-8, Jay McCarthy wrote: > Hi David, > > You can return nothing with (values). The function "values" returns > any number of values... (values 1 2 3) returns 3 values, (values 1) > returns 1 value, and (values) returns 0 values. > > Jay
Hi Jay, I actually tried that in my foo-2 function: (define (foo-2 x) (if (eq? x "foo") #t (values))) That's the one that led to the arrity contract failure. (And I just realized that I should have named them foo1 and foo2 because it looks like I named it "foo minus 2". Oh well.) --------------- Matthew Butterick wrote: > Answer: Yes, if you redefine nothingness. You can exploit the fact that > appending (or splicing) an empty list will cause it to disappear (meaning, no > #<void> residue). > #lang racket > (require rackunit) > (define (foo-3 x) (if (eq? x "foo") (list #t) empty)) > (check-equal? (append-map foo-3 '(a b "foo" "bar")) '(#t)) That was exactly what I wanted! Thank you very much. Also, I hadn't yet discovered "append-map", so that's another thank you. -- 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.

