Open tueda opened 6 years ago
Sounds like a good idea
Jos
On 23 Nov 2017, at 12:05, Takahiro Ueda notifications@github.com wrote:
It would be nice to have a functionality to check if a file exists in the path. One possibility of the syntax is
if fileexists(foo.h)
endif
The implementation should be easy, just opening and then closing the file. In this syntax, file names with ( and ) can't be handled properly, but I think this is the FORM way to discourage such crazy file names. Introducing some escapes for special characters in file names would be also easy.
There will be many way to use this file check. I'm considering usage as follows. Suppose I make a some library that have some table files. Table files can be in ASCII, which is the most portable way. But it will be faster if I use binary files (tablebase or *.sav storing expressions). Unfortunately they are most likely version-dependent. So I don't like to put the binary file in the library. Instead, I would prepare a way such that one can make them with his/her version of FORM. The library first tries to load a binary table and when impossible reads the corresponding ASCII table as a fallback. This is the way used in a Mathematica package MT https://arxiv.org/abs/1307.6925.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/240, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEvZ2P74Fg_KRFI50tNHk0j9VRILsks5s5VF7gaJpZM4QolMC.
It would be nice to have a functionality to check if a file exists in the path. One possibility of the syntax is
The implementation should be easy, just opening and then closing the file. In this syntax, file names with
(
and)
can't be handled properly, but I think this is the FORM way to discourage such crazy file names. Introducing some escapes for special characters in file names would be also easy.There will be many way to use this file check. I'm considering usage as follows. Suppose I make a some library that have some table files. Table files can be in ASCII, which is the most portable way. But it will be faster if I use binary files (tablebase or *.sav storing expressions). Unfortunately they are most likely version-dependent. So I don't like to put the binary file in the library. Instead, I would prepare a way such that one can
make
them with his/her version of FORM. The library first tries to load a binary table and when impossible reads the corresponding ASCII table as a fallback. This is the way used in a Mathematica package MT.