Google also have their own C++ Style Guide that you may find more useful.
I do not use C++.
Pros:
| externalResolvers <<= resolvers map { rs => | |
| Resolver.withDefaultResolvers(rs, scalaTools = false) | |
| } |
| /* | |
| * Referentially transparent program to print the size of files. | |
| * | |
| * Techniques inspired by: | |
| * "Dead-Simple Dependency Injection" | |
| * Rúnar Óli Bjarnason | |
| * Northeast Scala Symposium, 2012 | |
| * | |
| * To run: "scala filesizerer.scala" | |
| * When prompted, enter a file name. |
| -- Inspired by http://nedbatchelder.com/blog/201301/stupid_languages.html | |
| -- which describes how the Javascript array.map function seems weird | |
| -- and also http://blog.sigfpe.com/2008/03/comonadic-arrays.html | |
| -- which describes the comonad for arrays | |
| import Data.Array | |
| import Data.Char | |
| class Functor w => Comonad w where | |
| (=>>) :: w a -> (w a -> b) -> w b |
| import java.net.URI | |
| /** | |
| * State co-monad. | |
| * | |
| * `Store[F, _]` is the co-monad. | |
| */ | |
| final case class Store[F, R](get: F, set: F => R) { | |
| def map[S](f: R => S): Store[F, S] = Store(get, f compose set) |
| import qualified Data.Map as Map | |
| -- Find the most frequently occurring item that occurs more than once | |
| -- Idea from http://skipoleschris.blogspot.com.au/2010/11/functional-programming-challenge-most.html | |
| most :: Ord a => [a] -> Maybe a | |
| most xs = fst $ foldl most' (Nothing, Map.empty) xs where | |
| most' (winning, seen) x = (winning', seen') where | |
| winning' = if count > winningCount then Just x else winning |
| import java.util.*; | |
| import java.util.stream.Stream; | |
| /** | |
| * Find the most frequently occurring item that occurs more than once. | |
| * Idea from http://skipoleschris.blogspot.com.au/2010/11/functional-programming-challenge-most.html | |
| */ | |
| public final class Most { |
| final case class Outer(inner: Outer#Inner) { | |
| final case class Inner(a: String) | |
| } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <title>Functional I/O Demo</title> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.0.min.js"></script> | |
Google also have their own C++ Style Guide that you may find more useful.
I do not use C++.
Pros:
I hereby claim:
To claim this, I am signing this object: