Reputation: 121
I want to use the bitwise-and function to get the biggest bitwise result for combinations of elements inside a list. The problem is bitwise-and function requires (n ...) integers but combinations function return list. How can I pass the list to the bitwise-and function?
This is my code:
(for-each (lambda (arg)
(printf "Got ~a\n" (bitwise-and arg)))
(combinations '(1 2 3 4 5))))
Upvotes: 0
Views: 84
Reputation: 7568
You should use apply
:
(for-each (lambda (arg)
(printf "Got ~a\n" (apply bitwise-and arg)))
(combinations '(1 2 3 4 5)))
Upvotes: 2