[q-lang-users] This feels like a dumb question, but...
Brought to you by:
agraef
From: Andrew B. <and...@ya...> - 2006-11-24 04:01:42
|
...I'd sure appreciate a bit of help. I'm trying to write some file test functions, like the -f and -d functions in perl or shell scripts. Here is what I have so far: -f F = true if (close (open F 0 0)) = (); = false otherwise; Which when run gives me: ==> -f "fetch.q" true ==> -f "fetch.qaz" ! Error in conditional 0> fetch.q, line 11: -f "fetch.qaz" ==> true if close (open "fetch.qaz" 0 0)=() As I understand this, it meains that the "if" got something other than true/false. It seems like I could write another function (or maybe use a lambda) to include a "catch" clause, but this seems like such a simple thing, so I have the feeling that I am missing something fundamental. I understand that when the file does not exist, the "(close (open F 0 0))" part does not reduce, but why does "= ()" part not look at "close (open "fetch.qaz" 0 0)" and say, "nope, not equal"? "eq" does the same thing. Is there something that will force the equality check to happen? -andrew |