Subtracting Arrays

18 views
Skip to first unread message

Chaitra Subramaniam

unread,
Jul 20, 2016, 7:54:50 PM7/20/16
to scala-user
I have two arrays :

X
Array [Double]= Array (1.0,1.75,2.5,3.25,4)

I
Array [Int]=Array(1,1,2,3,4) 

I want to subtract Q from X and get a new Array:

F
Array(0,0.75,0.5,0.25,0) 

How can I get this ? 

Vlad Patryshev

unread,
Jul 21, 2016, 3:48:20 AM7/21/16
to Chaitra Subramaniam, scala-user
X zipWIth I map (_-_)


Thanks,
-Vlad

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages