From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: stefan Newsgroups: gmane.lisp.guile.devel Subject: srfe records in reworked match Date: Tue, 20 Apr 2010 15:14:18 +0200 Message-ID: <201004201514.18375.stefan.tampe@spray.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1271771859 22571 80.91.229.12 (20 Apr 2010 13:57:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Apr 2010 13:57:39 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Apr 20 15:57:38 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O4DxI-0001fN-A5 for guile-devel@m.gmane.org; Tue, 20 Apr 2010 15:57:36 +0200 Original-Received: from localhost ([127.0.0.1]:47243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4DxH-0007zv-OG for guile-devel@m.gmane.org; Tue, 20 Apr 2010 09:57:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4Dt4-00062m-Gy for guile-devel@gnu.org; Tue, 20 Apr 2010 09:53:14 -0400 Original-Received: from [140.186.70.92] (port=55862 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4Dt3-000626-8S for guile-devel@gnu.org; Tue, 20 Apr 2010 09:53:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Dt2-0007gG-23 for guile-devel@gnu.org; Tue, 20 Apr 2010 09:53:13 -0400 Original-Received: from spsmtp02oc.mail2world.com ([74.202.142.198]:3475) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Dt1-0007fP-Ra for guile-devel@gnu.org; Tue, 20 Apr 2010 09:53:12 -0400 Original-Received: from mail pickup service by spsmtp02oc.mail2world.com with Microsoft SMTPSVC; Tue, 20 Apr 2010 06:53:09 -0700 auth-sender: stefan.tampe@spray.se Original-Received: from 82.182.254.46 unverified ([82.182.254.46]) by spsmtp02oc.mail2world.com with Mail2World SMTP Server; Tue, 20 Apr 2010 06:53:08 -0700 User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; ) X-OriginalArrivalTime: 20 Apr 2010 13:53:09.0428 (UTC) FILETIME=[CF7A1F40:01CAE090] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10271 Archived-At: Ok, I have started to code in some record recognition into the match construct I need first to make sure that I grok the intention of the syntax! Now, one can do ... * (define rtf (make-record-type "n" '(x y z))) * (define make-n (record-constructor rtf)) * (define v (make-n 1 2 3)) * (define g (record-accessor rtf 'x)) * (define s (record-modifier rtf 'x)) * (match v ((= g 1) 'yes)) ;; This is the old behavior yes ;; = allow for a getter and setter argument so that we can do ... * (match v ((= (g s) (and (set! x.set) * (get! x.get) * 1)) * (begin (x.set 2) * (x.get)))) 2 ;;Now the $ syntax work, although a lot of unpacking of accessors and modifiers ;;are done dynamically and not at compile time. * (match v (($ rtf x 2 3) x)) 2 * (match v ( ($ rtf * x * (and (set! y.set) * (get! y.get)) * 3) * (begin (y.set 4) * (+ x (y.get))))) 6 It's recursive. Not solid yet though, need to make sure that variables can be extracted correctly from $ and = /Stefan