[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ?-suffix for booleans... good-idea? or bad-idea?
From: |
Jan Nieuwenhuizen |
Subject: |
Re: ?-suffix for booleans... good-idea? or bad-idea? |
Date: |
Thu, 27 Apr 2017 12:39:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
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 <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.nl