[m-users.] file_exists? directory_exists?

Richard O'Keefe raoknz at gmail.com
Mon Jul 1 20:38:35 AEST 2019


Thanks.  I really need to write another book...
Way back when, Dave Bowen at Quintus wrote a debugging tool to tell you when
a predicate you thought was determinate wasn't.  So we ran it on our own
code.
And found bugs, of course.
If you have questions about modes and insts ask them on the mailing list.
It will be a big help, by getting the questions and answers where search
engines can find them.
I don't know if Fergus Henderson's PhD thesis might help you
understand the *point* of modes better?
https://pdfs.semanticscholar.org/d9fa/c21f57895d1d40037021c829a2df2c7b606c.pdf?_ga=2.112261900.989814282.1561975986-258283753.1542326724

I went to University, and taught at Universities for quite a while.
Let me give you an anecdote about a University I'm *not* associated with.
My father had a whole bunch of letters after his name, including law
degrees done remotely, up to LLM level.  He wanted a PhD.  He worked for
a couple of years on his thesis, sent it in, and (famous English
University) said it wasn't good enough.  He sent the thesis off to a
publisher.
He chose another topic, worked a couple of years on it, went to (famous
English
University) for six months to wrap it up, handed it in, and (famous English
University) said it wasn't good enough and gave him an MA as a consolation
prize.
He sent that thesis off to the publisher.  BOTH the rejected theses became
the
standard reference works in their respective areas.  He always said that the
examiners rejected his theses because they didn't understand them and were
ashamed to admit it.

Me, I took a paper in tertiary education, and failed.  It was in that paper
that
I heard someone say in all seriousness that there is no such thing as
truth.  It
was a senior lecturer in Nursing.  You may understand why I tremble in
today's
hospitals.  (One of my grandmothers was a nurse, and two of the nicest young
ladies I ever failed to work up the courage to ask out.  Nurses I respect.
People
who deny the existence of truth scare me.)

As someone who has worked at two Computer Science departments and given
lectures
at a couple of others, I can assure you that very very few PhD graduates
would
find Mercury any more obvious than you.  Some of them would have taught
themselves
Haskell, or perhaps F#.  Some of the rest think that lambda expressions were
invented by Brendan Eich.  To be comfortable with Mercury (or the papers
that
explain the ideas behind Mercury) it helps to have studied logic and type
theory.
I think in the last 20 years we graduated one student with a thesis in type
theory.
Mercury is solidly rooted in 1980s ideas about AI and program verification
and
such-like.

SO DON'T PUT YOURSELF DOWN.  University schmuniversity.  Learning's the
thing!



On Sun, 30 Jun 2019 at 05:03, emacstheviking <objitsu at gmail.com> wrote:

> Firstly, thanks for writing The Craft of Prolog. It sits next to all the
> others I have and I hope one day be smart enough to truly grok!
> Secondly, you are right...we are all doomed and thinking about it does
> indeed make you mad!
>
> I was aware that see/seen was about reading the file, but I considered it
> only polite to close it after opening it.  :)
>
> Right now, I am *making myself* work through the PDF getting started book
> by Ralph Becket and not diverging if i can possibly help it. The thing I
> like about Mercury the most is that having spent too many hours scratching
> my head in SWI debugger wondering why a predicate silently fails, is that
> it throws back some of the burden of responsibility to the developer to
> know ahead of time exactly what this predicate is supposed to be doing, I
> mean, after all, *we* write them so we ought to know, even if it is
> non-deterministic!
>
> The modes and inst-ness are giving me some headaches but I am sure it will
> all make sense eventually......it's harder for me at least because I didn't
> go to university so I don't have a maths or Cs degree i.e. everything that
> I've learned over the last 34 years has been self taught and I continue to
> learn daily as I am a learning junkie. Sometimes I almost think it was a
> good thing I didn't attend as I would never have left....
>
> All the best,
> Sean.
>
>
>
> On Sat, 29 Jun 2019 at 15:42, Richard O'Keefe <raoknz at gmail.com> wrote:
>
>> Using see + seen does not test whether a file *exists* but whether
>> a file exists *and you are allowed to read it*.
>>
>> It has always been the case in Unix that the only way to determine
>> if a file exists and you are allowed to read it is to try to open it
>> for input, thanks to the existence of concurrent processes.
>>
>> With NFS, you can successfully open a file for input and
>> then be told "you can't do that" when you try to read it.
>>
>> And then there's the possibility that a file might exist
>> and you might be allowed to read it, but the name you
>> have for it goes through a directory you aren't allowed
>> to search.
>>
>> It you think too deeply about all the things that can go
>> wrong with testing whether a file "exists" you will go
>> mad. MAD, I say!  We're all DOOMED!
>>
>>
>> On Sat, 29 Jun 2019 at 19:03, emacstheviking <objitsu at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> All I have found is see/seen to see if a file exists. Have I missed
>>> something totally obvious ?
>>> And how about checking the existence of a directory too?
>>>
>>> It feels bad to have to use "see" and then "seen" (to undo see) just to
>>> test a file exists.
>>>
>>> I am sure I have not found the docs but TBH they doc are just the code
>>> for the module and when you are learning this stuff it makes it pretty hard
>>> to find anything at times.
>>>
>>> Thanks,
>>> Sean.
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.mercurylang.org
>>> https://lists.mercurylang.org/listinfo/users
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20190701/649928eb/attachment.html>


More information about the users mailing list