Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-28 Thread Alan Post
On Sun, Nov 27, 2011 at 06:39:52PM +0100, Moritz Heidkamp wrote: Vok Vojwo cev...@gmail.com writes: I think the Medea egg intends to do it the right way. But it seems to be buggy. And it has a voracious appetite It does indeed :-) Medea fails to parse the data: (use medea)

[Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Vok Vojwo
I am a bit confused by the way the JSON egg maps JSON structures to Scheme values. The JSON egg maps a structure to a vector: (use json) (with-input-from-string {\pi\:3.14,\e\:2.71} json-read) ;; = #((pi . 3.14) (e . 2.71)) This makes it impossible to use the standard Scheme function assoc to

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Christian Kellermann
* Vok Vojwo cev...@gmail.com [27 14:16]: (assoc* (json-alist json) feed title $t) ;; = Official Google External Developer Events Is there any reason why the JSON egg creates vectors of pairs? If not I would suggest to fix it to make it more schemish. I agree with you and I can only

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Vok Vojwo
2011/11/27 Christian Kellermann ck...@pestilenz.org: My guess is that it makes it possible to write back to json, since alists are already used for representing a different datatype. But json-write does not accept alists as values. This (json-write (vector (cons x (list (cons a 1) (cons b

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Daishi Kato
Even though I agree that it should be schemish, it must be consistent. How would you deal with {1:[2,3],4:[5,6]} and [[1,2,3],[4,5,6]] that must be distinguished? Furthermore, if we were to change the spec of the json egg, we should be aware with backward compatibility issues. Otherwise, I need

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Christian Kellermann
* Vok Vojwo cev...@gmail.com [27 14:37]: 2011/11/27 Christian Kellermann ck...@pestilenz.org: My guess is that it makes it possible to write back to json, since alists are already used for representing a different datatype. But json-write does not accept alists as values. This

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Moritz Heidkamp
Hi Vok, Vok Vojwo cev...@gmail.com writes: I am a bit confused by the way the JSON egg maps JSON structures to Scheme values. The JSON egg maps a structure to a vector: (use json) (with-input-from-string {\pi\:3.14,\e\:2.71} json-read) ;; = #((pi . 3.14) (e . 2.71)) I agree, this is indeed

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Vok Vojwo
2011/11/27 Moritz Heidkamp mor...@twoticketsplease.de: You may be interested in two alternative JSON eggs, namely json-abnf egg (GPLed) which represents both JSON objects as tagged lists alists (i.e. they have a symbol `object' their car) and arrays as vectors or the medea egg (BSD licensed)

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread John Cowan
Vok Vojwo scripsit: I am a bit confused by the way the JSON egg maps JSON structures to Scheme values. [...] Is there any reason why the JSON egg creates vectors of pairs? The problem is that JSON arrays and objects are disjoint, and the egg uses lists to represent JSON arrays. Since lists

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Moritz Heidkamp
John Cowan co...@mercury.ccil.org writes: They differ in their representation of JSON null, however: json-abnf uses 'null, whereas medea's default is () the other way around, actually :-) Moritz ___ Chicken-users mailing list

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Moritz Heidkamp
Vok Vojwo cev...@gmail.com writes: I think the Medea egg intends to do it the right way. But it seems to be buggy. And it has a voracious appetite It does indeed :-) Medea fails to parse the data: (use medea) (read-json json) ;; = #f Thanks for the hint. I managed to bisect it down to

Re: [Chicken-users] Why does the JSON egg map JSON structs to Scheme vectors instead of alists?

2011-11-27 Thread Moritz Heidkamp
Moritz Heidkamp mor...@twoticketsplease.de writes: Thanks for the hint. I managed to bisect it down to a Unicode character in one of the strings (’). Looking at medea's test suite I found this: ;; (test-read '#(Дҫ) [\Дҫ\]) ; FIXME genturfahi needs utf8 support for that to work So thanks