<commit_before>package math

import (
	"fmt"
)

// Vec2 is the representation of a vector with 2 components.
type Vec2 [2]float32

// Vec3 is the representation of a vector with 3 components.
type Vec3 [3]float32

// Vec4 is the representation of a vector with 4 components.
type Vec4 [4]float32

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000}
func (v1 *Vec2) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000, 0.00000}
func (v1 *Vec3) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000, 0.00000, 0.00000}
func (v1 *Vec4) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// Vec3 return a Vec3 from this Vec2 with {z}. Similar to GLSL
//    vec3(v2, z);
func (v1 *Vec2) Vec3(z float32) Vec3 {
	return Vec3{v1[0], v1[1], z}
}

// Vec4 return a Vec4 from this Vec2 with {z,w}. Similar to GLSL
//    vec4(v2, z, w);
func (v1 *Vec2) Vec4(z, w float32) Vec4 {
	return Vec4{v1[0], v1[1], z, w}
}

// Vec2 return a Vec2 from the first 2 components of this Vec3. Similar to GLSL
//    vec2(v3);
func (v1 *Vec3) Vec2() Vec2 {
	return Vec2{v1[0], v1[1]}
}

// Vec4 return a Vec4 from this Vec3 with {w}. Similar to GLSL
//    vec4(v3, w);
func (v1 *Vec3) Vec4(w float32) Vec4 {
	return Vec4{v1[0], v1[1], v1[2], w}
}

// Vec2 return a Vec2 from the first 2 components of this Vec4. Similar to GLSL
//    vec2(v4);
func (v1 *Vec4) Vec2() Vec2 {
	return Vec2{v1[0], v1[1]}
}

// Vec3 return a Vec3 from the first 3 components of this Vec4. Similar to GLSL
//    vec3(v4);
func (v1 *Vec4) Vec3() Vec3 {
	return Vec3{v1[0], v1[1], v1[2]}
}

// Set assigns the components of a Vec2 in one go.
func (v1 Vec2) Set(x, y float32) {
	v1[0] = x
	v1[1] = y
}

// Set assigns the components of a Vec3 in one go.
func (v1 *Vec3) Set(x, y, z float32) {
	v1[0] = x
	v1[1] = y
	v1[2] = z
}

// Set assigns the components of a Vec4 in one go.
func (v1 *Vec4) Set(x, y, z, w float32) {
	v1[0] = x
	v1[1] = y
	v1[2] = z
	v1[3] = w
}<commit_msg>fixup! math: Add Set() functions<commit_after>package math

import (
	"fmt"
)

// Vec2 is the representation of a vector with 2 components.
type Vec2 [2]float32

// Vec3 is the representation of a vector with 3 components.
type Vec3 [3]float32

// Vec4 is the representation of a vector with 4 components.
type Vec4 [4]float32

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000}
func (v1 *Vec2) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000, 0.00000}
func (v1 *Vec3) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// String returns a pretty string for this vector. eg.
// {-1.00000, 0.00000, 0.00000, 0.00000}
func (v1 *Vec4) String() string {
	ret := "{"
	for n := 0; n < len(v1); n++ {
		if v1[n] >= 0 {
			ret += " "
		}
		ret += fmt.Sprintf("%.6f", v1[n])
		if n < len(v1)-1 {
			ret += ", "
		}
	}
	return ret + "}"
}

// Vec3 return a Vec3 from this Vec2 with {z}. Similar to GLSL
//    vec3(v2, z);
func (v1 *Vec2) Vec3(z float32) Vec3 {
	return Vec3{v1[0], v1[1], z}
}

// Vec4 return a Vec4 from this Vec2 with {z,w}. Similar to GLSL
//    vec4(v2, z, w);
func (v1 *Vec2) Vec4(z, w float32) Vec4 {
	return Vec4{v1[0], v1[1], z, w}
}

// Vec2 return a Vec2 from the first 2 components of this Vec3. Similar to GLSL
//    vec2(v3);
func (v1 *Vec3) Vec2() Vec2 {
	return Vec2{v1[0], v1[1]}
}

// Vec4 return a Vec4 from this Vec3 with {w}. Similar to GLSL
//    vec4(v3, w);
func (v1 *Vec3) Vec4(w float32) Vec4 {
	return Vec4{v1[0], v1[1], v1[2], w}
}

// Vec2 return a Vec2 from the first 2 components of this Vec4. Similar to GLSL
//    vec2(v4);
func (v1 *Vec4) Vec2() Vec2 {
	return Vec2{v1[0], v1[1]}
}

// Vec3 return a Vec3 from the first 3 components of this Vec4. Similar to GLSL
//    vec3(v4);
func (v1 *Vec4) Vec3() Vec3 {
	return Vec3{v1[0], v1[1], v1[2]}
}

// Set assigns the components of a Vec2 in one go.
func (v1 *Vec2) Set(x, y float32) {
	v1[0] = x
	v1[1] = y
}

// Set assigns the components of a Vec3 in one go.
func (v1 *Vec3) Set(x, y, z float32) {
	v1[0] = x
	v1[1] = y
	v1[2] = z
}

// Set assigns the components of a Vec4 in one go.
func (v1 *Vec4) Set(x, y, z, w float32) {
	v1[0] = x
	v1[1] = y
	v1[2] = z
	v1[3] = w
}
{'fraction_non_alphanumeric': 0.18123040752351097, 'fraction_numerical': 0.09090909090909091, 'mean_word_length': 2.6859205776173285, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5061466', 'n_tokens_mistral': 2432, 'n_tokens_neox': 2238, 'n_words': 748}