- Feature Name: pattern-binding-modes
- Start Date: 2016-08-12
- RFC PR: rust-lang/rfcs#2005
- Rust Issue: rust-lang/rust#42640
参照に関するパターンマッチをよりわかりやすくします。
現在、参照に関するパターンマッチは ref
と &
を使いわけなければいけません。
Require Import Coq.ZArith.ZArith. | |
Inductive rand : Set := | |
| State : Z -> rand. | |
(* 線形合同法による疑似乱数 *) | |
Definition next (r : rand) : rand := | |
match r with | |
| State s => | |
let s' := Z.modulo (Z.mul 48271 s) 2147483647 in |
(* コードを書く *) | |
Definition x := 42. |
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