I've been recently dealing with a nested for loops in SBCL. I discovered, that operations, which can be reduced to map, can easily be made parallel using pmap (or any similar function). I decided to try and make my double for loop parallel in the following way:
Basic loops:
(loop for element in list_of_lists
do (loop for element2 in list_of_lists2
...(random_function element element2)))
And this works fine, yet I was wondering if something like:
(defun supplementary_function (single_list list_collection)
"This function iterates through list_collection and executes (random_function) on pairs obtained"
(loop for element in list_collection
do (random_function single_list element)))
(map 'nil (lambda (x) (supplementary_function x list_of_lists2)) list_of_lists1)
I would like to this for performance boost, as map in this case can easily be replaced with pmap in my case. So to clarify a bit more, the question is:
Can one replace the first loop with map, where in each map operation, second loop is executed within a special function of some sort using a single element from first loop and whole second loop. I see no conceptual mistake as to why this should not be possible, yet it throws me some memory errors (?)
Thank you very much!