flan/test/programs/array-first-element.flan

15 lines
495 B
Plaintext

;;;; An array literal with nothing outside it saying what its elements are
;;;; takes that from the elements that are not literals: [(f32 1.0) 2.5] is a
;;;; [2 f32], and the 2.5 is an f32 literal rather than an f64.
(defn sum3 [a [3 f32]] f32 (+ (at a 0) (at a 1) (at a 2)))
(defn main [] i32
(let [a [(f32 1.0) 2.5 3.25]
b [(i64 1) 2 3]
c [(u8 1) 255]]
(println (length a))
(println (sum3 a))
(println (+ (at b 1) (i64 9000000000)))
(println (at c 1)))
0)