Define list as
>val l=List(9,8,89,900)
to get first element
> l.head
to get elements except first
>l.tail
to get lat element
>l.last
to get length
>l.length
to get n'th element(n:Int)
>l(n)
to append 2 lists 'l' and 'k'
>l++k
to get difference(display the elements in 'l' not in 'k')
>l.diff(k)
to drop n elements (n:Int)
> l.drop(n)
drop n elements from right
> l.dropRight(2)
>val l=List(9,8,89,900)
to get first element
> l.head
to get elements except first
>l.tail
to get lat element
>l.last
to get length
>l.length
to get n'th element(n:Int)
>l(n)
to append 2 lists 'l' and 'k'
>l++k
to get difference(display the elements in 'l' not in 'k')
>l.diff(k)
to drop n elements (n:Int)
> l.drop(n)
drop n elements from right
> l.dropRight(2)
No comments:
Post a Comment