Well, you could use #nil, a Guile-specific unique object that is both falsy (like #f) and answers #t to the null? predicate. It is used to emulate Common Lisp's and Elisp's nil. But a more portable approach would be to define a record type with no slots and make just one instance of it.
On Sun, Aug 26, 2018 at 10:09 AM HiPhish <hiph...@posteo.de> wrote: > 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? > > 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 > > > >