- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
(Set[K], Function1[K,V]) => Map[K,V]
Sun, 2010-06-13, 23:28
Could not find such a constructor... does it exist? Should not it exist? (I believe it should.)
--
Thanks,
-Vlad
--
Thanks,
-Vlad
Tue, 2010-06-15, 15:17
#2
Re: (Set[K], Function1[K,V]) => Map[K,V]
Anyone cares to put few more words around breakOut and betray perhaps its meaning? :)
2010/6/15 Colin Bullock <cmbullock@gmail.com>
2010/6/15 Colin Bullock <cmbullock@gmail.com>
Perhaps you mean something like:
scala> import scala.collection.breakOut
import scala.collection.breakOut
scala> val s = Set(1, 2, 3)
s: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
scala> val m: Map[Int, Int] = s.map(k => (k, k * 10))(breakOut)
m: Map[Int,Int] = Map((1,10), (2,20), (3,30))
- Colin
Tue, 2010-06-15, 15:17
#3
Re: (Set[K], Function1[K,V]) => Map[K,V]
ScalaDoc is here: http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/collection/package.html
for what it's worth :)
On 15 June 2010 15:05, Dimitris Andreou <jim.andreou@gmail.com> wrote:
--
Kevin Wright
mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda
for what it's worth :)
On 15 June 2010 15:05, Dimitris Andreou <jim.andreou@gmail.com> wrote:
Anyone cares to put few more words around breakOut and betray perhaps its meaning? :)
2010/6/15 Colin Bullock <cmbullock@gmail.com>
Perhaps you mean something like:
scala> import scala.collection.breakOut
import scala.collection.breakOut
scala> val s = Set(1, 2, 3)
s: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
scala> val m: Map[Int, Int] = s.map(k => (k, k * 10))(breakOut)
m: Map[Int,Int] = Map((1,10), (2,20), (3,30))
- Colin
--
Kevin Wright
mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda
Tue, 2010-06-15, 15:37
#4
Re: (Set[K], Function1[K,V]) => Map[K,V]
>>>>> "Dimitris" == Dimitris Andreou writes:
Dimitris> Anyone cares to put few more words around breakOut and betray
Dimitris> perhaps its meaning? :)
http://stackoverflow.com/questions/1715681/scala-2-8-breakout
Tue, 2010-06-15, 15:47
#5
Re: (Set[K], Function1[K,V]) => Map[K,V]
Yup, that there is a mighty fine answer :)
On 15 June 2010 15:13, Seth Tisue <seth@tisue.net> wrote:
--
Kevin Wright
mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda
On 15 June 2010 15:13, Seth Tisue <seth@tisue.net> wrote:
>>>>> "Dimitris" == Dimitris Andreou <jim.andreou@gmail.com> writes:
Dimitris> Anyone cares to put few more words around breakOut and betray
Dimitris> perhaps its meaning? :)
http://stackoverflow.com/questions/1715681/scala-2-8-breakout
--
Seth Tisue @ Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--
Kevin Wright
mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda
Tue, 2010-06-15, 15:57
#6
Re: (Set[K], Function1[K,V]) => Map[K,V]
Thanks Seth, that should have been the first (or second) place to look. Scaladoc + breakOut source were unfortunately not too revealing, at least for me.
2010/6/15 Seth Tisue <seth@tisue.net>
2010/6/15 Seth Tisue <seth@tisue.net>
>>>>> "Dimitris" == Dimitris Andreou <jim.andreou@gmail.com> writes:
Dimitris> Anyone cares to put few more words around breakOut and betray
Dimitris> perhaps its meaning? :)
http://stackoverflow.com/questions/1715681/scala-2-8-breakout
--
Seth Tisue @ Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
scala> import scala.collection.breakOut
import scala.collection.breakOut
scala> val s = Set(1, 2, 3)
s: scala.collection.immutable.Set[Int] = Set(1, 2, 3)
scala> val m: Map[Int, Int] = s.map(k => (k, k * 10))(breakOut)
m: Map[Int,Int] = Map((1,10), (2,20), (3,30))
- Colin