Wednesday, October 19, 2011

live with gnome-shell

开始使用gnome-shell了(被逼的).默认配置有诸多不爽之处(对我来说),记录一下:

1 窗口没有最小化按钮了,虽然你可以在窗口顶栏右键,但我很不习惯.
sol: $gconf-editor
然后把"/desktop/gnome/shell/windows/button_layout" 改成":minimize,maximize,close" (默认是":close")

ref: http://www.webupd8.org/2011/03/how-to-add-minimize-and-maximize.html

2 没有任务栏了
解决中...

Sunday, October 02, 2011

Currying in ML, Python, Javascript

ML

SMLNJ为例.
- fun sum x y = x + y;
val sum = fn : int -> int -> int
- val sum2 = sum 2;
val sum2 = fn : int -> int
- sum2 10;
val it = 12 : int

Python

可以使用functools来实现curry
>>>from functools import partial
>>>def sum(x,y): return x + y
>>>sum2 = partial(sum, 2)
>>>sum2
<functools.partial object at 0x1f2de0>
>>>sum2(10)
12

JavaScript

http://www.svendtofte.com/code/curried_javascript/