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: unified field theory! Date: Sun, 23 May 2010 16:52:42 +0200 Message-ID: <201005231652.42280.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 1274628714 21493 80.91.229.12 (23 May 2010 15:31:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 23 May 2010 15:31:54 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun May 23 17:31:40 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 1OGD9N-000415-UR for guile-devel@m.gmane.org; Sun, 23 May 2010 17:31:38 +0200 Original-Received: from localhost ([127.0.0.1]:57740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGD9N-0002Nz-Da for guile-devel@m.gmane.org; Sun, 23 May 2010 11:31:37 -0400 Original-Received: from [140.186.70.92] (port=38727 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGD9G-0002Nt-Ox for guile-devel@gnu.org; Sun, 23 May 2010 11:31:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGD9F-0007bL-SS for guile-devel@gnu.org; Sun, 23 May 2010 11:31:30 -0400 Original-Received: from spsmtp02oc.mail2world.com ([74.202.142.198]:2485) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGD9F-0007b5-M6 for guile-devel@gnu.org; Sun, 23 May 2010 11:31:29 -0400 Original-Received: from mail pickup service by spsmtp02oc.mail2world.com with Microsoft SMTPSVC; Sun, 23 May 2010 08:31:27 -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; Sun, 23 May 2010 08:31:27 -0700 User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; ) X-OriginalArrivalTime: 23 May 2010 15:31:27.0607 (UTC) FILETIME=[02B29070:01CAFA8D] 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:10351 Archived-At: Hi, I) I did introduce prompts to the example unify code, and the comparison resulted in no-prompt : 37ms gp-prompt : 35ms guile-prompts : 49ms I think using guile prompts are acceptable here. But they are on the expensive side, especially in the light that unwinding should not put a significan mark on the timings. II) unify variables and fluid variables are close in nature. So it would be cool to understand the difference better. i will dive in on that. III) One cool thing is to abstract out matchers. As a result you get a little tool to create top down parsers. here we go, consider (udef (((? integer? X) . L) (cons X L) (L (cons #f L)))) A matcher for an integer! the output of a matcher has to be of the from (cons Val Rest). when Val equals #f it sends the signal of a failure. (perhaps use (values Val Rest) instead) now we can use this as (udef f (( 'a 'b) 'ok)) and (f '(1 2 a b)) will match to 'ok But it's really nice to have arguments to the matcher so consider (udef <...> ((F ( (<> F) (<...> F) ) (cons (cons F.0 <...>.0) <...>...)) (F L (cons '() L)))) F.0 is the value of the (<> F) match. F... is the rest of the same match and so on. Now <...> is a gready matcher that has one argument F that itself is a matcher and now we can use it accordingly. if a symbol looks like then it's a matcher abstraction. (<> F) is used when the matcher has a name not of that form. (udef f (( (<...> ) . L) L)) and (f '(1 23 4 a b)) gives '(a b) Have fun, Stefan