guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-sjson's first public release (v0.2)!


From: Christopher Allan Webber
Subject: Re: guile-sjson's first public release (v0.2)!
Date: Tue, 25 Apr 2017 23:03:27 -0500
User-agent: mu4e 0.9.18; emacs 25.2.1

Marko Rauhamaa writes:

> Christopher Allan Webber <address@hidden>:
>
>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]