From: Thomas Morley <thomasmorley65@gmail.com>
To: HiPhish <hiphish@posteo.de>
Cc: guile-user@gnu.org
Subject: Re: A value for "nothing"
Date: Sun, 26 Aug 2018 19:21:50 +0200 [thread overview]
Message-ID: <CABsfGyVY_WZgNykoAvwPOUUTep8HpHmgGLT3fNfNmTjsCrTn8w@mail.gmail.com> (raw)
In-Reply-To: <21036238.c6yQEfjfIL@aleksandar-ixtreme-m5740>
2018-08-26 12:13 GMT+02:00 HiPhish <hiphish@posteo.de>:
> Hello Schemers,
>
> I am writing an implementation of MessagePack [1] for Guile and a part of the
> spec is the presence of a "nil" data type. What would be a good value to
> express "nothing" in Guile? I cannot use '() because that would be
> indistinguishable from the empty list, so I thought that the return value of a
> function that returns nothing would be a good fit. The function `display` for
> example returns an `#<unspecified>` value, but the only way of producing it
> without side effects so for is the value of `(if #f #f)`. Is there a better
> way?
Well, actually that's how the value of *unspecified* is defined.
From boot9.scm:
;;; {The Unspecified Value}
;;;
;;; Currently Guile represents unspecified values via one particular value,
;;; which may be obtained by evaluating (if #f #f). It would be nice in the
;;; future if we could replace this with a return of 0 values, though.
;;;
(define-syntax *unspecified*
(identifier-syntax (if #f #f)))
(define (unspecified? v) (eq? v *unspecified*))
Cheers,
Harm
>
> In Racket there is the `(void)` [2] procedure which returns a `#<void>`
> object, so that's what I am using there [3][4]. Any suggestions for Guile?
>
> [1] https://msgpack.org/
> [2] http://docs.racket-lang.org/reference/void.html?q=void
> [3] https://gitlab.com/HiPhish/MsgPack.rkt/blob/master/msgpack/unpack.rkt#L47
> [4] https://gitlab.com/HiPhish/MsgPack.rkt/blob/master/msgpack/pack.rkt#L35
>
>
>
next prev parent reply other threads:[~2018-08-26 17:21 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-26 10:13 A value for "nothing" HiPhish
2018-08-26 17:21 ` Thomas Morley [this message]
2018-08-26 17:27 ` Joshua Branson
2018-08-26 17:49 ` John Cowan
2018-08-27 4:52 ` Mark H Weaver
2018-08-27 13:00 ` John Cowan
2018-08-27 21:29 ` Mark H Weaver
2018-08-27 21:32 ` Mark H Weaver
2018-08-26 20:07 ` Mark H Weaver
2018-08-26 22:08 ` Matt Wette
2018-08-27 8:04 ` tomas
2018-08-27 20:12 ` Mark H Weaver
2018-08-27 20:46 ` Mark H Weaver
2018-08-28 0:50 ` Matt Wette
2018-08-28 6:58 ` Mark H Weaver
2018-08-28 15:19 ` John Cowan
2018-08-28 15:38 ` Mark H Weaver
2018-08-28 15:59 ` Mark H Weaver
2018-08-28 16:12 ` John Cowan
2018-08-28 17:15 ` Mark H Weaver
2018-08-28 19:07 ` Mark H Weaver
2018-08-27 20:54 ` Hans Åberg
2018-08-27 0:17 ` Panicz Maciej Godek
2018-08-27 8:02 ` tomas
2018-08-27 8:29 ` Panicz Maciej Godek
2018-08-27 8:29 ` HiPhish
[not found] ` <8840615.kRvQfVdCvZ@aleksandar-ixtreme-m5740>
[not found] ` <CAD2gp_QLqd=_RbF=HTEbCLp1onmUq-c74g0FXTvMgdz8JB4-8A@mail.gmail.com>
2018-08-27 8:24 ` HiPhish
[not found] ` <3467110.H24gZIzStD@aleksandar-ixtreme-m5740>
[not found] ` <87ftz0vidc.fsf@netris.org>
2018-08-27 8:40 ` HiPhish
2018-08-27 12:37 ` Ludovic Courtès
2018-08-27 19:49 ` Mark H Weaver
2018-08-28 7:52 ` Ludovic Courtès
-- strict thread matches above, loose matches on Subject: below --
2018-08-26 20:25 HiPhish
2018-09-13 21:49 HiPhish
[not found] ` <CAD2gp_Sg-aDXZKfOcL-i2py7ne4c0Cp+2HvKS4DYi1Antm_B1A@mail.gmail.com>
2018-09-14 22:45 ` HiPhish
2018-09-15 0:26 ` John Cowan
2018-09-15 14:50 ` HiPhish
2018-09-15 18:28 ` Keith Wright
2018-09-15 21:50 ` Edwin Watkeys
2018-09-15 22:16 ` HiPhish
2018-09-15 22:23 ` Edwin Watkeys
2018-09-15 22:13 ` HiPhish
2018-09-15 22:45 ` David Pirotte
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=CABsfGyVY_WZgNykoAvwPOUUTep8HpHmgGLT3fNfNmTjsCrTn8w@mail.gmail.com \
--to=thomasmorley65@gmail.com \
--cc=guile-user@gnu.org \
--cc=hiphish@posteo.de \
/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).