Live data from Hacker News

Preserves: An Expressive Data Language

preserves.dev

11–20 of 46 posts

Re: Preserves: An Expressive Data Language

#11
post #10

CSTML is targeting many of the same weaknesses in JSON. It's fun to see a whole different, competing set of design choices at work. I had a very different take on schema validation and how to use the < syntax.

Do you have a link for CSTML, please? Googling is showing a bunch of possibilities none of which look quite relevant enough to be right...

https://github.com/bablr-lang/

https://bablr.org/playground

Re: Preserves: An Expressive Data Language

#12
Is it true that Records are the same as Dictionaries, because the labels in the records can have any value?

Interesting on how on one hand the size of SignedInteger is unlimited, but on the other hand there is a ByteString. A ByteString could also have been represented by as a sequence of SignedInteger. I also wonder if it would not better to have a Unicode character as an atomic unit and represent a string as a sequence of Unicode characters.

This makes me wonder whether this is a high-level data model or yet another data representation.

Re: Preserves: An Expressive Data Language

#13
post #10

Earlier quoted context omitted.

Do you have a link for CSTML, please? Googling is showing a bunch of possibilities none of which look quite relevant enough to be right...

https://github.com/bablr-lang/ https://bablr.org/playground

Thank you!

Re: Preserves: An Expressive Data Language

#14
post #12

Is it true that Records are the same as Dictionaries, because the labels in the records can have any value? Interesting on how on one hand the size of SignedInteger is unlimited, but on the other hand there is a ByteString. A ByteString could also have been represented by as a sequence of SignedInteger. I also wonder if it would not better to have a Unicode character as an atomic unit and represent a string as a sequ…

No, a record is a tagged (sequence of) value(s).

  
If you put a single dictionary-valued "field" in a record, you get a variation with named fields

  
Records have positional "fields" because of the Scheme heritage of the design.

--

Re bytestring -- yes there are some concessions to real machines/languages in there that aren't absolutely required. Other examples include booleans and strings, which could have been and and etc respectively.

There's a little more on this topic in footnote 2 on the "conventions" page: https://preserves.dev/conventions.html#fn:why-dictionaries

Re: Preserves: An Expressive Data Language

#18
post #17

So EDN?

Yeah EDN is quite similar. Preserves has no nil, allows any value as a tag, gets into the weeds more on when strings are equal or not, doesn't distinguish lists and vectors, and doesn't require each kind of tagged element to define an equivalence. And it has annotations (vs EDN's comments) and embedded values.

Re: Preserves: An Expressive Data Language

#19
post #8
post #6

> This is a good time to mention that even though from a semantic perspective sets and dictionaries do not carry information about the ordering of their elements. Except they do in Python. It is extremely useful, surprisingly often.

Python remembers order, and exposes it in its iterations, but doesn't use it in its equivalence over dictionaries (== semantics). (ETA: What are you quoting there? I don't think that text appears on the Preserves site) (ETA2: Ah, it's the tutorial. Cool)

Not sure about the previous post, but also python’s OrderedDict collection guarantees order-sensitive equality checks. [1]

Plain dict maintains insertion order but equality checks only check that the key/value pairs are the same. [2] [3]

[1] https://docs.python.org/3/library/collections.html#:~:text=e...

[2] https://docs.python.org/3/library/stdtypes.html#:~:text=dict...

[3] https://docs.python.org/3/library/stdtypes.html#:~:text=dict...

Re: Preserves: An Expressive Data Language

#20
post #3

Why/when/where would I need this?

I was going to ask the exact same question. The title makes it sound like something I might be interested in, then I visited the page and I have no idea what it does.

After some brief reading of docs, I'm trying to write one sentence explanations. Maybe this will be helpful to you

What

Preserves is a specification and set of libraries in popular languages that lets you reliably exchange data between XML, JSON and EDN.

Who

Preserves is built for (data engineers|data framework writers) to reliably interchange data.

Why

Formats like JSON in particular are imprecise. Preserves forces you to deal with these vagaries up front

What else?

With P-Expressions you can search a preserve compliant datasource much like you would query JSON with JQ

Who Not? Who shouldn't use this

This will not help a data analyst exchange data between CSV and Excel

Post reply on HN