Yes, this is correct. But it is not a problem for Typed Racket, which was designed to accommodate precisely this style of programming:
#lang typed/racket (define-type [Option P] (U P False)) (define-type SPath String) (: file-exists-> (-> SPath [Option SPath])) (define (file-exists-> name) (and (file-exists? name) name)) (: get-glue-library (-> [Option SPath])) (define (get-glue-library) (or (getenv "GLUELIB") (file-exists-> "racket/lists"))) It's just convention. Here is where you can help: ====>>> Design the functions that you want and compile a package that exports them all. Soon we will all be programming with your package and it will make it into the core. -- Matthias On Nov 9, 2015, at 3:39 PM, JCG <griffin...@gmail.com> wrote: > Perhaps this would be a hassle for Typed-Racket maintainers, but there are > many places where standard Racket library functions return boolean. However, > given the non-false nature of almost everything, certainly the code could be > doubly useful and half the size while retaining boolean compatibility. > > What reminded me of this was some code today: > > (define (get-glue-library) > > (or (getenv "GLUELIB") > > (let ((name "/tmp/somepath.so")) > > (and (file-exists? name) > > name)))) > > > If the file-exists? code were to return its file, then it would be > > (define (get-glue-library) > > (or (getenv "GLUELIB") > > (file-exists? "/tmp/somepath.so"))) > > > Then of course the ? suffix might seem less appropriate. > > This is not a request for change, just an observation at how redundant my > effort was to have to save the name of a file (to avoid typos) and to call > two functions. At least I do not have to > > ((let ((name "GLUELIB")) > > (and (getenv? name) > > (getenv name))) > > > > If I am missing some way to be more succinct while using the standard library > calls, I would be appreciative of guidance. > > Thanks, > JG > > -- > 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 racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.