(define KW_GetWidgetChildren (foreign-lambda c-pointer "KW_GetWidgetChildren" KW_Widget* int*)) (define (widget-children widget) (and-let* ((widget* (widget-pointer widget))) (let-location ((count int 0)) (let ((children* (KW_GetWidgetChildren widget* (location count)))) (if (zero? count) '() (let loop ((i 0) (children '())) (if (< i count) (let* ((child* ((foreign-lambda* KW_Widget* ((c-pointer p) (int i)) "KW_Widget * const * ps = p; C_return((ps)[i]);") children* i)) (child (hash-table-ref widget-table child*))) (loop (add1 i) (cons child children))) children)))))))