<commit_before>package main

import (
	"bytes"
	"fmt"
)

// pow computes z to the (nonnegative integer) power i.
func pow(z complex128, i int) complex128 {
	if i < 0 {
		panic("negative power")
	}

	var res complex128 = 1

	for i > 0 {
		res *= z
		i--
	}

	return res
}

// A Function can be evaluated at a complex point.
type Function interface {
	// evaluate computes the value of the function at z.
	Evaluate(z complex128) complex128
}

// A poly is a (complex) polynomial.
type poly []complex128

// Degree returns the degree of the polynomial.
//
// The degree of the zero polynomial is 0.
func (f poly) Degree() int {
	if len(f) == 0 {
		return 0
	}

	var deg int

	for i, v := range f {
		if v != 0 {
			deg = i
		}
	}

	if deg != 0 && f[deg] == 0 {
		return deg - 1
	}

	return deg
}

// Normalise returns a new poly with any excess zeroes culled from the end.
func (f poly) Normalise() poly {
	deg := f.Degree()

	if deg == 0 && len(f) > 0 && f[0] == 0 {
		return poly([]complex128{})
	}

	if deg < len(f) {
		return f[:deg+1]
	}<commit_msg>Remove redundant check in Degree<commit_after>package main

import (
	"bytes"
	"fmt"
)

// pow computes z to the (nonnegative integer) power i.
func pow(z complex128, i int) complex128 {
	if i < 0 {
		panic("negative power")
	}

	var res complex128 = 1

	for i > 0 {
		res *= z
		i--
	}

	return res
}

// A Function can be evaluated at a complex point.
type Function interface {
	// evaluate computes the value of the function at z.
	Evaluate(z complex128) complex128
}

// A poly is a (complex) polynomial.
type poly []complex128

// Degree returns the degree of the polynomial.
//
// The degree of the zero polynomial is 0.
func (f poly) Degree() int {
	if len(f) == 0 {
		return 0
	}

	var deg int

	for i, v := range f {
		if v != 0 {
			deg = i
		}
	}

	return deg
}

// Normalise returns a new poly with any excess zeroes culled from the end.
func (f poly) Normalise() poly {
	deg := f.Degree()

	if deg == 0 && len(f) > 0 && f[0] == 0 {
		return poly([]complex128{})
	}

	if deg < len(f) {
		return f[:deg+1]
	}
{'fraction_non_alphanumeric': 0.12512077294685992, 'fraction_numerical': 0.03333333333333333, 'mean_word_length': 2.6785079928952045, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2023518', 'n_tokens_mistral': 836, 'n_tokens_neox': 728, 'n_words': 300}