put the port in the port directory

This commit is contained in:
2025-01-05 11:15:29 -08:00
parent 9262fa8b27
commit 9172d88be7
32 changed files with 0 additions and 0 deletions

27
port/Data/List1.newt Normal file
View File

@@ -0,0 +1,27 @@
module Data.List1
import Prelude
infixr 7 _:::_
record List1 a where
constructor _:::_
head1 : a
tail1 : List a
split1 : String String List1 String
split1 str by = case split str by of
Nil => str ::: Nil
x :: xs => x ::: xs
unsnoc : a. List1 a List a × a
unsnoc {a} (x ::: xs) = go x xs
where
go : a List a List a × a
go x Nil = (Nil, x)
go x (y :: ys) = let (as, a) = go y ys in (x :: as, a)
splitFileName : String String × String
splitFileName fn = case split1 fn "." of
part ::: Nil => (part, "")
xs => mapFst (joinBy ".") $ unsnoc xs