unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Alex Vong <alexvong1995@gmail.com>
To: Matt Wette <matt.wette@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: conditional code segments
Date: Sat, 02 Jun 2018 09:11:45 +0800	[thread overview]
Message-ID: <87k1rirnzi.fsf@gmail.com> (raw)
In-Reply-To: <78397a0b-139c-de1a-2cbf-2458088e1952@gmail.com> (Matt Wette's message of "Fri, 1 Jun 2018 16:37:10 -0700")

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Matt Wette <matt.wette@gmail.com> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2018-06-02  1:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 23:37 conditional code segments Matt Wette
2018-06-02  1:11 ` Alex Vong [this message]
2018-06-02  1:56 ` Mark H Weaver
2018-06-02  2:34   ` Matt Wette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1rirnzi.fsf@gmail.com \
    --to=alexvong1995@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=matt.wette@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).