mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 05:45:37 +03:00
16 lines
438 B
Plaintext
16 lines
438 B
Plaintext
(definterface unsafe-nth (Fn [(Ref (a b) c) Int] &b))
|
|
(implements unsafe-nth Array.unsafe-nth)
|
|
(implements unsafe-nth StaticArray.unsafe-nth)
|
|
(definterface length (Fn [(Ref (a b))] Int))
|
|
(implements unsafe-nth Array.length)
|
|
(implements unsafe-nth StaticArray.length)
|
|
|
|
(defmodule Collections
|
|
(defn empty? [a]
|
|
(= 0 (length a)))
|
|
(defn first [a]
|
|
(if (empty? a)
|
|
(Maybe.Nothing)
|
|
(Maybe.Just @(unsafe-nth a 0))))
|
|
)
|