From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: A value for "nothing" Date: Mon, 27 Aug 2018 02:17:06 +0200 Message-ID: References: <21036238.c6yQEfjfIL@aleksandar-ixtreme-m5740> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1535329077 24421 195.159.176.226 (27 Aug 2018 00:17:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Aug 2018 00:17:57 +0000 (UTC) Cc: guile-user@gnu.org To: hiphish@posteo.de Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Aug 27 02:17:53 2018 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fu5E8-0006D3-7x for guile-user@m.gmane.org; Mon, 27 Aug 2018 02:17:52 +0200 Original-Received: from localhost ([::1]:50793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fu5GE-0001c2-EQ for guile-user@m.gmane.org; Sun, 26 Aug 2018 20:20:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fu5Fm-0001bD-G2 for guile-user@gnu.org; Sun, 26 Aug 2018 20:19:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fu5DP-0003vH-AF for guile-user@gnu.org; Sun, 26 Aug 2018 20:17:08 -0400 Original-Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:35355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fu5DP-0003uV-1L for guile-user@gnu.org; Sun, 26 Aug 2018 20:17:07 -0400 Original-Received: by mail-ed1-x531.google.com with SMTP id y20-v6so2587096edq.2 for ; Sun, 26 Aug 2018 17:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xsar+GvrRevDTZykPr+veVz5+JPa8XD+YOH+8p2jnKw=; b=RepYM8zph93MWAqQk2TH/UU927karZ5hq5iOmZR647XCJQuP5CYECFe1kQ+l4ooSjp KwROlbgTu3HhB23OBY9hG7dNFUxM9gU6xHhukcEiFDE+5zRf6DS+OoLKZVhctej/gMxm PXyUlKhdUG2DglPk26iOES04CAmi5SOTL1UWCWYN9ZKB/mhu5dAK46p7EzqSqxbbffsn egl0OBpCjDKTGmnq1Zl6tQKnChExJsFVAKorsj/KITPs7d4rN5i7mJMMxFxAh9WS6qdR IrGDRAFvCLlLFx4ezFNwrGeu9trLErBHPdTr9Bp8dyVtvP20NU9kC3EldbKpydVitSmk Epnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xsar+GvrRevDTZykPr+veVz5+JPa8XD+YOH+8p2jnKw=; b=pUBPnkAR2nGyyES09sGs00T0Yr/cVIkUwdaYJu95xTI2dt1AueNMbp6JNKbXYKF2Tn NsELQoWFYqX5qjb+e4FgMT9W7vcXh+x2ciFPuyLKwb2PLS4akOfM5GZSuJbbiLcxcZgg 65LqAJC1mjvv1tH4pCBaJemaqSoCpLcgANud3b0QaQTNwPGOvMutYkieUKo17sJU4FpJ ekhKgHadIu6VlzJq7sgbTLEsYT/uHfjkd/S6DwnMRN85B4xtMKECem3eoEVpFgAIwOdD zpcOYHd5jGhDiwOVv/z42Xe2mqfGJNTjkTYK4ALmuZrCnz7Z8expNL6eJK9293WEY9z5 g+Gw== X-Gm-Message-State: APzg51CwV08IJEi1Paec0oNT45WXn/yq5+CWstJkNvKYPrHNqD/VlayP sI7EgkOwxKpPBctljWd+bdDKezbezBUnAn8GDSM= X-Google-Smtp-Source: ANB0VdYIajZaE1b8zdDfvRB1RNiUMtf0DveUIzyEnTsoetp8ZsyXmDCGZl6M11u2qIE/4S2fYuvZd8EGKsKaVxkT4Do= X-Received: by 2002:a50:95a8:: with SMTP id w37-v6mr13762444eda.33.1535329025712; Sun, 26 Aug 2018 17:17:05 -0700 (PDT) In-Reply-To: <21036238.c6yQEfjfIL@aleksandar-ixtreme-m5740> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::531 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14772 Archived-At: niedz., 26 sie 2018 o 16:09 HiPhish napisa=C5=82(a): > 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 `#` 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 my experience, if #f doesn't make sense as a legal value, then using #f is probably the idiomatic Scheme way to go. It composes with SRFI-2's and-let* in a way similar to Haskell's Nothing within the "do" notation. I did find it useful when I was implementing a pattern matching facility, where I could distinguish between an empty list of (successful) bindings and a failed match. But I think you would need to tell us more about the library: where do the values come from and what do they represent. What would this "nil" data type be supposed to stand for?