|
KernelSlanders posted:I was trying to see today if there's a subtle difference between ++ and ::: on List today. Google doesn't like ::: as a search query it seems. These are equivalent code:
|
# ¿ Feb 4, 2015 17:16 |
|
|
# ¿ May 10, 2024 10:09 |
|
Here's an example of slick's "lifted embedding", which basically lets you use SQL as a monad
|
# ¿ Feb 16, 2015 19:54 |
|
JDBC isn't async so slick can't be async (of course you can still wrap the code in Future { ... }). They're working on something for 3.0 which involves replacing JDBC.
|
# ¿ Feb 16, 2015 21:46 |
|
b0lt posted:scalaz owns The symbolic class name is nice because you can use use infix e.g. Int ==>> String. Or if you prefer: type KeyValuePair[A, B] = A ==>> B The symbolic method is just an alias for a named method: code:
|
# ¿ Mar 17, 2015 22:02 |
|
Ruzihm posted:Argh. I am trying to do a "manual install" of sbt, but it's still trying to reach out to the internet. What gives? You could try offline mode
|
# ¿ May 7, 2015 17:58 |
|
Play does support slick. https://www.playframework.com/documentation/2.4.x/PlaySlick There's also Anorm which is a lightweight Slick.
|
# ¿ Jun 5, 2015 05:46 |
|
You can tell slick how to map types when you define your table. You can also extend the Driver and put this stuff in there.code:
|
# ¿ Jun 16, 2015 21:42 |
|
Sure, just change the default valuecode:
|
# ¿ Sep 12, 2015 03:42 |
|
That is odd. I guess I'd prefer if mapValues was eager and Map.view could be used for laziness
|
# ¿ Sep 12, 2015 05:05 |
|
Foo() is short for Foo.apply(), but there's no function with that signature. There's a Foo.apply and a Foo.apply(Seq[Int]).
|
# ¿ Oct 27, 2015 16:41 |
|
The equivalent to IEnumerable<T> is probably TraversableOnce[T]. You generally don't deal with TraversableOnce though because collections APIs return the same type of collection (in C# you always get IEnumerable). If you want the lazy LINQ behavior from C# you can call .view on your collection. Seq[T] has an ordering and a length, and it might be mutable (unless you use immutable.Seq[T]). It's closer to IList<T>. Sedro fucked around with this message at 17:52 on Nov 4, 2015 |
# ¿ Nov 4, 2015 17:49 |
|
Plain old Java reflection will work: x.getClass.getSuperclass
|
# ¿ Nov 5, 2015 01:26 |
|
Right, you would have to repeat all the parameters. You baked in all the defaults as soon as you partially applied Foo. Only methods (Foo) can have default arguments; functions (myFoo) can't. I think you could write a macro.
|
# ¿ Nov 10, 2015 21:22 |
|
Are you storing the database in memory? Try using H2 in persistent mode, or use sqlite.
|
# ¿ Nov 18, 2015 20:54 |
|
You can do sbt x/run -jvm-debug 5005 then attach your remote debugger from Intellij.
|
# ¿ Dec 10, 2015 16:15 |
|
You can use @ to get the whole object for the thing matching the pattern-- the "have your cake and eat it too operator"code:
|
# ¿ Dec 16, 2015 05:22 |
|
Do you need persistence? Reliable delivery? Throttling/backpressure in case of slow consumers? If you don't need the features of a message queue product, don't use one. You can always add it later. There's an example project using akka's distributed pub/sub and sources on github.
|
# ¿ Dec 21, 2015 23:54 |
|
I would avoid infix notation in general and use it only for simple binary expressions where it improves readability:code:
code:
|
# ¿ Jul 20, 2016 16:49 |
|
|
# ¿ May 10, 2024 10:09 |
|
Good Will Hrunting posted:So I have a list of tuples that looks like (a, (b, x)). I want as a result a map of a to (b, x) where x is the greatest x for that given a and b combo. Basically, if the x I'm examining is greater than the greatest x so far for that a as well as that b, update the result map with the a, (b, x) combo. I have legitimately no idea how to approach this. It seems like I should be able to do this with foldLeft, am I crazy? foldLeft is a good approach. You can use a map as an accumulator, keyed by (a, b) tuples. You would start with an empty map, and compare the value of X for each element in your list. If X is greater, add it to the map, otherwise continue. code:
|
# ¿ Oct 25, 2016 03:14 |