Rustのパターンマッチの話
既に穴だらけですが、やれるだけやっていきます。今回はパターンマッチの話です。
TL;DR(経験者向け)
はい、あなたのよく知るパターンマッチです。ガードも使えますが、他の言語でガードを使うパターンの一部はOCamlのorパターンと同等の機能や範囲を表す機能によって置き換えることができます。
Rust Advent Calendar 2013、空きが多くて申し訳ありませんでした。もう少し書けるかと思っていましたが、できませんでした。今日は数日前から手を入れているgentoo-rustの話をします。
Gentoo LinuxのパッケージシステムPortageでRustをインストール、管理するためのファイルを置いているオーバーレイ(追加のパッケージファイル集)がgentoo-rustです。既にapp-portage/laymanを導入していればlayman -a gentoo-rustでgentoo-rustに入っているebuildを使えるようになる、というのは`21日目の記事`_で既に述べられている通りです。
これまでgentoo-rustを使わずに自前のebuildを使ってきましたが、別々に作業するよりも合流した方が良いと考え、gentoo-rustを導入してpull requestを送るようにしました。すると、ひっきりなしに届く私のpull requestに辟易したのかもしれませんが、メンテナのHeather氏からpull権限をいただいたので小さな変更をいくつか直接コミットしました。
現在、dev-lang/rustはemacsやvim-syntaxUSEフラグで対応するエディタのシンタックスハイライト等のサポートをインストールします。また、zsh-completionUSEフラグでrustcのオプションをzshのコマンドラインで補完するためのスクリプトをインストールします。すでにgentoo-rustをlaymanで導入している方はlayman -s gentoo-rustしてからemergeしてください。
- 無我
- the Buddhist doctrine of non-self, meaning that eternal and invariant self, or soul, is illusory
I hereby claim:
To claim this, I am signing this object:
class Node | |
attr_accessor :symbol, :score, :my_turn, :children, :visited | |
def initialize(symbol, score, my_turn, children) | |
@symbol = symbol | |
@score = score | |
@my_turn = my_turn | |
@children = children | |
@visited = false | |
end |
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ] && [[ $- =~ i ]]; then | |
tmux attach-session -t "$USER-ssh" 2> /dev/null || tmux new-session -s "$USER-ssh" || exit $? | |
exit | |
fi |
processor : 0 | |
vendor_id : GenuineIntel | |
cpu family : 6 | |
model : 14 | |
model name : Genuine Intel(R) CPU U1300 @ 1.06GHz | |
stepping : 8 | |
microcode : 0x39 | |
cpu MHz : 800.000 | |
cache size : 2048 KB | |
physical id : 0 |
#!/usr/bin/env python3 | |
def get_temp(socket_id): | |
thermal_zone = '/sys/class/thermal/thermal_zone' + socket_id | |
with open(thermal_zone + '/temp') as temp: | |
return int(temp.read()) / 1000.0 # + 273.15 | |
if __name__ == '__main__': | |
import json | |
import sys |
aliBuild can take the following packages from the system and will not build them: | |
FreeType | |
The following packages cannot be taken from the system and will be built: | |
Python-modules, sqlite, CMake, protobuf, Python, GCC-Toolchain, nanomsg, libpng, ZeroMQ, autotools, boost, GSL | |
Packages will be built in the following order: | |
- defaults-o2-daq@v1 | |
- autotools@v1.5.0 | |
- sqlite@v3.15.0 | |
- GCC-Toolchain@v6.2.0-alice1 | |
- ZeroMQ@v4.1.5 |
\documentclass[unicode]{beamer} | |
\usepackage[no-math,ipaex]{luatexja-preset} | |
\renewcommand{\kanjifamilydefault}{\gtdefault} | |
\usefonttheme{professionalfonts} | |
\usepackage{unicode-math} | |
\setmathfont{xits-math.otf} | |
\begin{document} |