18 lines
527 B
Plaintext
18 lines
527 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 [string]] 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)
|