unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: Marko Rauhamaa <marko@pacujo.net>
Cc: guile-user@gnu.org
Subject: Re: guile-sjson's first public release (v0.2)!
Date: Tue, 25 Apr 2017 23:03:27 -0500	[thread overview]
Message-ID: <87r30fu86o.fsf@dustycloud.org> (raw)
In-Reply-To: <87h91dqe7y.fsf@elektro.pacujo.net>

Marko Rauhamaa writes:

> Christopher Allan Webber <cwebber@dustycloud.org>:
>
>> In sum though, it has a nice s-expression based syntax:
>>
>>   scheme@(guile-user)> (define a-horse
>>                         '(@ ("name" "buttercup")
>>                             ("age" 6)
>>                             ("animal" "horse")
>>                             ("noise" "neigh!")
>>                             ("food" ("carrot" "oats"))))
>
> Hm, how about:
>
>    (define a-horse
>            '((name . "buttercup")
>              (age . 6)
>              (animal . "horse")
>              (noise . "neigh!")
>              (food . #("carrot" "oats"))))
>
>
> Marko

Hm... that's not bad, using vectors for arrays.  It also fixes the
reason I switched it away from simple cons cell style alists...
I was finding pretty-print of such things unreadable:

  scheme@(guile-user)> ,pretty-print '(@ (name . "buttercup")
                                         (age . 6)
                                         (animal . "horse")
                                         (food . ("carrot" "oats"))
                                         (mood-noises . (@ ("frustrated" . "haurrrfff")
                                                           ("happy" . "neiiiigh")
                                                           ("angry" . "*SNORT*"))))
  $7 = 
  (@ (name . "buttercup")
     (age . 6)
     (animal . "horse")
     (food "carrot" "oats")
     (mood-noises
       @
       ("frustrated" . "haurrrfff")
       ("happy" . "neiiiigh")
       ("angry" . "*SNORT*")))

However doing this with vectors as the arrays solves it:

  scheme@(guile-user)> ,pretty-print '((name . "buttercup")
                                       (age . 6)
                                       (animal . "horse")
                                       (food . #("carrot" "oats"))
                                       (mood-noises . (("frustrated" . "haurrrfff")
                                                       ("happy" . "neiiiigh")
                                                       ("angry" . "*SNORT*"))))
  $5 = 
  ((name . "buttercup")
   (age . 6)
   (animal . "horse")
   (food . #("carrot" "oats"))
   (mood-noises
     ("frustrated" . "haurrrfff")
     ("happy" . "neiiiigh")
     ("angry" . "*SNORT*")))

I'd be open to the change... if we're going to do the change, we should
do it now, when I'm pretty much the only user.  I wonder what David
Thompson thinks?



  reply	other threads:[~2017-04-26  4:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  4:18 guile-sjson's first public release (v0.2)! Christopher Allan Webber
2017-04-25  4:54 ` Marko Rauhamaa
2017-04-26  4:03   ` Christopher Allan Webber [this message]
2017-04-26  5:14     ` Marko Rauhamaa
2017-04-26 14:55       ` Christopher Allan Webber
2017-04-26 13:57     ` Thompson, David
2017-04-26 14:57       ` Christopher Allan Webber
2017-04-25 13:06 ` Mark Oteiza
2017-04-26  3:55   ` Christopher Allan Webber

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=87r30fu86o.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=guile-user@gnu.org \
    --cc=marko@pacujo.net \
    /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).