@@ -30,7 +30,7 @@ object NamedTuple:
3030
3131 export NamedTupleDecomposition .{
3232 Names , DropNames ,
33- apply , size , init , last , tail , take , drop , splitAt , ++ , map , reverse , zip , toList , toArray , toIArray
33+ apply , size , init , head , last , tail , take , drop , splitAt , ++ , map , reverse , zip , toList , toArray , toIArray
3434 }
3535
3636 extension [N <: Tuple , V <: Tuple ](x : NamedTuple [N , V ])
@@ -43,9 +43,6 @@ object NamedTuple:
4343 // and should be reverted, just like NonEmptyList is also appealing at first, but a bad idea
4444 // in the end.
4545
46- /** The first element value of this tuple */
47- inline def head : Tuple .Elem [V , 0 ] = x.apply(0 )
48-
4946 // inline def :* [L] (x: L): NamedTuple[Append[N, ???], Append[V, L] = ???
5047 // inline def *: [H] (x: H): NamedTuple[??? *: N], H *: V] = ???
5148
@@ -149,6 +146,9 @@ object NamedTupleDecomposition:
149146 /** The number of elements in this tuple */
150147 inline def size : Tuple .Size [V ] = x.toTuple.size
151148
149+ /** The first element value of this tuple */
150+ inline def head : Tuple .Elem [V , 0 ] = apply(0 )
151+
152152 /** The last element value of this tuple */
153153 inline def last : Tuple .Last [V ] = apply(size - 1 ).asInstanceOf [Tuple .Last [V ]]
154154
0 commit comments