functional programming - Multiple arguments to mapcar -


i'm sure beginner question in lisp, learning language.

i have function in clisp called count. counts number of times given atom appears in list. i'd able call count multiple times different parameters, same list search.

for example, i'd count number of 'a, 'b, , 'c in list, hypothetically. hoping this:

(mapcar 'count '(a b c) mylist) 

i've figured out doesn't work because each of elements in '(a b c) being paired 1 of elements in mylist. appropriate idiomatic way apply function additional input parameter each item in list?

to further clarify, i'd able take '(a b c) , '(a b c c c) input , produce (2 1 3).

to call function count repeatedly each item list (a b c), every time counting matching items same sequence mylist:

(mapcar (lambda (x) (count x mylist)) '(a b c)) 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -