Question: Select from two lists to make another list

I am trying to select from a default list and a modified list to get a third combined list of the unmodified default elements and the mdfified elements plus extra elements. This is for plot data. I have managed to extract the colour data using something I did a couple of years ago. Though at this stage I don't relly know how that works either but it works.

restart

with(ListTools)

[BinaryPlace, BinarySearch, Categorize, Classify, Collect, Deal, DotProduct, Enumerate, FindMaximalElement, FindMinimalElement, FindRepetitions, Flatten, FlattenOnce, Group, Interleave, InversePermutation, Join, JoinSequence, LengthSplit, MakeUnique, Occurrences, Pad, PartialSums, Reverse, Rotate, Search, SearchAll, SelectFirst, SelectLast, Slice, Sorted, Split, Transpose, Unpermute]

(1)

PlotDefaults:=['colour' = ':-blue', symbol = ':-solidcircle', ':-symbolsize' = 8,thickness=2]; #for points and lines

[colour = blue, symbol = solidcircle, symbolsize = 8, thickness = 2]

(2)

Inputs:=['color'=[red, black, blue],symbol=square,':-linestyle'=dash]; #'color'=[red, black, blue],

 

[color = [red, black, blue], symbol = square, linestyle = dash]

(3)

if has(Inputs,{colour,color}) then
Colourlist:=remove(has,remove(has,Flatten(eval([':-color',':-colour'],Inputs)),':-colour'),':-color')
else
Colourlist:=remove(has,remove(has,Flatten(eval([':-color',':-colour'],PlotDefaults)),':-colour'),':-color');
end if

[red, black, blue]

(4)


Make this list

plotdata:=[symbol=square,':-linestyle'=dash,':-symbolsize' = 8,thickness=2]

[symbol = square, linestyle = dash, symbolsize = 8, thickness = 2]

(5)

mx:=max(nops(PlotDefaults),nops(Inputs))

4

(6)

Plotdata:=[];
for i to mx do

end do

 

 

[]

(7)
 

 

Download 2026-05-18_Q_Select_from_Two_Lists_to_get_New_List.mw

Please Wait...