A law is a group of two or more expressions which are required to be the same. The expressions will usually involve one or more typed holes ("inputs") which vary.
Some examples:
x.map(id) === x| /* ADS1256 simple library for Arduino | |
| ADS1256, datasheet: http://www.ti.com/lit/ds/sbas288j/sbas288j.pdf | |
| connections to Atmega328 (UNO) | |
| CLK - pin 13 | |
| DIN - pin 11 (MOSI) | |
| DOUT - pin 12 (MISO) | |
| CS - pin 10 | |
| DRDY - pin 9 | |
| RESET- pin 8 (or tie HIGH?) |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x| #!/bin/sh | |
| SOC_USB=/sys/devices/platform/soc/20980000.usb | |
| if [ ! -d $SOC_USB ]; | |
| then | |
| SOC_USB=/sys/devices/platform/soc/3f980000.usb # Raspberry Pi 3 | |
| fi | |
| BUSPOWER=$SOC_USB/buspower |
| sealed trait RegExp { | |
| def isFinal:Boolean | |
| def acceptsEmpty:Boolean | |
| def shift(prev:Boolean, character:Char):RegExp | |
| def matches(str:String) = | |
| if(str.isEmpty) this.acceptsEmpty | |
| else str.foldLeft(this.shift(true, str.head))(_.shift(false,_)).isFinal | |
| } | |
| object Epsilon extends RegExp { |
| String.format() call with mismatched args | |
| Unused function argument | |
| aList.length == 0 <- use .isEmpty | |
| Using string interpolation unnecessarily | |
| Calling .toString on Array | |
| Close scala.io.Source | |
| Inferring Nothing | |
| Casting instead of .toByte | |
| Calling .toSeq on a Seq | |
| Calling .toString on a String |
| TargetVersion: Scala 2.11 LastVersion: Scala 2.10 | |
| 86 libraries available for Scala 2.11 (see the end for sbt config lines) | |
| akka-actor 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more] | |
| akka-stream 57 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [52 more] | |
| akka-http-core 51 versions: 3.0.0-RC1, 2.4.9, 2.4.9-RC2, 2.4.9-RC1, 2.4.8, ... [46 more] | |
| akka-http 29 versions: 3.0.0-RC1, 10.1.8, 10.1.7, 10.1.6, 10.1.5, ... [24 more] | |
| akka-osgi 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more] | |
| akka-slf4j 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more] | |
| akka-testkit 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more] |
| val compile = { | |
| import tools.reflect.ToolBox | |
| val c = reflect.runtime.currentMirror | |
| val tb = c.mkToolBox() | |
| (src: String) => tb compile (tb parse (imports+src)) | |
| } |
| scala> import scala.language.experimental.macros | |
| import scala.language.experimental.macros | |
| scala> import scala.reflect.macros.{ Context, TypecheckException } | |
| import scala.reflect.macros.{Context, TypecheckException} | |
| scala> object NoncompilationTests { | |
| | def compiles(code: _): Boolean = macro compiles_impl | |
| | def compiles_impl(c: Context)(code: c.Tree) = c.literal( | |
| | try { |