From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.devel Subject: Re: can't use variable in sxml-match? Date: Fri, 20 May 2011 04:55:20 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1305863359 24287 80.91.229.12 (20 May 2011 03:49:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 May 2011 03:49:19 +0000 (UTC) Cc: guile-devel@gnu.org To: nalaginrut@gmail.com Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri May 20 05:49:15 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QNGiB-0005kO-LR for guile-devel@m.gmane.org; Fri, 20 May 2011 05:49:15 +0200 Original-Received: from localhost ([::1]:41070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNGiA-0002qS-HN for guile-devel@m.gmane.org; Thu, 19 May 2011 23:49:14 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNGi8-0002qM-BX for guile-devel@gnu.org; Thu, 19 May 2011 23:49:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNGi7-00022u-LO for guile-devel@gnu.org; Thu, 19 May 2011 23:49:12 -0400 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:59301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNGi7-00022o-F4 for guile-devel@gnu.org; Thu, 19 May 2011 23:49:11 -0400 Original-Received: by wwb39 with SMTP id 39so2983314wwb.30 for ; Thu, 19 May 2011 20:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:date:message-id :user-agent:mime-version:content-type; bh=hSh3PzU8rvYRMyJsRZpTwaxedXEtPp/GeNGuPF6O/S4=; b=od90vVsdlKoaN0w+XtUrmK3QhOJOSy9FrI9l+k7wT6dMyS/kHzLn6D2/bISpNcoXkD 1vwwFyBwW3slpXq0KlLRlcc3bTPE+Gv4m4yKquj1B7G++tAQNM7AL5tpRxFzpcZT8D29 dma6VoulNpJCa9ZiD8n/ezUpY8Z7pUoAN6IHA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:in-reply-to:date:message-id:user-agent :mime-version:content-type; b=gl2Tu5Epc2s2q7fAEwtNMhVmjmMbMLKUoNyDNTLm+lEuKvlR/ScfBukYnBCdFC/ovP ynBbbwDPO8DaNfhMYf9n+j+HP7ARkugLsTVsKbaIBkwveITlga0uRecR+Znqi+ja8DVP QbLzqcxiT9kaGw7XfGzectBpVTdL6eoe8m8aA= Original-Received: by 10.216.230.215 with SMTP id j65mr3519569weq.24.1305863349831; Thu, 19 May 2011 20:49:09 -0700 (PDT) Original-Received: from Kagami (host86-163-221-44.range86-163.btcentralplus.com [86.163.221.44]) by mx.google.com with ESMTPS id c43sm1604076weo.18.2011.05.19.20.49.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 May 2011 20:49:08 -0700 (PDT) In-Reply-To: 1305858408.1981.26.camel@Renee-desktop User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.49 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12507 Archived-At: Hi guilers, Just a note to say that we found a solution to nalaginrut's problem on IRC. (lambda (mypattern) ;; Instead of testing the head of the pattern in the sxml-match, I ;; have moved it out to here. (let* ((new-tag (if (equal? mypattern (car cl)) 'success 'fail)) ;; replace the head with 'success or 'fail depending on a match (new-expr (cons new-tag (cdr cl)))) (sxml-match new-expr ;; here we test against the new head [(success (@ (type ,tv)) ,cv) ...] [,otherwise #f]))) Another suggestion was to use syntax-rules to create the match pattern at expand time. If anyone else has a better solution, feel free to pipe up. :) Ian