- Feature Name: pattern-binding-modes
- Start Date: 2016-08-12
- RFC PR: rust-lang/rfcs#2005
- Rust Issue: rust-lang/rust#42640
概要
参照に関するパターンマッチをよりわかりやすくします。
現在、参照に関するパターンマッチは ref
と &
を使いわけなければいけません。
module Main where | |
main :: IO () | |
main = do | |
putStrLn "Hello World" |
dist | |
dist-newstyle | |
.ghc.environment.* |
(* types *) | |
type erl_expr = | |
| ErlInt of int | |
| ErlVar of string | |
| ErlApp of erl_expr * erl_expr (* F(A) *) | |
| ErlMatch of erl_pat * erl_expr (* P = E *) | |
and erl_pat = | |
| ErlPatVar of string |
クライアント -> サーバ (UDPパケット1つにQUICパケット1つ) | |
Header: Long Header (0b1000_0000) | |
Type: Initial (0x7f) | |
Version: IETF QUIC draft-14 (0xff00000e) | |
DCIL: 18 (0xf + 3) | |
SCIL: 17 (0xe + 3) | |
Dst Connection ID: 0xf2aca972962edd0f195aa1bb9a16734be91b | |
Src Connection ID: 0xd545b3713ec650dc4844f59652f737fa3a | |
Token Length: 0 (0x00, variable-length integer) |
-module(fun_call_vs_msg_passing_heavy). | |
-export([fun_call/1, msg_passing/1]). | |
fib(0) -> 0; | |
fib(1) -> 1; | |
fib(N) -> fib(N - 1) + fib(N - 2). | |
%% fib(20) (そこそこ重い処理のつもり) を N 回呼び出す | |
fun_call(N) -> |
module Main where | |
import Control.Monad | |
import Data.List (nub) | |
data Coin = Black | White | Blank deriving (Eq, Ord) | |
instance Show Coin where | |
show Black = "●" | |
show White = "○" |
参照に関するパターンマッチをよりわかりやすくします。
現在、参照に関するパターンマッチは ref
と &
を使いわけなければいけません。
http://rust-lang.github.io/rfcs/1522-conservative-impl-trait.html
Array.prototype.map.call(document.querySelectorAll("table tbody tr"), function (tr) { var c = tr.children; return c[2].textContent + "年" + c[3].textContent + "組" + "『" + c[4].textContent + "』"; }).join("\n"); |
#!/usr/bin/env bash | |
FOCAL=focal.dat | |
WC=~/tmp/wc.rb | |
if [[ "$1" == "-t" && ! -z "$2" ]]; then | |
exiftool -T -focallengthin35mmformat *.JPG | grep -v '-' | awk '{print NR, $0}' > $FOCAL | |
gnuplot -p -e "set terminal png; set term png size 2000,500; set term png font 'ヒラギノ丸ゴ ProN W4, 16'; set output '$2'; set xlabel 'n枚目'; set ylabel '焦点距離'; plot '$FOCAL' using 1:2:(1) with boxes" | |
rm $FOCAL | |
open $2 |