由买买提看人间百态

topics

全部话题 - 话题: def
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
m**********g
发帖数: 146
1
来自主题: Rock版 - Def Leppard这个乐队怎么样?
听了一下hysteria,觉得以前有个叫michael learns to rock的不少歌都有学def
lepaard的痕迹在里面啊,而且主唱印象里好像音色也很相似
f****d
发帖数: 3888
2
来自主题: Rock版 - Def Leppard这个乐队怎么样?
88年的时候三大金属乐队同时也是第一次冲击我, 因为他们的"新"专辑。
GNR: Appetite for Destruction
Bon Jovi: New Jersey
Def Leppard: Hysteria
去听听吧,错不了。
Y***r
发帖数: 15270
3
来自主题: Rock版 - Def Leppard这个乐队怎么样?
整个高中时代基本上听着这个乐队过来的,与其说喜欢Def Leppard,
不如说我是Steve Clark的粉丝,他死后我就没在听了。。。
1988年他们在Denver,Colorado的取名为In The Round, In Your Face的演唱会是
Heavy Metal经典中的经典,Steve Clark有精彩绝伦的表演,youtube上面有全套,
Amazon也有卖。。。
q******u
发帖数: 63
4
来自主题: Rock版 - Def Leppard
Annual Def Leppard tour哈哈哈哈
在LA是6月22号,跟Scorpions冲突了 直接略过
l**********n
发帖数: 8443
5
来自主题: Programming版 - scala的def或val是冗余的
Inside a class, val is evaluated on initialization while def is evaluated
only when, and every time, the function is called.
w***g
发帖数: 5958
6
来自主题: Programming版 - scala的def或val是冗余的
大牛你给解释下为什么下面的代码不是语法错误
def inc (x:Int) {x+1}
c******o
发帖数: 1277
7
来自主题: Programming版 - scala的def或val是冗余的
def 的每次调用都会重计算。
val 的只会在定义的时候计算。
lazy val 的只会在第一次用的时候计算。
它们是严格不同的。也很有用。
l**********n
发帖数: 8443
8
来自主题: Programming版 - Def and val has a huge difference
Def is a method, while val is a value.
p*****2
发帖数: 21240
9
来自主题: Programming版 - Def and val has a huge difference

这是我的一条总结
methods (def) for named functions and function literal for anonymous
functions
当然还需要实践中验证。
d*******o
发帖数: 5897
10
我有如下定义
\def \MYDEF {AAA}
我想在正文中输入AAAaaa,用\MYDEFaaa不行,那要如何让aaa能紧跟着\MYDEF呢
类似的问题存在与\abbreviation{\A}{A}{AAA}
我想要AAAaaa,可是aaa不能直接跟着\A,即\Aaaa。
谢谢。
D*C
发帖数: 97
11
似乎LEF中主要是包含了cell/macro的信息。而DEF中包含了cell placement(由
COMPONENTS
语句来定义)和cell之间的连接(由NETS语句来定义)。而具体的布线信息是由什么语
句来
定义的呢?
t********7
发帖数: 26
12
只知道Encounter里面DEF文件只包含placement, floorplan等内容,route是另外的文
I***a
发帖数: 704
13
LEF is library exchange format, it has definition of layers and cells.
DEF is design exchange formt, 包含placement
具体布线信息 is included in GDS2 stream.
h*d
发帖数: 19309
14
Hear "Let's Go," first single from U.K. hard-rock vets' new self-titled LP
Read more: http://www.rollingstone.com/music/news/def-leppards-joe-elliott-on-taylor-swift-donald-trump-and-eighties-pride-20150915#ixzz3lq0rDx6P
Follow us: @rollingstone on Twitter | RollingStone on Facebook
w*******y
发帖数: 60932
15
Yo, I'm thefuryone, and I'm here to say
I found a good price on a game today.
I was chillin' at Target, actin' all cool
When I found the clearance section, like a slickdealin' fool.
Grabbed my phone and snapped a pic quick as I could
To share with other cheapskates on the internet neighborhood.
I'mma upload this, this deal is scary
But your mother effin' mileage may vary.
Diggity Def Jam Rapstar is twenty five bones
Yo, it even includes a microphone, holmes.
Not sure you can tell, but I'm as whi... 阅读全帖
n*********e
发帖数: 25274
16
老德的师傅好像有8次:
Boris Becker's 5-set record is 32-15 (a 68.09 winning percentage).
1985 Wimbledon R32: Boris Becker def. Joakim Nystrom (3-6, 7-6, 6-1, 4-6, 9-
7)
1985 Wimbledon R16: Boris Becker def. Tim Mayotte (6-3, 4-6, 6-7, 7-6, 6-2)
1985 Wembley F: Ivan Lendl def. Boris Becker (6-7, 6-3, 4-6, 6-4, 6-4)
1985 Australian Open R64: Michiel Schapers def. Boris Becker (3-6, 6-4, 7-6,
4-6, 6-3)
1986 French Open R16: Boris Becker def. Emilio Sanchez (6-0, 4-6, 4-6, 6-4,
6-2)
1986 US Open SF: Miloslav ... 阅读全帖
c******o
发帖数: 1277
17
来自主题: Programming版 - 这次Scala没有入选有点意外呀
我写的和它类似,不过是没 implement eq/Ord
sealed trait List[+A]
case object Nil extends List[Nothing]
case class Cons[+A] (head: A, tail: List[A]) extends List[A]
object List {
def apply[A](as: A*): List[A] =
if (as.isEmpty) Nil
else Cons(as.head, apply(as.tail: _*))
private def asString_internal[A](l: List[A]): String =
l match {
case Nil => ""
case Cons(head,tail) => head.toString + " " + asString_internal(tail)
}
def toString[A](l: List[A]): String =
"[ " + asString_... 阅读全帖
H****S
发帖数: 1359
18
来自主题: Programming版 - 看来跳了Scala的坑是对的
monad 其实只需要unit 和 flatmap就够了
zip就是一个flatmap加map的showcase。其实用pattern match也可以。
sealed trait Option[+A] {
def map[B](f: A => B): Option[B]
def isEmpty: Boolean
def get: A
def flatMap[B](f: A => Option[B]) = if (isEmpty) None else f(this.get)
def zip[B](ob: Option[B]): Option[(A, B)] = this flatMap (a => ob map (b =
> (a, b)))
}
case object None extends Option[Nothing] {
override def map[B](f: A => B) = None
override def get: A = throw new Exception("cannot get none")
override def i... 阅读全帖
S*A
发帖数: 7142
19
来自主题: Living版 - 我的无线浇水系统终于上线了
你们有多少人自己刷 router 的 firmware?
硬件需要照片都很明显了。
我用 openwrt firmware 因为开发很方便。
client mode 连入 wireless network.
script 是用 Lua 写的,部分模块也有 Python 版本是因为我不太会
用 lua.
这个是 irrigation caddy 的控制模块 caddy.py, 其他的就是
编程的问题。
import re
import urllib2
import time
class Schedule:
dayname = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
def __init__(self, on=0, days=[], hour=0, min=0, pm=0,
z1=0, z2=0, z3=0, z4=0, z5=0,
z6=0, z7=0, z8=0, z9 = 0):
self.on = on
self.day... 阅读全帖
c******o
发帖数: 1277
20
来自主题: Programming版 - 想学FP最好不要从Scala开始
这个我也看了好几遍,不如书(functional programming in scala) 好懂
我觉得一般来说
functor/monad 最重要
然后看看monoid/foldable (这个最容易)
applicative/traversable,这个我到现在还不是那么懂。。。
arrow/comonad我就完全不懂了。。。
我前一段做的笔记:
trait Semigroup[A] {
def append(x: A, y: A): A
}
List(1,2,3,4).append(List(5)) = List(1,2,3,4,5)
trait Functor[T[_]]{
def map[A,B](ta:T[A])(f:A=>B):T[B]
}
map(List(1,2,3,4))(x=> x.toString) = List("1", "2", "3", "4")
simplest transform, like a foreach in someway
trait Applicative[T[_]] extends Functor[T]{
def unit[... 阅读全帖
c******o
发帖数: 1277
21
来自主题: Programming版 - 这次Scala没有入选有点意外呀
你没看懂我的,我的就是这样,只不过没有把trait 拿出来。。。
再给你贴一个我的练习。
trait Functor[F[_]] {
def map[A,B](t: F[A])(f: A => B): F[B]
}
trait Applicative[F[_]] extends Functor[F]{
def unit[A](a: => A): F[A]
def ap[A,B](fa: F[A])(fab: F[A => B]): F[B]
override def map[A,B](t: F[A])(f: A => B): F[B] = ap(t)(unit(f))
}
trait Monad[F[_]] extends Applicative[F] {
def unit[A](a: => A): F[A]
def flatMap[A,B](ma: F[A])(f: A => F[B]): F[B]
override def ap[A,B](la: F[A])(f: F[A => B]): F[B] =
flatMap(f)(t1 => flatM... 阅读全帖
p*********b
发帖数: 47
22
来自主题: JobHunting版 - 收到G家拒信,发面经
9,Unix file path化简,写code
例如 /a/./b/../../c/ ,化简为 /c/
用stack或者d-queue,有些细节需要考虑,例如 /..//.. 还是输出 /
这题不需要额外的数据结构,从尾部向前反过来做。
我之前写的代码
/* The algorithm runs in O(n) time and O(n) space
* It works backwards so that no stack or other buffer is
* needed to skip the parents folder if a "../" is encountered.
* "//" is preserved as is, and "/./" is changed to "/
* I was able to do a inplace version, but string cut and cat are
* essentially array element revomal, which will make running time
* O(n^2).
*
* My ... 阅读全帖
S**I
发帖数: 15689
23
来自主题: JobHunting版 - [合集] 收到G家拒信,发面经
☆─────────────────────────────────────☆
recursive (递归) 于 (Mon Apr 11 10:56:49 2011, 美东) 提到:
大半夜收到HR的thank you note。不用管什么NDA了
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array with repeated elements
for given element, find out its range.
e.g. A A B B B B B C C D D E F G, given B, the out... 阅读全帖
i*****e
发帖数: 113
24
来自主题: JobHunting版 - google的一道题求解
有点像哪个加减加减的问题
我这个算法对不对,帮忙看看
#!/usr/bin/env python
class Bottle(object):
def __init__(self, point1, point2):
self.point1 = point1
self.point2 = point2
def volume(self):
width = self.point2[0] - self.point1[0]
depth = self.point1[1] \
if self.point1[1] <= self.point2[1] \
else self.point2[1]
return width * depth
def __gt__(self, bottle):
return self.volume() > bottle.volume()
def __lt__(self, bot... 阅读全帖
i*****e
发帖数: 113
25
来自主题: JobHunting版 - google的一道题求解
有点像哪个加减加减的问题
我这个算法对不对,帮忙看看
#!/usr/bin/env python
class Bottle(object):
def __init__(self, point1, point2):
self.point1 = point1
self.point2 = point2
def volume(self):
width = self.point2[0] - self.point1[0]
depth = self.point1[1] \
if self.point1[1] <= self.point2[1] \
else self.point2[1]
return width * depth
def __gt__(self, bottle):
return self.volume() > bottle.volume()
def __lt__(self, bot... 阅读全帖
t******g
发帖数: 10390
26
FPI Chance to Occur
Games With AFC South Implications
Broncos def. Bengals 47.1%
Colts def. Titans 77.6%
Steelers def. Browns 76.5%
Broncos def. Chargers 68.2%
Falcons def. Saints 64.6%
Bills def. Jets 52.1%
Jaguars def. Texans 34.4%
Dolphins def. Patriots 28.0%
Ravens def. Bengals 24.2%
Raiders def. Chiefs 20.1%
* 0.03% chance of all 10 happening
m**d
发帖数: 21441
27
QBASIC - Statements
命令:
BEEP, BLOAD, BSAVE, CALL, CHAIN, CHDIR, CIRCLE, CLEAR, CLOSE, CLS, COLOR,
COM, COMMON, CONST, DATA, DATE$, DECLARE, DEF, DEFDBL, DEFINT, DEFLNG,
DEFSNG, DEFSTR, DIM, DO, DRAW, END, ENVIRON, ERASE, ERROR, EXIT, FIELD,
FILES, FOR, FUNCTION, GET, GOSUB, GOTO, IF, INPUT, IOCTL, KEY, KILL, LET,
LINE, LINE INPUT, LOCATE, LOCK, LPRINT, LSET, MID$, MKDIR, NAME, ON, OPEN,
OPTION, OUT, PAINT, PALETTE, PCOPY, PEN, PLAY, POKE, PRESET, PRINT, PSET,
PUT, RANDOMIZE, READ, REDIM, REM, ... 阅读全帖
k***t
发帖数: 769
28
来自主题: Programming版 - 能帮我看看Ruby的这道题吗?
This question is to define Ruby classes for vectors and matrices.
Define two classes MyVector and MyMatrix with the methods described be-
low.
A MyVector object represents a row vector while a MyMatrix object repre-
sents a matrix that internally organized as an array of MyVector objects.
Methods for MyVector
1. The initialize method takes an array of integers as argument.
2. The length method returns the size of the vector
3. The * method takes an argument a:
if a is a vector, then it returns t... 阅读全帖
c******o
发帖数: 1277
29
来自主题: Programming版 - Scala的map和flatmap什么区别?
从下面的code可以看出,flatMap 可以实现map,所以flatMap更强大(比map能干的事多
), 但是map更常见 (有map不一定能实现flatMap)
// id function:
// def id[A](a: A): A = a
// compose function:
// def compose[A,B,C](f: B => C, g: A => B): A => C =
// a => f(g(a))
trait Functor[F[_]] {
def map[A,B](fa: F[A])(f: A => B): F[B]
}
// Functor Law
// identity: map(x)(id) == x
// composition: map(a)(compose(f, g)) == map(map(a,g), f)
trait Applictive[F[_]] extends Functor[F] {
def unit[A](a: => A): F[A]
def ap[A,B](la: F[A])(f: F[A => B]): F... 阅读全帖
m****r
发帖数: 141
30
I am compiling a LaTeX file with 10 chapters and a table of contents. I have
added the following in the first page.
But why is the table of contents still missing?
thanks !!!
Any help will be appreciated.
This is the main file.
\pdfbookmark[1]{TABLE OF CONTENTS}{table}
\tableofcontents
\addtocontents{toc}{\def\protect\@chapapp{}} \cleardoublepage \
phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{LIST OF
F... 阅读全帖
m****r
发帖数: 141
31
I am compiling a LaTeX file with 10 chapters and a table of contents. I have
added the following in the first page.
But why is the table of contents still missing?
thanks !!!
Any help will be appreciated.
This is the main file.
\pdfbookmark[1]{TABLE OF CONTENTS}{table}
\tableofcontents
\addtocontents{toc}{\def\protect\@chapapp{}} \cleardoublepage \
phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{LIST OF
F... 阅读全帖
f**********t
发帖数: 1001
32
来自主题: JobHunting版 - 一道dropbox面试题
自己先写点抛砖引玉好了,还没写完
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
from collections import defaultdict
from os.path import join, getsize
# Write a basic file system and implement the commands ls, pwd, mkdir ,
# create, rm, cd, cat, mv.
class TreeNode:
def __init__(self, name, isDir):
self.name = name
self.children = defaultdict()
self.isDir = isDir
class FileSystem(object):
def __init__(self):
self.root = TreeNode("", True)
self.cur = ... 阅读全帖
c*******4
发帖数: 51
33
来自主题: JobHunting版 - Simple Database设计问题,附code
详细信息在下面网址:
https://www.thumbtack.com/challenges/simple-database
面试一道题目,题目是设计一个Simple Database,我提交的解法说有问题然后被拒了。
只想各位大神帮我看看code有哪些毛病,feedback说算法不是最优的,function大小写
没有注意。
目前我觉得自己问题在NUMEQUALTO复杂度n不是1,方程都大写了,想请教下还有什么问
题。
下面是我python的代码。再次感谢大家的帮助,我只想知道代码哪里还出了问题。
import sys
class Database(object):
def __init__(self):
self._history = [] #list to store transaction history
self._database = {} #dictionary store key value pair
def BEGIN(self):
self._history.append({})
def S... 阅读全帖
c*******4
发帖数: 51
34
来自主题: JobHunting版 - Simple Database设计问题,附code
详细信息在下面网址:
https://www.thumbtack.com/challenges/simple-database
面试一道题目,题目是设计一个Simple Database,我提交的解法说有问题然后被拒了。
只想各位大神帮我看看code有哪些毛病,feedback说算法不是最优的,function大小写
没有注意。
目前我觉得自己问题在NUMEQUALTO复杂度n不是1,方程都大写了,想请教下还有什么问
题。
下面是我python的代码。再次感谢大家的帮助,我只想知道代码哪里还出了问题。
import sys
class Database(object):
def __init__(self):
self._history = [] #list to store transaction history
self._database = {} #dictionary store key value pair
def BEGIN(self):
self._history.append({})
def S... 阅读全帖
f*******r
发帖数: 976
35
来自主题: JobHunting版 - Simple Database设计问题,附code
这种题目都出来了,难度不小啊

详细信息在下面网址:
https://www.thumbtack.com/challenges/simple-database
面试一道题目,题目是设计一个Simple Database,我提交的解法说有问题然后被拒了。
只想各位大神帮我看看code有哪些毛病,feedback说算法不是最优的,function大小写
没有注意。
目前我觉得自己问题在NUMEQUALTO复杂度n不是1,方程都大写了,想请教下还有什么问
题。
下面是我python的代码。再次感谢大家的帮助,我只想知道代码哪里还出了问题。
import sys
class Database(object):
def __init__(self):
self._history = [] #list to store transaction history
self._database = {} #dictionary store key value pair
def BEGIN(self):
self._history.appe... 阅读全帖
n*********e
发帖数: 25274
36
2000 US Open R128: Roger Federer def. Peter Wessels (4-6, 4-6, 6-3, 7-5, 3-4
ret.)
2001 French Open R64: Roger Federer def. Sargis Sargsian (4-6, 3-6, 6-2, 6-4
, 9-7)
2005 Miami F: Roger Federer def. Rafael Nadal (2-6, 6-7, 7-6, 6-3, 6-1)
2009 Australian Open R16: Roger Federer def. Tomas Berdych (4-6, 6-7, 6-4, 6
-4, 6-2)
2009 French Open R16: Roger Federer def. Tommy Haas (6-7, 5-7, 6-4, 6-0, 6-2)
2010 Wimbledon R128: Roger Federer def. Alejandro Falla (5-7, 4-6, 6-4, 7-6,
6-0)
2012 French Ope... 阅读全帖
j********x
发帖数: 2330
37
来自主题: Programming版 - 转一篇范文
我们来比较一下三种写法,我来阐述一下为什么 A最好,C最烂。
A. 初始化成[]然后“笨拙地”逐个append/extend
B. list(chain(*d.iteritems()))
C. list(sum(d.items(),()))


首先,跟 B 和 C 这样的 one liner 相比,A 这种看起来最“笨拙”、
似乎不怎么 "idiomatic" 的写法,实际上理解起来最容易,
几乎没有什么沟通成本和心智负担。

当然 itertools.chain 也是比较直观的,心智负担也不大。

而 sum(d.items(),()) 的问题,首先在于你要意识到 sum 函数第二个参数的存在,
而且这个参数的默认值是整数0,而不是 None, '', (), [], {} 或 set()。
这给大多数阅读代码的人带来了心智负担,降低了理解速度。


其次,我们来看看执行效率。

下面 benchmark 结果显示,在原 dict 稍大时,
裸写 []-extend 最快,chain 稍次之,sum 则完全不能忍受
——因为累加过程中无谓地生成了很多临时tuples,... 阅读全帖
s****l
发帖数: 129
38
来自主题: Statistics版 - 请教个SAS coding 问题
有一个variable,里面的数据是这样的,
obs column
1 abc|def
2 abc|def|ghi
3 abc|def-ghi|
4 abc|def-ghi|jkl
现在想知道每个数据里被“|”分开的string的数量,也就是下面的结果
obs column num_string
1 abc|def 2
2 abc|def|ghi 3
3 abc|def-ghi| 2
4 abc|def-ghi|jkl 3
(Obs 3 和 4里,def-ghi算一个string)
请教大家这个code应该怎么写?
谢谢
j******g
发帖数: 197
39
来自主题: Statistics版 - 请教两个 excel 问题
not 码农。just have too much free time on my hand...
第一个问题:
附注:
1. 在DEF文件里,打开sheet1, B1 是 要选择的文件名; C1 是 所选文件的路径
2. ABC 和 DEF 文件不需要在同一个文件夹里
3. DEF文件,因为要加入VBA,所以要另存为xlsm
4. 数据源的文件ABC等,不能先打开
打开DEF文件, Hit "Alt+F11", 建个module,Paste the following code:
Sub Mitbbs_Move_Data_Q1()
Workbooks.Open Filename:=Cells(1, 3).Value
Sheets(1).Select
Range(Cells(2, 2), Cells(200, 2)).Select
Selection.Copy
Workbooks("DEF.xlsm").Activate
Sheets(1).Select
Range("B2").Select
ActiveSheet.Paste
End Sub
只打开 DEF.xslm, run thi... 阅读全帖
g***9
发帖数: 159
40
来自主题: JobHunting版 - 攒人品,分享Pinterest面经
第二题公共前缀并不是leetcode原题吧...
请教大牛 rolling hash 的解法 .. ?
自己写了一个Trie的python版本:
import sys
CHAR_COUNT = 26
class Entry(object):
def __init__(self, count=0, next=None):
self.cnt = count
self.nxt = next
#def
#class
class TrieNode(object):
def __init__(self):
self.entrylist = []
for i in xrange(CHAR_COUNT):
self.entrylist.append(Entry())
#for
#def
#class

root = TrieNode()
def InsertTrieNodes(root, curstr):
n = len(curstr)
prefix = []

curnode = root
valid = Tru... 阅读全帖
t********5
发帖数: 522
41
来自主题: JobHunting版 - 关于python interview
代码很乱 凑合看=。=
"""
# 11.33
class Node(object):
def __init__(self, value = None, next = None):
self.value = value
self.next = next

class LinkedList(object):
def __init__(self):
self.head = None
self.size = 0

def __repr__(self):
result = []
tmp = self.head
while tmp is not None:
result.append(tmp.value)
tmp = tmp.next

return str(result)

def append(self, value):
node = Node(value)
if self.head is None:
self.head = node
... 阅读全帖
A*****o
发帖数: 284
42
来自主题: JobHunting版 - G面经 求bless
Bless LZ.
写了个onsite第二轮的python解法, 感觉这题不简单啊...
used = [0 for _ in xrange(10)]
def check(s):
global used
for k in xrange(10):
if used[k] > 1:
return False
return True
def min_unused():
for i in xrange(10):
if not used[i]:
return i
return -1
def add1(l):
global used
n = len(l)
k = c = t = pos = -1
for i in xrange(n-1, -1, -1):
c = l[i]
t = (c+1) % 10
if not used[t]:
pos = i
k =... 阅读全帖
r*********s
发帖数: 2157
43
近些年的, 好像不止是Self choke
1) 1997 – No. 4 Arizona def. No. 1 Kansas, 85-82 (Sweet Sixteen)
This will likely always remain the greatest Kansas team to not win it all.
The Jayhawks didn’t lose to a slouch of an Arizona club, as the Wildcats
ultimately won a surprising national title and did so with the likes of Mike
Bibby, Jason Terry, Michael Dickerson and Miles Simon. Still, KU had four
starters — Paul Pierce, Scot Pollard, Jacque Vaughn and Raef LaFrentz —
who played in the NBA for at least a decad... 阅读全帖
c******o
发帖数: 1277
44
来自主题: Programming版 - Scala的map和flatmap什么区别?
从下面的code 看出。
map能对一个数据(一个List, 一个Option, 一个Future) 进行操作。
applicative (ap) 能对多个数据进行操作。
monad能对对多个数据进行操作的同时,根据数据的内容动态改变操作流程。
基本上functor (map),applicative functor (ap), monad (flatMap)的区别就是这
些。
object test {
def oneVarFunc: Int => Int = {
_ + 1
}
def twoVarFunc: (Int, Int) => Int = {
_ + _
}
def optionap[A,B](a: Option[A])(f: Option[A => B]): Option[B] =
f.flatMap(t1 => a.flatMap(t2 => Some(t1(t2))))
val x1 = Some(1)
val x2 = Some(2)
val x3 = None
//functor
def test... 阅读全帖
n*****2
发帖数: 1432
45
来自主题: _Auto_Fans版 - 为什么很多车评推崇golf?
1)不是所有的柴油车或者TDI没有adblue就不能启动。老捷达就没有adblue。大部分
heavyduty diesel都可以启动。其他的Passanger diesel引擎同样也不会start if DEF
is running out, 包括大切,奔驰,宝马等等。
2)TDI的车型,除了老途锐,其他的拿去越野就是蛋疼。Diesel pick-up才是正道, 那
个压根就不是用2号柴油了。Hwy diesel的话,要找Urea很容易,只要有truck在跑的地
方都能找到urea。而且也不用拖车,搭车去买回来加上就行了。
3)Off road的话,不难找到拖车的,没有这个back up plan,去off road也是蛋疼。
油箱也一样可能磕坏。轮子和轴也可能磕坏。
4)你知道尿素罐位置的话,就不难明白那个要磕漏了有多么不可能了。
5) TDI引擎每次换油的时候,vw dealer都有义务fill up你的Adblue。一般这个都能
持续N个oil change cycle。
6) Good read:
http://www.myturbodiesel.com/threads/e... 阅读全帖
k*******n
发帖数: 5546
46
来自主题: Automobile版 - GLK250(Diesel) 开2年了
请问一下楼主关于加DEF。
我听别人说因为奔驰建议DEF隔几年要更换。所以等DEF用的报警了备好新的DEF,再拖
拖再加满。这样保证新DEF最大化稀释残留老DEF。
有人说前几年的Bluetec车有的有感应器不能Reset,建议在DEF low 报警前比如8000-
10000英里时就自己加满。
c*****m
发帖数: 271
47
来自主题: JobHunting版 - 求問一題G家面經
楼主题目没有描述清楚,看完你的解答才明白完整的题意是什么。我感觉更好的答案是
并查集和树的结合。peer用并查集表示(一个集合里面的都是peer),manager关系用
树的结构表示。构建过程中先用(manager,A,B)先构建树结构;然后再用(peer,A,C)构建
并查集结构(在树中有父结点的是并查集的root)。is_peer(a,b)要么a,b在一个并查
集中,要么两个所属的并查集有相同的manager。is_manager(a,b)就递归地找了。自己
写的测试用例过了,如有不对请指正
class People:
def __init__(self, name):
self.name = name
#parent in tree to represent employee-manager info,
#tree_parent is manager of this person
self.tree_parent = None
#parent in union-find group
... 阅读全帖
d****n
发帖数: 611
48
来自主题: NCAA版 - pac也创造了一项尴尬记录!
有7支球队跳舞。。。
。。。 。。。
。。。 。。。
然后,他们都是被本区低排名的球队淘汰!
13hawaii def. 4cal
2ou def.1uo
10vcu def. 7orsu
9providence def. 8usc
11gonzaga def.3utah
9uconn def.8colorado
11wich st def. 6arizona
l*****n
发帖数: 633
49
来自主题: Tennis版 - 男子这边掉了几个
Marcel Granollers def. Robin Soderling (8) 5-7, 2-6, 6-4, 6-4, 6-2
Santiago Giraldo def. Tommy Robredo (16) 6-4, 6-2, 6-2
Mikhail Youzhny (20) def. Richard Gasquet 6-7 (9-11), 4-6, 7-6 (7-2), 7-6
(7-4), 6-4 (Gasquet最后是不是累了,伤了?)
Ivan Dodig def. Juan Carlos Ferrero (23) 2-6, 1-6, 6-4, 6-1, 6-1
Rainer Schuettler def. Sam Querrey (25) 6-3, 2-6, 6-4, 6-3
Juan Monaco (30) def. Ernests Gulbis 6-3, 7-6 (7-5), 6-1
Marin Cilic (14) def. Fabrice Santoro 7-5, 7-5, 6-3 (next time, 桑神)
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)