[TOC]

This week: scala for imperative programming.

Lecture 3.1 - Functions and State

So far: pure functional programming
→ side-effect free: therefore time doesn't matter.
Any rewriting that terminates lead to the same solution. (Churcher-Rosser Th)



Now: mutable states

Stateful objects: objects can have state that change over time. (state is …

[TOC]

1. BASIC DATA TYPES: int, bool

Rich type system and polymorphism in ocaml. Types are infered not declared.

Basic types: int, bool, float, string, char, ...

int

value: $-2^{62}$ ~ $2^{62}-1$ on 64-bit machines.
ops: +, -, *, /, mod (reminder: / is integer division)

# 3+2*4-1;; 
- : int = 10 
# 5/2 …

[TOC]

Lecture 2.1 - Structural Induction on Trees (optional)

Generalize the structural induction on list to general structures like trees.

To prove a property P(t) for all trees t:
* show for any leave l, P(l) holds
* for each internal node t with subtrees s1...sn, show P(s1 …

[TOC]

上次捣鼓pelican博客系统还是在2012年, 那时farseerfc学长就提供了无私的帮助, 当时非常兴奋写了这么一篇简单的教程.

这两天捣鼓了好久 终于把博客升级到了pelican3...

新的pelican貌似希望使用者把写作的内容和生成的网页分成两个repo管理, 我嫌麻烦还是把它们都放在了一个repo下面: https://github.com/X-Wei/x-wei.github.com 这个repo包含了生成的网页以及我写作的内容(在pelican_dir目录下面).

换了超赞的新皮肤, 这个是farseerfc学长定制的bootstrap3主题, 非常精美. 学长的版本包含了繁简英日翻译以及导出pdf/png什么的按钮, 功能非常全, 不过直接拿来用不太合适, 比如我就不需要博客的日语版... 我实际是用的silverchard对farseerfc学长主题的修改版. 再稍微修改了一下配色什么的...

如果想要做一个类似的博客, 下面是一些步骤:

1. 安装软件

首先安装pelican3以及其他一些python module (另外个人建议新建一个virtualenv在里面搞):

pip install pelican jinja2 py3babel babel beautifulsoup4 …