From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Trying to get friends with SRFI-19 Date: Mon, 20 Jul 2020 23:27:03 +0200 Message-ID: <20200720212703.GC31180@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NKoe5XOeduwbEQHU" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16146"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jul 20 23:27:22 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxdJh-000474-Ge for guile-user@m.gmane-mx.org; Mon, 20 Jul 2020 23:27:21 +0200 Original-Received: from localhost ([::1]:45890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxdJg-0002Aq-IY for guile-user@m.gmane-mx.org; Mon, 20 Jul 2020 17:27:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxdJV-00029L-DS for guile-user@gnu.org; Mon, 20 Jul 2020 17:27:09 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:48404) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1jxdJT-0003Re-1V for guile-user@gnu.org; Mon, 20 Jul 2020 17:27:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:Content-Type:MIME-Version:Message-ID:Subject:Cc:Date; bh=VjfjIiLgGAgnRMMqvAnUxVBvsUSScWTWf0lokKxfXJY=; b=KCS36c+bJkZo3iRuHPVNFN+VPc9Cwj92wql7m+BucuERi8N1Ypyhh1HVwIbsJ66NpBx/y3JnKY/6uApd31xBqXUWD3Z+yCyLPzstZG9bnNjAimndOZzLuOUEAKHqSJ8xvcoDa43SRWswxFYtgDzm2gbJHcwGPwASWcCveYvZbtk+3Eb9uU3WhfFYq/xaG58sS28PYwI9AXwGlfLJLhU4GGuaG/spFOW6yJsTWKeEnvf+H6X4rVQI1+k/UUI5NnwQsK6kTwB3/nS5v6OfSgppPD5fTeTGa0pxvmSRViYHlS1OMXBc6CzPoLOSXhWpPdXrz5PD//8z4PDNuOIiWGN6gQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1jxdJP-0001lb-Tr for guile-user@gnu.org; Mon, 20 Jul 2020 23:27:03 +0200 Content-Disposition: inline Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/20 17:27:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MISSING_HEADERS=1.021, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16711 Archived-At: --NKoe5XOeduwbEQHU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I'm trying to parse some stuff, part of which are date strings of the form "20200106", i.e. "YYYYMMDD". Since I don't trust my input too much (or rather, my understanding of it), I'd like to get a slap when my assumptions fail. So I'd like to validate the date string. SRFI-19 seems to be my friend. After checking that everything is numeric, I try (the example is the sixth of January 2020, at noon): (make-date 0 0 0 12 06 01 2020 7200) =3D> # So far so good. But if I try a bogus date (say, instead of month 01 I pick 32): (make-date 0 0 0 12 06 32 2020 7200) =3D> # Ahem. Make-date happily accepts a month 32. This was some surprise for me :) Next I tried converting the thing to a Julian day and back. My idea was that the conversion would "normalize" the date representation, and if `equal' yields #t, we have a sensible date. This fails because after the double-conversion, the time zone offset has shifted from 7200 to 3600, and the two dates aren't equal?: (define d (make-date 0 0 0 12 06 01 2020 7200)) ; as above d =3D> (julian-day->date (date->julian-day d)) =3D> # Obviously I am barking up the wrong tree (if it's a tree at all). Is there a canonical way to validate a date string? Confused. Thanks for any hint. Cheers -- tom=C3=A1s =20 --NKoe5XOeduwbEQHU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl8WDCcACgkQBcgs9XrR2kaRdACfd48BYXDMA83+KkBBtrivSjWp Qg8An2dMxNG1ngYMLZRbUbgdLmU3CGFP =UsXt -----END PGP SIGNATURE----- --NKoe5XOeduwbEQHU--