`
lobin
  • 浏览: 116436 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
Rss 文章列表
scheme def, let and bind > (let () ()) $30 = () 返回一个空的form: () > (list? (let () ())) $31 = #t list?检查返回的()是否是一个列表, 这里认为()是一个空列表。 > () $32 = () > (list? ()) $33 = #t > (define x     (let       ((a "this is a"))       a)) > x $22 = "this is a" javascript: let fx2 = ...
The symbolic, non-executable form of a method handle's invocation semantics. It consists of a series of names. The first N (N=arity) names are parameters, while any remaining names are temporary values. Each temporary specifies the application of a function to some arguments. The functions are method ...
import org.junit.{Before, BeforeClass, Test} import org.scalatest.junit.JUnitSuite import scala.util.control.{Breaks, ControlThrowable} private class BreakControl extends ControlThrowable object ScalaBreaksTest {   @BeforeClass   def _init : Unit = {   } } class ScalaBreaksTest extends JUnitSuite {   ...
import org.junit.{Before, BeforeClass, Test} import org.scalatest.junit.JUnitSuite import scala.util.control.{Breaks, ControlThrowable} import scala.util.control.Breaks._ private class BreakControl extends ControlThrowable object BreaksTest {   @BeforeClass   def _init : Unit = {   } } class BreaksTe ...
> val fx1 = (x: Int) => x + 1 fx1: Int => Int = $$Lambda$1059/1521946103@6764201e > fx1(1) res7: Int = 2 > def fx2 = (x: Int) => x + 1 fx2: Int => Int > fx2(2) res8: Int = 3 > def fx3(x: Int) = x + 1 fx3: (x: Int)Int > fx3(3) res9: Int = 4 其在形式定义上和J8类似: Plus xpy = (xx, y ...
def swallow(log: (Object, Throwable) => Unit, action: => Unit) {   try {     action   } catch {     case e: Throwable => log(e.getMessage(), e)   } }
object CurryingTest {   def summary() {   println("---summary start---")   println("--- summary end ---")   }     def details() {     println("---start usage start---")   println("--- start usage end ---")     println("---restart usage start---" ...
object CurryingTest {   def summary() {   println("---summary start---")   println("--- summary end ---")   }     def details() {     println("---start usage start---")   println("--- start usage end ---")     println("---restart usage start---" ...
语法 Expr1 ::= ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’)                      {nl} [‘yield’] Expr Enumerators ::= Generator {semi Generator} Generator ::= Pattern1 ‘<-’ Expr {[semi] Guard | semi Pattern1 ‘=’ Expr} Guard ::= ‘if’ PostfixExpr 例子 ForTest.scala object ForTest extends App {   ...
list   user=> '(1 2 3 4 5 6) (1 2 3 4 5 6) user=> (list) () user=> (list 1 2 3 4 5 6) (1 2 3 4 5 6) user=> (list* 1 2 3 4 5 6 '(7 8 9)) (1 2 3 4 5 6 7 8 9)   user=> (list? '(1 2 3 4 5 6)) true   vector user=> [1 2 3 4 5 6] [1 2 3 4 5 6] user=> (vector) [] use ...
lambda         lambda 在计算机编程语言中,如Lisp,Python和Ruby, λ是一个算子,用于表示匿名函数或者闭包,后跟λ演算的用法。 在C#编程语言中,一个λ表达式是一个包含表达式和语句的匿名函数。 非λ语言是一种基于组合逻辑的函数式编程语言,一个简单化的λ演算并不包含λ所有的内容,   lambda term   一个有效的lambda表达式被称为lambda term。 规则: 一个变量x,那么它自己(x)就是一个有效的lambda term; 如果t是一个lambda term,并且x是一个变量,那么(λx.t)也是一个lamb ...
  class TestClass(var arg1: Int, var arg2: Int) { def init() = { arg1 = 0; arg2 = 2; } } >scalac TestClass.scala   >javap -c TestClass Compiled from "TestClass.scala" public class TestClass {   public int arg1();     Code:        0: aload_0   ...
Global site tag (gtag.js) - Google Analytics