Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val llist=
- {
- def zmien(s1:Stream[Int],s2:Stream[Int],mark:String):Stream[Int]=
- {
- val p1#::xs1 =s1
- val p2#::xs2=s2
- mark match {
- case "+" => (p1+p2)#::zmien(xs1,xs2,"+")
- case "-" => (p1-p2)#::zmien(xs1,xs2,"-")
- case "*" => (p1*p2)#::zmien(xs1,xs2,"*")
- case "/" => (p1/p2)#::zmien(xs1,xs2,"/")
- }
- }
- zmien(Stream.from(1),Stream.from(5),"+")
- // zmien(Stream.from(1),Stream.from(5),"-")
- // zmien(Stream.from(1),Stream.from(5),"*")
- // zmien(Stream.from(1),Stream.from(5),"/")
- }
- llist.take(5).toList
Advertisement
Add Comment
Please, Sign In to add comment