Port Eval.newt

This commit is contained in:
2025-01-03 22:49:07 -08:00
parent b87999a64d
commit 46434cc555
4 changed files with 1124 additions and 56 deletions

View File

@@ -534,6 +534,7 @@ getAt _ Nil = Nothing
getAt Z (x :: xs) = Just x
getAt (S k) (x :: xs) = getAt k xs
splitOn : a. {{Eq a}} a List a List (List a)
splitOn {a} v xs = go Nil xs
where
@@ -849,3 +850,14 @@ instance ∀ a. {{Show a}} → Show (Maybe a) where
pfunc isPrefixOf uses (True False): String String Bool := `(pfx, s) => s.startsWith(pfx) ? True : False`
pfunc strIndex : String Int Char := `(s, ix) => s[ix]`
instance a. {{Show a}} Show (SnocList a) where
show xs = show (xs <>> Nil)
getAt' : a. Int List a Maybe a
getAt' i xs = getAt (cast i) xs
length' : a. List a Int
length' Nil = 0
length' (x :: xs) = 1 + length' xs