(Set[K], Function1[K,V]) => Map[K,V]

Could not find such a constructor... does it exist? Should not it exist? (I believe it should.)

--
Thanks,
-Vlad

Re: (Set[K], Function1[K,V]) => Map[K,V]

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

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 [at] gmail [dot] 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

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

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 [at] tisue [dot] net>
>>>>> "Dimitris" == Dimitris Andreou <jim [dot] andreou [at] gmail [dot] 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/

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 [at] tisue [dot] net> wrote:
>>>>> "Dimitris" == Dimitris Andreou <jim [dot] andreou [at] gmail [dot] 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 [dot] lee [dot] wright [at] gmail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda

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 [dot] andreou [at] gmail [dot] com> wrote:
Anyone cares to put few more words around breakOut and betray perhaps its meaning? :)

2010/6/15 Colin Bullock <cmbullock [at] gmail [dot] 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 [dot] lee [dot] wright [at] gmail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland