[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shorter and more flexible implementation for parse-time.el
From: |
Lars Ingebrigtsen |
Subject: |
Re: Shorter and more flexible implementation for parse-time.el |
Date: |
Sun, 25 Jul 2021 08:34:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
"Guu, Jin-Cheng" <jcguu95@gmail.com> writes:
> Thanks for your response! I've done some research, and the formats I
> have seen all have their rigid formats (with a fixed length in
> particular) [1][2][3]. Would you mind pointing me to some exceptions?
> I can try to accommodate.
There's a million formats out there, like "3-NOV-94" etc in various
permutations.
> That said, I'd argue it is still useful. It is much shorter, is
> flexible and customizable, and uses lisp sexprs instead of a
> DSL. Please feel free to let me know what it lacks of, I will try to
> work on it and present a final result. =)
My experience is that there is no DSL that can cover date parsing that's
handier than just writing some code, unfortunately. Your library covers
the
(encode-time
(mapcar (lambda (bit)
(if bit
(string-to-number bit)
0))
(list nil nil nil (substring string 0 2)
(substring string 2 4)
(substring string 4 8))))
etc case, and that's not where the hard thing in date parsing is.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no