多巧啊, 人家姓 Curry 名 Haskell, 难怪 Haskell 语言会自动柯里化, 呵呵. 但是不奇怪吗, 为什么要柯里化呢. 为什么如此重要导致 Haskell 会默认自动柯里化所有函数, 不就是返回一个部分配置好的函数吗.
我们来看一个 Haskell 的代码.
max 3 4
(max 3) 4| # using VirtualBox version $VBOX_VERSION | |
| FROM boot2docker/boot2docker | |
| RUN apt-get install p7zip-full | |
| RUN mkdir -p /vboxguest && \ | |
| cd /vboxguest && \ | |
| curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \ | |
| 7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \ | |
| sh VBoxLinuxAdditions.run --noexec --target . && \ |
| # turn dict into an object that allows access to nested keys via dot notation | |
| # from http://stackoverflow.com/questions/3797957/python-easily-access-deeply-nested-dict-get-and-set | |
| # made three modifications: | |
| # --added `get()` method | |
| # --added `if not dict.__contains__...` to `__contains__()` | |
| # --can now accept None as key | |
| class dotdictify(dict): | |
| def __init__(self, value=None): | |
| if value is None: | |
| pass |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| #!/bin/sh | |
| # MongoDB Version | |
| MONGODB_VER='2.2.2' | |
| # Get all the dependencies up to date | |
| yum -y update | |
| yum -y install scons gcc-c++ glibc-devel | |
| # Get the source |
| require.config({ | |
| baseUrl: '/backbone-tests/', | |
| paths: { | |
| 'jquery' : '/app/libs/jquery', | |
| 'underscore' : '/app/libs/underscore', | |
| 'backbone' : '/app/libs/backbone', | |
| 'mocha' : 'libs/mocha', | |
| 'chai' : 'libs/chai', | |
| 'chai-jquery' : 'libs/chai-jquery', | |
| 'models' : '/app/models' |
| /** | |
| add ability to load json fixtures into jasmine | |
| **/ | |
| var readJsonFixtures = function() { | |
| return jasmine.getJsonFixtures().proxyCallTo_('read', arguments); | |
| }; | |
| var preloadJsonFixtures = function() { | |
| jasmine.getJsonFixtures().proxyCallTo_('preload', arguments); |
| <html> | |
| <head> | |
| <title>Line graph over time with multiple data points using SVG and d3.js</title> | |
| <script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
| <style> | |
| body { | |
| font-family: "Helvetica Neue", Helvetica; | |
| } | |
| /* tell the SVG path to be a thin blue line without any area fill */ |