File: sdml_sequence_ordered.sdm

package info (click to toggle)
tree-sitter-sdml 0.4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,504 kB
  • sloc: ansic: 21,145; javascript: 1,141; lisp: 304; makefile: 250; python: 112; cpp: 14; sh: 1
file content (30 lines) | stat: -rw-r--r-- 884 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module sdml_sequence_ordered is

  import skos

  class Ordered is

    def drop (count → unsigned) → Self is
      @skos:definition = "Drop ~count~ items from the beginning of the sequence and return the rest."@en
    end

    def get (index → unsigned) → {0..1} Self is
      @skos:definition = "Return the element in this sequence at the position ~index~."@en
    end

    def reverse → Self is
      @skos:definition = "Return a new sequence with the order of elements reversed."@en
    end

    def slice (start → unsigned count → unsigned) → Self :=
      take(drop(vs count) start) is
      @skos:definition = "Return a sub-sequence of ~count~ elements starting at ~start~."@en
    end

    def take (count → unsigned) → Self is
      @skos:definition = "Return ~count~ items from the beginning of the sequence and discard the rest."@en
    end

  end

end