Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Fullets
Feb 5, 2009
At my work we're using it pretty heavily for the various services surrounding our big, traditional, J2EE applications. To a lesser extent the J2EE apps are using it a bit too but the real adoption has been in backend web services. People do tend to either like it a lot more than Java or hate it utterly, but one interesting pattern that's happened is that teams that have used Scala and decide it doesn't work for them don't go back to Java; they either explore other FP-on-the-JVM things like Clojure or in a couple of cases have just switched to Haskell.

There are a couple of people I've talked to that are using it for big dataish stuff and seem to like it in that role.

It does quite remind me of C++ in regards to all the pointless minutiae that you have to learn to massage what you actually wanted to write into something that the compiler won't vomit back into your face. A lot of this isn't language complexity per se, though, so much as it is the compiler not being very good.

Adbot
ADBOT LOVES YOU

Fullets
Feb 5, 2009
Rather than using foldLeft and reverse I'd be inclined to use foldRight as that'll be doing the same under the hood (for lists). It permits a slightly simpler version (which also has the benefit of not blowing up on empty input strings):

code:
"foocookie!!!".toList.foldRight(List.empty[(Char, Int)]) {
  case (ch, (lch, co) :: t) if ch == lch => (lch, co+1) :: t
  case (v, t) => (v,1) :: t
}

Fullets
Feb 5, 2009
I guess the other point of note with foldRight is that if you were to switch from List to Stream or some other non strict data structure then you can run the computation lazily which on big data sets doesn't mean you have to have the whole thing in memory at the same time.

Fullets
Feb 5, 2009
Ah, you're quite right – I was thinking of something like the following, which seems well behaved re: the stack and is lazy but, after further thought, doesn't seem to be representable as a right fold.

code:
def countRuns[A: Equal](fa: Stream[A]): Stream[(A, Int)] = {
  def impl(fai: Stream[(A, Int)]): Stream[(A, Int)] =
    fai match {
      case (ap@(a, m)) #:: (bp@(b, n)) #:: t =>
        if (a === b) impl((a, m + n) #:: t)
        else ap #:: impl(bp #:: t)
      case t => t
    }
  impl(fa.strengthR(1))
}

Fullets
Feb 5, 2009
I guess Hystrix might be another option for making blocking calls less blocky. You'd also get circuit breaking.

On that subject has anyone had any experience with Hystrix/Akka circuit breaker/other things of that ilk?

Fullets
Feb 5, 2009

good jovi posted:

scalaz stuff is so cool, but man, gently caress operators. Why did they have to port Haskell's worst parts along with its best? Just name your goddamn methods with letters. There's a whole bunch of them right under your fingers! And they mean stuff!

I guess they're imagining people who want non-symbolic names would use the IMap alias and move on with their lives? :shrug:

Fullets
Feb 5, 2009

KernelSlanders posted:

Cake pattern is terrible. I don't understand why anyone would chose it over constructor injection.

The rationale in Odersky's talk is that interfaces (well, traits) simply can't express the type constraints he required without casting, and he (unsurprisingly) preferred type safety. Although IIRC, Dotty's gone with a different abstraction.

It is quite useful in those situations but some people decided it should be used for everything.

Adbot
ADBOT LOVES YOU

Fullets
Feb 5, 2009
Most of the stuff I've seen uses Seq or F[_]: Whatever depending on whether it's functional or not. I wouldn't be enormously surprised though to discover that requiring lists had be come an idiom somewhere.

  • Locked thread