<commit_before>// Copyright 2014 SteelSeries ApS.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This package implements a basic LISP interpretor for embedding in a go program for scripting.
// This file contains the association list primitive functions.

package golisp

import ()

func RegisterAListPrimitives() {
	MakePrimitiveFunction("acons", "2|3", AconsImpl)
	MakePrimitiveFunction("pairlis", "2|3", PairlisImpl)
	MakePrimitiveFunction("assoc", "2", AssocImpl)
	MakePrimitiveFunction("dissoc", "2", DissocImpl)
	MakePrimitiveFunction("rassoc", "2", RassocImpl)
	MakePrimitiveFunction("alist", "1", AlistImpl)
}

func AlistImpl(args *Data, env *SymbolTableFrame) (result *Data, err error) {
	l := Car(args)
	result = Alist(l)
	return
}

func AconsImpl(args *Data, env *SymbolTableFrame) (result *Data, err error) {
	key := First(args)
	if PairP(key) {
		err = ProcessError("Alist key can not be a list", env)
		return<commit_msg>Add assq and assv as synonyms of assoc<commit_after>// Copyright 2014 SteelSeries ApS.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This package implements a basic LISP interpretor for embedding in a go program for scripting.
// This file contains the association list primitive functions.

package golisp

import ()

func RegisterAListPrimitives() {
	MakePrimitiveFunction("acons", "2|3", AconsImpl)
	MakePrimitiveFunction("pairlis", "2|3", PairlisImpl)
	MakePrimitiveFunction("assq", "2", AssocImpl)
	MakePrimitiveFunction("assv", "2", AssocImpl)
	MakePrimitiveFunction("assoc", "2", AssocImpl)
	MakePrimitiveFunction("dissoc", "2", DissocImpl)
	MakePrimitiveFunction("rassoc", "2", RassocImpl)
	MakePrimitiveFunction("alist", "1", AlistImpl)
}

func AlistImpl(args *Data, env *SymbolTableFrame) (result *Data, err error) {
	l := Car(args)
	result = Alist(l)
	return
}

func AconsImpl(args *Data, env *SymbolTableFrame) (result *Data, err error) {
	key := First(args)
	if PairP(key) {
		err = ProcessError("Alist key can not be a list", env)
		return
{'fraction_non_alphanumeric': 0.11508120649651972, 'fraction_numerical': 0.012064965197215777, 'mean_word_length': 5.341176470588235, 'pattern_counts': {'":': 0, '<': 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': '4365327', 'n_tokens_mistral': 701, 'n_tokens_neox': 686, 'n_words': 232}