Hello, Using 'file-select' as a sub-second sleep procedure works without hitch under csi:
(define (sleeper tm) (let ((currms (current-milliseconds))) (let-values (((_ __) (file-select #f #f tm))) (print (- (current-milliseconds) currms))))) ;1> (sleeper 0.05) 50.0 However, compiling with csc produces several warnings: Warning: in local procedure `find-err', in local unknown procedure, in toplevel unknown procedure: (compose.scm:260) in procedure call to `file-select', expected argument #1 of type `(list-of fixnum)', but was given an argument of type `boolean' Warning: in local procedure `find-err', in local unknown procedure, in toplevel unknown procedure: (compose.scm:260) in procedure call to `file-select', expected argument #2 of type `(list-of fixnum)', but was given an argument of type `boolean' Warning: in local procedure `find-err', in local unknown procedure, in toplevel unknown procedure: (compose.scm:260) in procedure call to `file-select', expected argument #3 of type `fixnum', but was given an argument of type `float' In types.db, we have: (file-select (#(procedure #:clean #:enforce) file-select ((list-of fixnum) (list-of fixnum) #!optional fixnum) * *)) Based on the description of 'file-select' in the manual, and performance in csi, it seeems it would be more accurate to declare: (file-select (#(procedure #:clean #:enforce) file-select ((or boolean (list-of fixnum)) (or boolean (list-of fixnum)) #!optional (or fixnum float) (or boolean (list-of fixnum)) (or boolean (list-of fixnum))))) Of course, having a "real" usleep function would be cleaner than faking it with file-select, especially as implementing a usleep procedure is pretty trivial: (define usleep (foreign-lambda int "usleep" unsigned-integer32)) Maybe it wouldn't be too much trouble to add it to the posix (or some other) module. Thanks, J. Altfas
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users