Pabl0o0

Untitled

Nov 13th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1.  
  2. val llist=
  3. {
  4. def zmien(s1:Stream[Int],s2:Stream[Int],mark:String):Stream[Int]=
  5. {
  6. val p1#::xs1 =s1
  7. val p2#::xs2=s2
  8. mark match {
  9. case "+" => (p1+p2)#::zmien(xs1,xs2,"+")
  10. case "-" => (p1-p2)#::zmien(xs1,xs2,"-")
  11. case "*" => (p1*p2)#::zmien(xs1,xs2,"*")
  12. case "/" => (p1/p2)#::zmien(xs1,xs2,"/")
  13. }
  14.  
  15. }
  16. zmien(Stream.from(1),Stream.from(5),"+")
  17. // zmien(Stream.from(1),Stream.from(5),"-")
  18. // zmien(Stream.from(1),Stream.from(5),"*")
  19. // zmien(Stream.from(1),Stream.from(5),"/")
  20. }
  21. llist.take(5).toList
Advertisement
Add Comment
Please, Sign In to add comment