From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Arne Babenhauserheide Newsgroups: gmane.lisp.readable-lisp,gmane.lisp.guile.user Subject: wisp literal array syntax for Guile, a good idea? Date: Sun, 12 Nov 2017 19:34:31 +0100 Message-ID: <87mv3rgrwk.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2646184324747601888==" X-Trace: blaine.gmane.org 1510518728 12371 195.159.176.226 (12 Nov 2017 20:32:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 12 Nov 2017 20:32:08 +0000 (UTC) To: guile-user-mXXj517/zsQ@public.gmane.org, readable-discuss Original-X-From: readable-discuss-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Sun Nov 12 21:32:04 2017 Return-path: Envelope-to: glr-readable-discuss@m.gmane.org Original-Received: from lists.sourceforge.net ([216.34.181.88]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDyvD-0002xq-I7 for glr-readable-discuss@m.gmane.org; Sun, 12 Nov 2017 21:32:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eDyvJ-0001RT-51; Sun, 12 Nov 2017 20:32:09 +0000 Original-Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eDyvH-0001RM-TU for readable-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org; Sun, 12 Nov 2017 20:32:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject: To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jW4cXXiTun6kKkdixnb5KUmbCt2JkLRDfJJq1xG60Rs=; b=fBr5GUNn4IWznWQLZNmfSl8zdg 6OXX0X2hGHKypdVCoBuyQChkKu5VEsebeG0pgkti/X1jGU88tO2sbWKFE4WeegjwqprVlrpy2moum 1dCytwmCNpg3+DVvL6ps2jE5fg3zpqx6Cyj8dCZHpqZmpH7CSdGapzCSgwHk1UnwCYlY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender:Reply-To :Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=jW4cXXiTun6kKkdixnb5KUmbCt2JkLRDfJJq1xG60Rs=; b=F h+Lz/Rk1lSt7FB2RErM9zgScTQ5weUwPVl6i0iMT3bFifcMOe63+tTWrSaLhKnT59BGqkXBbJLnF6 JSD8teTt9EaMLVrVEH7UPFWYEvviFlsVDfTtd3aDsZVbsIWOxd1eX4lepGtfFBdvG6Tbr6pcehkxK kSB0piAQhyCqvmJs=; Original-Received: from mout.web.de ([212.227.17.11]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1eDyvG-0000Ax-Ev for readable-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org; Sun, 12 Nov 2017 20:32:07 +0000 Original-Received: from fluss ([85.212.119.94]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MNtLj-1eH0mi1tDX-007RR8; Sun, 12 Nov 2017 21:31:59 +0100 X-Provags-ID: V03:K0:nyqTUp6XmiExnEq/FFAOzS9tcvK5IibeAWHQHnCZWBYKWzu3ndK ntJ+leWwE2GeMfurY/KXBybhpZBYijcBGBqJz9X1D4adjbplUTVzleMDIYWvXZjhw0c8Qm3 ++jUMzKb5XSBOx05rCJ7Rr2YLoCuwJ+SzTz6zK6C8vztZqYGSFT/lW7AfWqyRtUBahsn7ry pbsTckvPPfjPkBQPF525w== X-UI-Out-Filterresults: notjunk:1;V01:K0:4AeKSzKHzsM=:cSgQZGRjsm1+Fd4V2E/bfq LgP7e4hbExLk8Wy4CD0xGSUyAbwYnGG+xqtBNRuazScqDikimo91kw58mC7eecHAz1C5u0JLt CUy4/hB120+2XxIu/KvIHyKsXph1PV7SX5kf00wxA0hjF8s7iDGiNVVV3ie9woNpeGQKs8bC+ yiySxV/LS33uSesi2UthhiZlGA3J/pIO8YnUiqv52Wht+nLkUIsV/OlPDb9nk8BmdcdDO/9IQ vaaRIO6cRCKDl8PlJ7BLCQlPT9oOy8I5hVD8zg0h5ofcubIH77MR/iBuev00RwK1+GpXJOUxw aa/yPk+1Sdt6vX2YAcTXVqDYwGBHaeezMqC5l+0isnSjBAhkd6I/5/E0IlJveqiTnxqty0eWF V/YDQzpoaQdvaETPVMJoI6G9+a/XXrk8t+BGpZsjsfmLayCdOVLZqJHg2zDYaCxDrzLqoxODa ifwKpv49UIHn/oAHcNwyKFYaYeVZy1RAQX5Lx+IlXnzngb+BuB7av9dB/z2MC501fxV+JuG+A CFwoxAz0kSjp2KcqxbQqLXeHX2M31JMozQAFxuhO/LVowRrZa+N/qqV754PwUPkSKYjqhTIKU 48xoy8E5Mgw5FsdEuxU8n7bY+XH5v0yh5GpcdKl6ifimZQ7ip4YxecqCZzPT603+rwxQUMGLn Pig010dVTAXNFKWvUCwtIbQdSOTcWl867SovsoHCE+BlzwCjGqpvmmJEgnI6EDDnfroDurzeB H70vggcCPb/rysg17D1SL7lZWRvCVzp11+FbmeNSx8pKN1Rp9OsoI2e2e3TLhyKoYwce+7Lh X-Headers-End: 1eDyvG-0000Ax-Ev X-BeenThere: readable-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discuss how to make s-expressions more readable List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: readable-discuss-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Xref: news.gmane.org gmane.lisp.readable-lisp:1549 gmane.lisp.guile.user:14250 Archived-At: --===============2646184324747601888== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Wisp=C2=B9 as general syntax is pretty much done. The releases this year on= ly provided bug fixes and additional examples. A procedure definition looks like this: define : hello who format #f "Hello ~a!\n" . who From=20experience with building tools with Wisp=C2=B2 I am pretty happy with its syntax; it feels like a sweet spot between minimal syntax-overhead and producing easily readable code (leaning a bit more towards minimal syntax-overhead than readable/sweet). But there is one Guile-specific feature where it is lacking: When defining a procedure in Guile, you can add properties by creating a literal array as line =E2=80=94 or as second line if the first line is a li= teral string that then serves as documentation. This can be used to define tests.=C2=B3 Then a full fledged Hello World! looks like this: define : hello who . "Say hello to WHO" . #((tests (test-equal "Hello World!\n" (hello "World")))) format #f "Hello ~a!\n" . who And this is all and nice, but it prevents using indentation-based syntax for the properties. This would be no problem if I could simply make an array with non-literal syntax =E2=80=94 i.e. (list->array (list (list tests (list test-eqv ...)))) =E2=80=94 but Guile property syntax requires a liter= al array. Therefore I created a reader-extension=E2=81=B4 which allows creating liter= al arrays with indentation-based syntax using the hash-extension ##: define : hello who . "Say hello to WHO" ## tests test-equal "Hello World!\n" hello "World" format #f "Hello ~a!\n" . who To my eyes this looks reasonably nice, and it allows using arbitrary arrays. It uses the conventional #-extension common to Scheme which avoids adding more constructs, and internally it just passes ## a b c to the wisp paren-restructuring code as (#\# a b c) which then becomes #(a b c) as used in similar fashion for the other special paren-prefixes ("'" "," "#'", ...). But it feels strange to add specialized syntax here. I would rather want something more general =E2=80=94 something which does not feel like opening= a can of worms of more and more syntax elements which could crop in. It feels like straying from the path of simplicity. Therefore I=E2=80=99d like to ask you for comments. Do you have ideas how t= his could be made more elegant? Or is this intrinsic complexity of the Scheme or Guile literal array prefix (and the other paren-prefixes) which I cannot escape with wisp? Best wishes, Arne =C2=B9: Wisp website: http://www.draketo.de/english/wisp =C2=B2: Wisp examples (tools with wisp): https://bitbucket.org/ArneBab/wisp/src/e80659fcc896ab04fbcd0a2d78e0dc25f= ef474a0/examples/ =C2=B3: This doctest syntax is built on SRFI-64 and implemented in and =E2=81=B4: The code for the reader extension consists of a single line in t= he reader: read-hash-extend #\# : =CE=BB (chr port) #\# eight lines in the clean parser (currently mostly a hack) and some special cases in the bootstrap parser and wisp->lisp converter = which operates on bare strings =2D-=20 Unpolitisch sein hei=C3=9Ft politisch sein ohne es zu merken --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE801qEjXQSQPNItXAE++NRSQDw+sFAloIr74ACgkQE++NRSQD w+sWoQ/+Mxo83VtMoaxgTwIi4/Kc2Ca0kemD3iK57/6Zj0QsSoATvvAWYR9hPR3R LztEV2IfJIsHZBxQ4P4ph0ifnxYSIzCq/TObx5slHvYptHFT+MB7359Ou3vrwCd2 i8dIVi6iaAuIRScL3IVXLok2dDgJmxCYtSQM29HbsXUM0r1B553p3unb/oKX4m0P VOD9Qd4qdiGcgqwPUSvFFGicl4TAUqjOeHP8VD5PelwTttJdL2hWUxaEek3hIxdF 79aNE7xBkemQq7XYYAjPWMsZw0cZsHk5Mz3MPIXN0SiuUvE5kyRHZfdMvciqigWk 2ycQccg9rQ5bhDLv446/Avs9NfSWiGfsyAsCWXkpjTAM0mMOg1CfJhl3HhF/LJsH Jy4I1ak4DpciXX6Mlu/bbMdUtVTxU6lQ0c/LhNhOSS86F44ZjQWz4Eqo4tzwMjWX GB1EemJ+4C0nMczSCSqSjDNuWpoiTuDbgJegsmPUDZm1EzCt3fj78eUNw8dAF02m ottZ7u9s2CMyKqqHXSHEV7oVDC5Nl/AgJXHK/x5xFggA/3sZPpx9QjylDqSGPwrV 58kwZTJcoOH/eDb0xTPHCbBsUtjTAE3Hs0kwbBoot0rxfG8Uchi1v8tKe/H5CZPQ ptdfLU3FXAJMbLy8YjGeh1+NWkH/2ghU4SmSxMvHzhxFV09bcAo= =gQZF -----END PGP SIGNATURE----- --=-=-=-- --===============2646184324747601888== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --===============2646184324747601888== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Readable-discuss mailing list Readable-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/readable-discuss --===============2646184324747601888==--