From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Vong Newsgroups: gmane.lisp.guile.user Subject: Re: conditional code segments Date: Sat, 02 Jun 2018 09:11:45 +0800 Message-ID: <87k1rirnzi.fsf@gmail.com> References: <78397a0b-139c-de1a-2cbf-2458088e1952@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1527901840 7437 195.159.176.226 (2 Jun 2018 01:10:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 2 Jun 2018 01:10:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jun 02 03:10:36 2018 Return-path: Envelope-to: guile-user@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 1fOv3x-0001nh-NM for guile-user@m.gmane.org; Sat, 02 Jun 2018 03:10:33 +0200 Original-Received: from localhost ([::1]:57991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOv63-0004ii-54 for guile-user@m.gmane.org; Fri, 01 Jun 2018 21:12:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOv5f-0004ic-Od for guile-user@gnu.org; Fri, 01 Jun 2018 21:12:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOv5b-0005mC-OZ for guile-user@gnu.org; Fri, 01 Jun 2018 21:12:19 -0400 Original-Received: from mail-pl0-x22b.google.com ([2607:f8b0:400e:c01::22b]:41272) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOv5b-0005lW-HF for guile-user@gnu.org; Fri, 01 Jun 2018 21:12:15 -0400 Original-Received: by mail-pl0-x22b.google.com with SMTP id az12-v6so16244330plb.8 for ; Fri, 01 Jun 2018 18:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Ch+zCj5i3SgQj4h1hO5ZguQeVxYyO1c7Ft1iW8ZLIOM=; b=dNo+PTv4xt/bzVkpbWFQlB5/FAJbx0Ed9sv0Kly4WzmbS/fJ+l2oqY0Hh7JrOpHGTA gctDZzbJbGHvmJydbC8ayEyHe+pHdtHGxFxLfilYYgUk2a6bS+edyaPar8z0x07ESGbd BvtMnS68YrFRTF8oxvCC3hSEuef/Q+QaQRqbh4dh7WeDK1O4QALc0si311ltlgloe9VK 9Ddw0UO8DIfV7bH/xXOJydtJ6trZu6BK1sKNUcnfrQKv6lRJXY5Ox5cIh8kqA/rNqv5I ldPmGv82UYWn0rQhowao2tbTYcdKwxOb2VaKSnzOeOBh2cNxufybQA/hyHwlP/i6H1s2 Mbfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Ch+zCj5i3SgQj4h1hO5ZguQeVxYyO1c7Ft1iW8ZLIOM=; b=TT6SGZRfqFZTDL51HiBUCcl0eW9xg9uLCle9ymDRggKxLYlf+UWFqsGnI3qYf2qlhI xsy9ua34W7bOBwmgOO+HcR8HZEpuIihHbnK01JUuTyi00GL6L6zcTEK8rbi6WV5KcCkE TxJyzer/a8DTi94Ay0lsRDa0bFqkm0M+Qn8ueGaFpIO82dhVtpIt5dpWehTnS9evOViX 0qbtCN6LIMz27OWkz91anRQiVWyrOcpJHRqqp88QUd3RI1FG3KDXauvvvW7mdSAvy+Kq o6qH+3tIIyrOPBOZNnUUuBKrd3dKfmd3juERSNSldHOd4Wk0pJe5bNs/cUrtddmmcZYl HF/A== X-Gm-Message-State: ALKqPwcrb0SawwIk0sATJf90Lv+lod78QG6lGbnhN5uXzgHitLYptmtA RugQd83eyR7JFzgN+ar2riA= X-Google-Smtp-Source: ADUXVKIShlCB6utHjcGnrfa2qYS91+vl8OnIabaTh1E9lWNRz3cso8T29DINkhZIF5M5oAqkxmUNIg== X-Received: by 2002:a17:902:224:: with SMTP id 33-v6mr12968726plc.309.1527901934596; Fri, 01 Jun 2018 18:12:14 -0700 (PDT) Original-Received: from debian (n11649209176.netvigator.com. [116.49.209.176]) by smtp.gmail.com with ESMTPSA id x8-v6sm79685137pfa.173.2018.06.01.18.12.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 18:12:13 -0700 (PDT) In-Reply-To: <78397a0b-139c-de1a-2cbf-2458088e1952@gmail.com> (Matt Wette's message of "Fri, 1 Jun 2018 16:37:10 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22b X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.lisp.guile.user:14597 Archived-At: --=-=-= Content-Type: text/plain Matt Wette writes: > In C I can use `#ifdef' .. `#endif' to "comment out" code segments. > > In Scheme, one can use `#|' and '|#' which is OK but requires dealing with both ends of the > segment to switch on / off. And emacs (v 24.5) scheme mode does not always fontify the buffer > correctly with #|...|#. > > I can use (if #f (begin ....)) but it's not pretty and indents 4 spaces (or an ugly 1 space). > > I tried using cond-expand but it does not work as expected: > scheme@(guile-user)> (cond-expand-provide (current-module) '(abc)) > $1 = (abc) > scheme@(guile-user)> (cond-expand (abc #t)) > While compiling expression: > Syntax error: > unknown file:2:0: cond-expand: unfulfilled cond-expand in form (cond-expand (abc #t)) > > My current attempt is to add this: > > (define-syntax-rule (if-true form ...) (begin form ...)) > (define-syntax-rule (if-false form ...) (begin)) > > (if-false > (define x ...) > ... > ) > > (if-true > (define x ...) > ... > ) > > Any other solutions / suggestions? Maybe you can try to use #; to comment out s-exp? I prefer this way because it feels very lispy to me. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQTdXC2pN4kXBjiMDs8cGaIXrbrArQUCWxHu0wAKCRAcGaIXrbrA rRm5AQCK1JBmkJv4y/H3sKg8SI1P2fLBMMonbRX6bZ4USp1h4QD/ftY+6bqugDUh yENPoxnEvmnlyV3hInVtUg+w5UQA3AQ= =vqc+ -----END PGP SIGNATURE----- --=-=-=--