flan/test/programs/dyn-slice.flan

18 lines
524 B
Plaintext

;; (slice d ...) over a dyn text, in the three spellings the typed slice has.
;; The result is a text of its own; the source is untouched.
;;
;; With an argument, the last slice runs past the end and traps.
(defn main [args [str]] i32
(let [d (the dyn "hello")]
(println (slice d))
(println (slice d 1))
(println (slice d 1 3))
(println (slice d 5))
(println (length (slice d 2)))
(println (= (slice d 0 2) "he"))
(println d)
(when (> (length args) 1)
(println (slice d 2 9))))
0)