<commit_before>// Package gosequence is a small package to handle
// sequence in Go. It provides slice operations:
// insert and delete(pop) that can be used for
// stack and queue data structure.
// The present methods are already supported
// by the standard package 'container/list' that
/// uses doubly linked list.
// I use slice to mitigate the problem of slowness
// when traversing the linked list.
// You need Go version 1.2 or higher.
package gosequence

import (
	"fmt"
	"sort"
)

// Sequence can contain any type of values
// , because its data is a slice of interface{} type.
// It is an empty interface, which means that it can
// be satisfied by any type of value.
// We deal with sequence of order, so it is natural
// to use slice as our basic data structure.
type Sequence []interface{}

// NewSequence returns a new object of Sequence.
func NewSequence() *Sequence {
	return new(Sequence)
}

// Len returns the length of sequence.
// If the method needs to mutate the receiver
// , the receiver must be a pointer.
// For more detail, refer to this link.
// (http://golang.org/doc/faq#methods_on_values_or_pointers)
func (s Sequence) Len() int {
	// if (s Sequence)
	// len(*s)
	return len(s)
}

// IsEmpty returns true if the sequence is empty.
func (s Sequence) IsEmpty() bool {
	return len(s) == 0
}

// Init initializes the sequence.
func (s *Sequence) Init() {
	s = NewSequence()
}

// Copy returns a copy of the sequence.
// This is useful because ":=" operator
// does deep copy and when we manipulate
// either one, then the other one also changes.
func (s Sequence) Copy() Sequence {
	ts := NewSequence()
	for _, v := range s {
		ts.PushBack(v)
	}
	return *ts
}

// Check returns true if the elem exists
// in the Sequence.
func (s Sequence) Check(elem interface{}) bool {
	for _, value := range s {
		if fmt.Sprintf("%v", value) == fmt.Sprintf("%v", elem) {
			return true
		}
	}
	return false
}

// IsEqual returns true if s1 is equal to s2.
func (s1 Sequence) IsEqual(s2 Sequence) bool {
	check := true
	for _, value := range s2 {
		check = s1.Check(value)
		// if one element does not exist
		// in s2, check will be updated as false
	}
	return check
}

// Find returns the index of input value
// , with true if the value exists in the sequence.
func (s Sequence) Find(val interface{}) (int, bool) {
	for key, value := range s {
		if fmt.Sprintf("%v", value) == fmt.Sprintf("%v", val) {
			return key, true
		}
	}
	return 0, false
}

// PushFront adds an element to the front of sequence.
func (s *Sequence) PushFront(val interface{}) {<commit_msg>Update IsEqual<commit_after>// Package gosequence is a small package to handle
// sequence in Go. It provides slice operations:
// insert and delete(pop) that can be used for
// stack and queue data structure.
// The present methods are already supported
// by the standard package 'container/list' that
/// uses doubly linked list.
// I use slice to mitigate the problem of slowness
// when traversing the linked list.
// You need Go version 1.2 or higher.
package gosequence

import (
	"fmt"
	"sort"
)

// Sequence can contain any type of values
// , because its data is a slice of interface{} type.
// It is an empty interface, which means that it can
// be satisfied by any type of value.
// We deal with sequence of order, so it is natural
// to use slice as our basic data structure.
type Sequence []interface{}

// NewSequence returns a new object of Sequence.
func NewSequence() *Sequence {
	return new(Sequence)
}

// Len returns the length of sequence.
// If the method needs to mutate the receiver
// , the receiver must be a pointer.
// For more detail, refer to this link.
// (http://golang.org/doc/faq#methods_on_values_or_pointers)
func (s Sequence) Len() int {
	// if (s Sequence)
	// len(*s)
	return len(s)
}

// IsEmpty returns true if the sequence is empty.
func (s Sequence) IsEmpty() bool {
	return len(s) == 0
}

// Init initializes the sequence.
func (s *Sequence) Init() {
	s = NewSequence()
}

// Copy returns a copy of the sequence.
// This is useful because ":=" operator
// does deep copy and when we manipulate
// either one, then the other one also changes.
func (s Sequence) Copy() Sequence {
	ts := NewSequence()
	for _, v := range s {
		ts.PushBack(v)
	}
	return *ts
}

// Check returns true if the elem exists
// in the Sequence.
func (s Sequence) Check(elem interface{}) bool {
	for _, value := range s {
		if fmt.Sprintf("%v", value) == fmt.Sprintf("%v", elem) {
			return true
		}
	}
	return false
}

// IsEqual returns true if s1 is equal to s2.
func (s1 Sequence) IsEqual(s2 Sequence) bool {
	for _, value := range s2 {
		if !s1.Check(value) {
			return false
		}
	}
	return true
}

// Find returns the index of input value
// , with true if the value exists in the sequence.
func (s Sequence) Find(val interface{}) (int, bool) {
	for key, value := range s {
		if fmt.Sprintf("%v", value) == fmt.Sprintf("%v", val) {
			return key, true
		}
	}
	return 0, false
}

// PushFront adds an element to the front of sequence.
func (s *Sequence) PushFront(val interface{}) {
{'fraction_non_alphanumeric': 0.11347099311701081, 'fraction_numerical': 0.004129793510324484, 'mean_word_length': 3.203305785123967, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '1171460', 'n_tokens_mistral': 1595, 'n_tokens_neox': 1523, 'n_words': 715}