Good morning everyone (or good evening :)), I have problem with checking if one list is segment of second one. All elements of first list must be the first elements of second list.
For example
L1=[1,2,3,4]
L2=[3,4,5,6]
>false
L1=[1,2,3,4]
L2=[1,2,3,4,5,6,7,8]
>true
L1=[-1,-7,3,2]
L2=[1,2,3,4,5]
>false
I know it would be easy to use loop and then comparing elements, but i want to do it in functional way. I had idea, but it was not clever, to stick both lists (with zip, for example), then unzip it, chenge to set and compare if it has the same length then second list, but that method do not look good.
I'm new in Scala, so sorry for propably stupid question. I don't please for code, but for some advices! :)
Thanks guys!