doug-moen / openscad2

better abstraction mechanisms for OpenSCAD
Boost Software License 1.0
25 stars 3 forks source link

Sequences #9

Closed gwadej closed 9 years ago

gwadej commented 9 years ago

In the section Ranges, I have some questions about the new range syntax.

  1. I assume [5..1] is an error because the 'step' must be 1 and there is no way to get there.
  2. What happens with [2,4...9]? If 'end' is not part of the sequence, would it be included? I assume not, but it should probably be specified.
doug-moen commented 9 years ago

Q: I assume [5..1] is an error because the 'step' must be 1 and there is no way to get there.

A: The RFC says: "If the end of the range is < the start of the range (with positive step value), then the range is empty (consistent with Haskell)." So [5..1] == [].

Q: What happens with [2,4...9]? If 'end' is not part of the sequence, would it be included? I assume not, but it should probably be specified.

A: The result is the same sequence as [2:2:9]. You get [2,4,6,8]. In other words, no change from current semantics.

Updated Sequences.md to make this all clearer.

gwadej commented 9 years ago

Looks great.