0

Please help me with any better solution to find same elements in them same order on any two lists.

q)list3:(`red`green`black`orange)
q)list4:(`red`pink`green`white`black)
q)list5:(`white`orange`pink`black)

q)r:(inter/)(list3;list4)
q)all (list3?r) <= list4?r
1b

q)r:(inter/)(list4;list5)
q)all (list4?r) <= list5?r
0b

1 Answer 1

1

You can try something like this:

q){i~x inter i:y inter x}[list4;list5]
0b
q){i~x inter i:y inter x}[list3;list4]
1b
q){i~x inter i:y inter x}[list4;list3]
1b
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.