You cannot - you must have a way to test things and act, whether they are true or false. You can get closer, albeit with some functional representation of the logic elements. For example, with a common church encoding:
(define (true xy) x) (define (false xy) y)
and now you can consider the test (which returns one of these encoded logic gates) as a function that accepts a “successful” continuation and a “failure”, and uses this to continue:
(define (if cxy) (cxy))
If you want to experiment with this, you need to consider the fact that Scheme is not a lazy language, so you need to do something. For instance:
(define (true xy) (x)) (define (false xy) (y)) (define-syntax if [(if cxy) (c (lambda () x) (lambda () y))])
(But you still need to reconsider existing predicates, etc., to return these Booleans.)
In any case, call/cc alone doesn't do anything suitable ...
source share