start new:
tmux
start new with session name:
tmux new -s myname
package flux | |
/** | |
* Created by IntelliJ IDEA. | |
* User: xf | |
* Date: 14/10/20 | |
* Time: 下午5:49 | |
*/ | |
trait Payload[T] { |
import tools.nsc.interpreter.IMain | |
import tools.nsc.Settings | |
object CommaSeperatedData extends App { | |
val data = """ "Doe, John", 35, 225, "5'10\"", "555-0123" """ | |
val settings = new Settings | |
settings.usejavacp.value = true | |
val n = new IMain(settings) | |
n.interpret("List(" + data + ")") |
realm=Sonatype Nexus Repository Manager | |
host=nexus.company.com | |
user=admin | |
password=admin123 |
def name2id1(name: String): Option[String] = name match { | |
case "name1" => Some("id1") | |
case "name2" => Some("id2") | |
case "name3" => Some("id3") | |
case _ => None | |
} | |
def name2id2(name: String): Option[String] = name match { | |
case "name1" => None | |
case "name2" => Some("id2") | |
case "name3" => Some("id3") |
import util._ | |
abstract class SrcProtocol(val id: String) | |
case class CompileSrc(override val id:String) extends SrcProtocol(id) | |
case class TestSrc(override val id:String) extends SrcProtocol(id) | |
case class SystemSrc(override val id:String) extends SrcProtocol(id) | |
abstract class DstProtocol(val id: String) |
先从简单的情况入手,假设 f1 的类型是 A => B, 看看
f2 andThen {
_ andThen f1
}
到底是什么意思 先去掉语法糖,完整形式为:
/* | |
* Copyright (C) 2013 Square, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
@annotation.tailrec | |
def isSorted[A](as: Seq[A], ordered: (A, A)=>Boolean):Boolean = { | |
as match { | |
case Seq() => true | |
case Seq(_) => true | |
case Seq(head, second, rest@_*) => | |
ordered(head, second) && isSorted(second +: rest, ordered) | |
} | |
} |
def bubbleSort[A: Ordering](xs: List[A]): List[A] = { | |
@annotation.tailrec | |
def bubble(ys: List[A], init: List[A], max: A): (List[A], A) = ys match { | |
case Nil => (init, max) | |
case h :: tail => | |
if(implicitly[Ordering[A]].compare(h, max) > 0) | |
bubble(tail, max::init, h) | |
else |