Am 23.08.2013 15:16, schrieb Riccardo (Jack) Lucchetti:
On Fri, 23 Aug 2013, Sven Schreiber wrote:
>
> Here's my take at doing it in hansl (untested), but let's not forget
> that the goal is (IMHO) to make the preprocessing unnecessary
> altogether, by enabling 'join' do smaller/greater comparisons on ISO
> date strings!
I agree, it was just a matter of curiosity. And strategy, in a way:
because the fundamental question here is: would it be a good idea to
enhance hansl up to the point when you could use it to do things on text
files for which one would use tools like perl, python, awk or a bash
script (with the standard unix tools: grep, sed, join, cut etcetera)?
On one hand, this would be very cool; plus, when you write a script like
yours, dependency on python clearly reduces portability somehow (yeah, I
know...). But on the other hand, one of the strengths of hansl is (IMO)
its being tailored on the needs of the applied economist and not even
trying to be the Swiss army knife. Besides, that's precisely why we
invented the "foreign" block.
Exactly -- also, while I'm now used to the string handling in gretl, I
still think it's a bit awkward for a programming language that you can
sometimes write string literals without quotes (think about the smpl
command), and sometimes you need to quote them. So I don't think this
should be stretched too far.
IMHO, hansl is good enough to write these types of code once in a while,
especially if they're reused often and would introduce a dependency
otherwise. I wouldn't want to be constantly doing text file and string
handling in hansl though. (And the python code I posted could probably
have been shrunk quite a bit if I hadn't tried to treat it as a
full-blown csv file, but just had done the low-level string substitions
like in the hansl version.)
One wish item though, about date handling: today I missed an inverse for
the epochday() function, in order to quickly "subtract" a time span from
a date and get the resulting date.
cheers,
sven