From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: Guile-Lib 0.2.5 released Date: Thu, 19 Jan 2017 05:53:56 -0800 Message-ID: <11237BBA-B55F-4946-98FA-D2088BC3DDAF@gmail.com> References: <20161114055359.269a5acc@capac> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1484834148 16095 195.159.176.226 (19 Jan 2017 13:55:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2017 13:55:48 +0000 (UTC) Cc: guile-user@gnu.org, guile-devel To: David Pirotte Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jan 19 14:55:42 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUDBb-0002r2-5k for guile-devel@m.gmane.org; Thu, 19 Jan 2017 14:55:31 +0100 Original-Received: from localhost ([::1]:48187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUDBg-0005p7-56 for guile-devel@m.gmane.org; Thu, 19 Jan 2017 08:55:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUDAK-000563-N9 for guile-devel@gnu.org; Thu, 19 Jan 2017 08:54:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUDAJ-0005jT-GU for guile-devel@gnu.org; Thu, 19 Jan 2017 08:54:12 -0500 Original-Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:32843) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUDAA-0005bZ-R0; Thu, 19 Jan 2017 08:54:02 -0500 Original-Received: by mail-pg0-x241.google.com with SMTP id 194so4275576pgd.0; Thu, 19 Jan 2017 05:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IUXduvTZW50EULQSA+CzKwL1yC/e0kthESlhPaF//D8=; b=ZfwTAM+wSquGWb1IIhtT4PUEsF+pxta5o5snEa0RDs1w7KMCLMM4VDnHUb10JqTRhx AqD4nthcRkiC+veocBICiPR8fH4+S/11STHn6oK6r9VHTIgUUBmhAaHbe9/a0QJBmXZS cHISgO7v+C759axztD/w0z8ZjLONGF9kokdAQgdnoxNJzFw3kt3PCvDO11mqIcXMPp09 Vbge3phFFEWRdDRFZlbIw2KZzYtwHQ3beOrirhZ8TCyD+IfW4CyjdYQ43Oa/adCyXa0b 9LifOJB1bxYOqZWJHsBV9WcSZoasPqkU26f0wcgTg9C8DCeLSn7+Hh9fH3uyjmJ1lyRE X9aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IUXduvTZW50EULQSA+CzKwL1yC/e0kthESlhPaF//D8=; b=sI7NxchOmBPVVTy2y47ldwuR2RlMR/EE2uuVc2fhtin2617jpIWzAak5X562zxhFiy +YV19w9VR27R6Tk6C0qC39secPiPmY3gxPy2/WJ6+/2kk/xWL5zuSuPxDsJnVvC2airL kFgiT0jvKNtUkXkuVUqBGcfZnL2MEgJbDUic0Twz+hUaUBlr9gwFouCUcjCq0f03uCTO 0GJBXWV3K3ISCxon/q6y1pV4WGS+OqfSrE+ZSCrSjYlVwAPoe7Pk18XtZ72Um1gQe0Gr 0jhJV0bU/TPIVmg8ww8S9tUIUwMXHKiqP/T+/l5/R/HfGWg3HtIeeKzUi3yMHXh+4k+d vVLA== X-Gm-Message-State: AIkVDXKhVW+mmlqLb/Jv/fejqwKWcrsRYPuyOqmymej8bIRCUC/QW3ULz5ObqZW/vTMJ3Q== X-Received: by 10.98.158.89 with SMTP id s86mr10012001pfd.33.1484834039741; Thu, 19 Jan 2017 05:53:59 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-246-244.championbroadband.com. [216.165.246.244]) by smtp.gmail.com with ESMTPSA id g64sm9176497pfc.57.2017.01.19.05.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 05:53:58 -0800 (PST) X-Priority: 1 (Highest) In-Reply-To: <20161114055359.269a5acc@capac> X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::241 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:18861 gmane.lisp.guile.user:13112 Archived-At: > On Jan 18, 2017, at 12:46 PM, David Pirotte wrote: >=20 > Hello, >=20 > We are pleased to announce Guile-Lib 0.2.5. This is a maintenance = release, the next > maintenance release for the 0.2 series. >=20 >=20 > * Guile-Lib Homepage:=20 >=20 > http://www.nongnu.org/guile-lib/ >=20 If you are willing to accept contributions, maybe add logistics for that = to the home page. I have a couple I would like to add. See below. =E2=80= =94 Matt Here are a couple I could contribute, if you are interested: 1.1 Struct Module =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The '(struct)' module provides procedures for packing and unpacking scheme data to and from bytevectors based on a format string. (use-modules (struct)) ;; pack two unsigned shorts and a double float in big endian order (define data (pack ">2Hd" 3 22 34.0)) (write data) (newline) =3D=3D> #vu8(0 3 0 22 64 65 0 0 0 0 0 0) ;; verify using unpack (write (unpack ">2Hd" data)) (newline) =3D=3D> (3 22 34.0) -- Scheme Procedure: pack format vals ... Return a bytevector that contains encoded data from VALS, based on the string FORMAT. -- Scheme Procedure: unpack format bvec Return a list of scheme objects decoded from the bytevector BVEC, based on the string FORMAT. -- Scheme Procedure: packed-size format Return the number of bytes represented by the string FORMAT. The _format_ string used for PACK and UNPACK is constructed as a sequence of digits, representing a repeat count, and codes, representing the binary content. The string may optionally begin with a special character that represents the endianness: =3D native endianness < little-endian > big-endian ! network order -- i.e., big-endian Type codes used in the format string are interpreted as follows: x blank byte c 8-bit character ? boolean b signed 8-bit integer B unsigned 8-bit integer h signed 16-bit integer H unsigned 16-bit integer i signed 32-bit integer I unsigned 32-bit integer l signed 32-bit integer L unsigned 32-bit integer q signed 64-bit integer Q unsigned 64-bit integer f 32-bit IEEE floating point d 64-bit IEEE floating point s string The following issues remain to be addressed: string padding 'pack' assumes that the string length in the format is the same as in the passed string. Non-conformance is not trapped as an error. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D Regexp Utilities ---------------- -- Scheme Procedure: regexp-case str case ... [else body] Match the string STR against each CASE in turn. Each CASE is of the form ((pat VAR1 VAR2 ...) body) where pat is a regular expression string literal, VAR1 ... are bound to the ordered list of matched subexpressions, and BODY is a sequence of expressions. If no match is found and the optional ELSE case exists, the associated body is executed, otherwise an error is signaled. The following example matches a string aginst either a simple variable name, or a simple variable name with an array reference, and returns a list with the variable name and the string index, or '"1"'. If no match is found, '#f' is returned. (define str "foo") (regexp-case str (("^([a-z]+)\\(([0-9]+)\\)$" var idx) (list var idx)) (("^([a-z]+)$" var) (list var "1")) (else #f)) =3D=3D> ("foo" "1") -- Scheme Procedure: make-string-matcher (str ...) case ... [else body] This is similar to 'regexp-case' but generates a procedure '(lambda (str ...) ...)' that matches its string argument STR againt each CASE in turn. (define my-matcher (make-string-matcher (str a b c) (("^([a-z]+)\\(([0-9]+)\\)$" var idx) (list var idx)) (("^([a-z]+)$" var) (list var "1")) (else #f))