Arc Forumnew | comments | leaders | submitlogin
Safe-load-table: optional argument to return #f instead?
2 points by idoh 5509 days ago | 2 comments
I've found myself wanting to do something like:

  (aif (safe-load-table (+ userdir* u))
       (...do something with it)
       (prn "user not found")) 
But if safe-load-table fails, it returns an empty hash, which is considered as true for the purpose of if. Is it a good idea to have an optional argument to safe-load-table that would cause it to return #f instead?


3 points by conanite 5508 days ago | link

You could call

  (errsafe:load-table filename)
which is the half of 'safe-load-table that returns nil

-----

1 point by idoh 5508 days ago | link

Thanks!

-----