From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tobias Brandt Newsgroups: gmane.lisp.guile.user Subject: Mixing syntax-rule and indentifier-syntax Date: Tue, 17 Jan 2012 00:11:49 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1326760099 7395 80.91.229.12 (17 Jan 2012 00:28:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 Jan 2012 00:28:19 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jan 17 01:28:16 2012 Return-path: Envelope-to: guile-user@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 1RmwuN-0004dp-IL for guile-user@m.gmane.org; Tue, 17 Jan 2012 01:28:15 +0100 Original-Received: from localhost ([::1]:38480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmwuN-00073q-1f for guile-user@m.gmane.org; Mon, 16 Jan 2012 19:28:15 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmviR-0002JG-St for guile-user@gnu.org; Mon, 16 Jan 2012 18:11:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmviR-0003x4-2Z for guile-user@gnu.org; Mon, 16 Jan 2012 18:11:51 -0500 Original-Received: from mail-tul01m020-f169.google.com ([209.85.214.169]:46771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmviQ-0003x0-UF for guile-user@gnu.org; Mon, 16 Jan 2012 18:11:51 -0500 Original-Received: by obbta7 with SMTP id ta7so2427494obb.0 for ; Mon, 16 Jan 2012 15:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=cN9h5qDuwd18p/eF1DmfpfdPe7SgFqtEOSwEf+96qno=; b=l58RDfUne/FnS2gXUOT/4pXuV206+atTh5MHxjRXXslt3UwQeZsxygrWv0IP35/u3R Mm1fk5YJCcjOLVt+0gWw7cK2k59IBXPjJK3L1+bRLGeLlFFGLw9KTT4dIqBcaJ840np1 W8pREq/NWOygW+4LoIVbm7oW4W7NIT+Btzhiw= Original-Received: by 10.182.179.70 with SMTP id de6mr12749937obc.22.1326755509971; Mon, 16 Jan 2012 15:11:49 -0800 (PST) Original-Received: by 10.60.49.197 with HTTP; Mon, 16 Jan 2012 15:11:49 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 X-Mailman-Approved-At: Mon, 16 Jan 2012 19:28:11 -0500 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9152 Archived-At: Hi, is it possible to define a macro that does one thing when it's in operator position and another when it's not? I want to define a macro `with-vectors` that transforms this: (with-vectors (v) (v 0) (set! (v 0) 'foo) (some-procedure v)) into this: (begin (vector-ref v 0) (vector-set! v 0 'foo) (some-procedure v)) So far I have this: (define-syntax with-vectors (syntax-rules () ((_ (id ...) exp ...) (let-syntax ((id* (syntax-rules () ((_ idx) (vector-ref id idx)))) ...) exp ...)))) But that obviously only works for the first case: (v 0). Regards, Tobias