<commit_before>// All you need to work with stackgo stacks
//
// For an example usage visit http://github.com/alediaferia/stackgo
package stackgo

type Stack struct {
	slice []interface{}
	blockSize int
}

const s_DefaultAllocBlockSize = 20;

// NewStack Creates a new Stack object with
// an underlying default block allocation size.
// The default is currently 20 but this may vary
// in the future.
// If you want to use a different block size use
//  NewStackWithCapacity()
func NewStack() (*Stack) {
	stack := new(Stack)
	stack.slice = make([]interface{}, 0, s_DefaultAllocBlockSize)
	stack.blockSize = s_DefaultAllocBlockSize

	return stack
}

// NewStackWithCapacity makes it easy to specify
// a custom block size for inner slice backing the
// stack
func NewStackWithCapacity(cap int) (*Stack) {
	stack := new(Stack)
	stack.slice = make([]interface{}, 0, cap)
	stack.blockSize = cap

	return stack
}

// Push pushes a new element to the stack
func (s *Stack) Push(elem interface{}) {

	if len(s.slice) >= cap(s.slice) {
		slice := make([]interface{}, 0, len(s.slice) + s.blockSize)
		copy(slice, s.slice)
		s.slice = slice
	}

	s.slice = append(s.slice, elem)
}

// Pop pops the top element from the stack
// If the stack is empty it returns nil
func (s *Stack) Pop() (elem interface{}) {
	if s.Size() == 0 {
		return nil
	}

	elem, s.slice = s.slice[len(s.slice) - 1], s.slice[:len(s.slice) - 1]

	return
}

// The current size of the stack
func (s *Stack) Size() int {
	return len(s.slice)
}<commit_msg>Fix meaningless comparison<commit_after>// All you need to work with stackgo stacks
//
// For an example usage visit http://github.com/alediaferia/stackgo
package stackgo

type Stack struct {
	slice []interface{}
	blockSize int
}

const s_DefaultAllocBlockSize = 20;

// NewStack Creates a new Stack object with
// an underlying default block allocation size.
// The default is currently 20 but this may vary
// in the future.
// If you want to use a different block size use
//  NewStackWithCapacity()
func NewStack() (*Stack) {
	stack := new(Stack)
	stack.slice = make([]interface{}, 0, s_DefaultAllocBlockSize)
	stack.blockSize = s_DefaultAllocBlockSize

	return stack
}

// NewStackWithCapacity makes it easy to specify
// a custom block size for inner slice backing the
// stack
func NewStackWithCapacity(cap int) (*Stack) {
	stack := new(Stack)
	stack.slice = make([]interface{}, 0, cap)
	stack.blockSize = cap

	return stack
}

// Push pushes a new element to the stack
func (s *Stack) Push(elem interface{}) {
	if len(s.slice) == cap(s.slice) {
		slice := make([]interface{}, 0, len(s.slice) + s.blockSize)
		copy(slice, s.slice)
		s.slice = slice
	}

	s.slice = append(s.slice, elem)
}

// Pop pops the top element from the stack
// If the stack is empty it returns nil
func (s *Stack) Pop() (elem interface{}) {
	if s.Size() == 0 {
		return nil
	}

	elem, s.slice = s.slice[len(s.slice) - 1], s.slice[:len(s.slice) - 1]

	return
}

// The current size of the stack
func (s *Stack) Size() int {
	return len(s.slice)
}
{'fraction_non_alphanumeric': 0.12631578947368421, 'fraction_numerical': 0.006578947368421052, 'mean_word_length': 3.635670731707317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3453100', 'n_tokens_mistral': 1021, 'n_tokens_neox': 969, 'n_words': 364}