def Vec4.from_list
import bend-tensors@0.0.0.2/bend_tensors.bend as BendTensorsimport Base
126# the first four of xs, padded with 0.0, and the rest
127def Vec4.from_list(xs: List<&2, F32>) -> Vec4:
128 match xs:
129 case x0 <> x1 <> x2 <> x3 <> rest:
130 Vec4{x0, x1, x2, x3}
131 case x0 <> x1 <> x2 <> []:
132 Vec4{x0, x1, x2, 0.0}
133 case x0 <> x1 <> []:
134 Vec4{x0, x1, 0.0, 0.0}
135 case x0 <> []:
136 Vec4{x0, 0.0, 0.0, 0.0}
137 case []:
138 Vec4{0.0, 0.0, 0.0, 0.0}