Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val x: List[Any]=List(1, List('a, 'b, 'c, 'd))
- def LoopRemoveAt(k:Int):Unit= {
- var y:List[Symbol]=List('a, 'b, 'c, 'd)
- var list=List[Any]()
- var blist=List[Symbol]()
- var f:Symbol=Symbol(1.toString)
- var n:Int=0
- for (i <-x) {
- if (i==y) {
- for(m<-y){
- n+=1
- if (n==k){f=m}
- if (n!=k) blist = blist.:+(m)
- }
- }
- }
- list=list.::(f)
- list=list.::(blist)
- print(list)
- }
- def RecRemoveAt(x: List[Int]): Int = {
- if (x.isEmpty) throw new Exception("Empty list")
- else if (x.tail.isEmpty) x.head
- else RecRemoveAt(x.tail)
- }
- LoopRemoveAt(3)
- RecRemoveAt
Advertisement
Add Comment
Please, Sign In to add comment