How to specify ranges in YAML?

I can express

Third page - cover page

in yaml

title: 3 

What about the next one?

Pages 10 through 15 contain chapter 1

One of the methods -

 chapter 1: [10, 11, 12, 13, 14, 15] 

I would prefer a range here. Is there anything similar in YAML?

 chapter 1: (10..15) 

** Update **

The following would be my alternative if in YAML there is no such area as range

 chapter 1: start page: 10 end page: 15 
+6
syntax yaml
source share
3 answers

There is no direct way to specify ranges in YAML, but some YAMLs can store serialized objects, such as in Ruby:

 ... normal range: !ruby/range 10..20 exclusive range: !ruby/range 11...20 negative range: !ruby/range -1..-5 ... 

Look at here

+11
source share

Range is an application. For some applications, the following may make sense:

-1 .. Q

a .. u

23 .. -23.45

1 .. 12:01:14 (both are integers in YAML!)

But the ruby ​​path is also unclear, because it does not say whether the final values ​​are included or not: 10 .. 15

(Are you talking only about ranges of integers?)

+3
source share

Andrey is right - there is no such thing as a basic range. Ranges can be defined on top of fully ordered data types. YAML does not even know the concept of ordering, so it makes no sense to talk about ranges in YAML. YAML only knows the concepts of node types, the concept of equality, and some predefined types of connections between nodes. By the way, I don't know of any other serialization of lange data (JSON, XML, CSV, Hessian, Protocol Buffers ...) that natively supports ranges.

+1
source share

All Articles