unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: Christopher Allan Webber <cwebber@dustycloud.org>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: ?-suffix for booleans... good-idea? or bad-idea?
Date: Thu, 27 Apr 2017 12:39:42 +0200	[thread overview]
Message-ID: <87a872xhg1.fsf@gnu.org> (raw)
In-Reply-To: <878tmpoi3x.fsf@dustycloud.org> (Christopher Allan Webber's message of "Mon, 24 Apr 2017 12:01:06 -0500")

Christopher Allan Webber writes:

> I've noticed that it's common in Guile modules to use "foo?" for
> variable names involving booleans.  It's tempting,

> But is it a good idea?

It's an idea that I like and use.  Not sure that says anything about
good or bad.

I would like to help you paint though!

We have functions like null? and pair? that return booleans, where I
would like the [non]-nil value.  I often find myself writing things like

   (let ((bar (if (pair? foo) (baz foo)
               #f)))
   
where I would rather like to write something like

   (let ((bar (and=> (pair?=> foo) baz)))

How do you do these things, and how do you call your pair?=> function?

Greetings, --janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  



  parent reply	other threads:[~2017-04-27 10:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 17:01 ?-suffix for booleans... good-idea? or bad-idea? Christopher Allan Webber
2017-04-25  3:43 ` Alex Vong
2017-04-25 15:50   ` Jan Wedekind
2017-04-25 16:21     ` Paul
2017-04-26 15:25       ` Alex Kost
2017-04-25 18:08   ` Neil Jerram
2017-04-25 16:53 ` Panicz Maciej Godek
2017-04-26  0:23 ` Thompson, David
2017-04-27 10:39 ` Jan Nieuwenhuizen [this message]
2017-04-27 10:53   ` Panicz Maciej Godek
2017-04-27 12:07   ` Marko Rauhamaa
2017-05-05 17:26 ` Vladimir Zhbanov
2017-05-05 19:44   ` szgyg

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=87a872xhg1.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=cwebber@dustycloud.org \
    --cc=guile-user@gnu.org \
    /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).