(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /** | |
| * Examples of writing mixed unit/property-based (ScalaCheck) tests. | |
| * | |
| * Includes tables and generators as well as 'traditional' tests. | |
| * | |
| * @see http://www.scalatest.org/user_guide/selecting_a_style | |
| * @see http://www.scalatest.org/user_guide/property_based_testing | |
| */ | |
| import org.scalatest._ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.
yield keyword is used to aggregate values in the resulting structure.
This composition can be used on any type implementing this methods, like List, Option, Try, Future...
| # First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1 | |
| # have recently been fixed. | |
| # | |
| # Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install | |
| # a newer one with homebrew or the rvm pkg command. | |
| # Option 1, with homebrew openssl: | |
| brew update | |
| brew install openssl |
| #!/usr/bin/env sh | |
| brew update | |
| brew install rbenv | |
| brew install ruby-build | |
| brew install openssl | |
| CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.0.0-preview1 |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs