<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
	<id>http://junhoahn.kr/noriwiki/index.php?action=history&amp;feed=atom&amp;title=Pattern_matching</id>
	<title>Pattern matching - 편집 역사</title>
	<link rel="self" type="application/atom+xml" href="http://junhoahn.kr/noriwiki/index.php?action=history&amp;feed=atom&amp;title=Pattern_matching"/>
	<link rel="alternate" type="text/html" href="http://junhoahn.kr/noriwiki/index.php?title=Pattern_matching&amp;action=history"/>
	<updated>2026-05-22T00:09:39Z</updated>
	<subtitle>이 문서의 편집 역사</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>http://junhoahn.kr/noriwiki/index.php?title=Pattern_matching&amp;diff=790&amp;oldid=prev</id>
		<title>2023년 2월 25일 (토) 05:33에 Ahn9807님의 편집</title>
		<link rel="alternate" type="text/html" href="http://junhoahn.kr/noriwiki/index.php?title=Pattern_matching&amp;diff=790&amp;oldid=prev"/>
		<updated>2023-02-25T05:33:29Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ko&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023년 2월 25일 (토) 05:33 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l22&quot;&gt;22번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;22번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;와 같이 shape의 타입을 판단하여 다른 결과를 가져오는 match패턴을 생각할 수 있다.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;와 같이 shape의 타입을 판단하여 다른 결과를 가져오는 match패턴을 생각할 수 있다.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== If-else / switch문과의 차이점 ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;If-else와 같은 문들은 컴파일러가 파악할 수 없다. 이에 반해, matching구분은 컴파일러가 매칭이 모두 이루워 지고 있는지, default는 선언되었는지, 타입이 일치하는지와 같은 semantic오류를 미리 파악할 수 있다. 따라서, matching은 if-else 혹은 switch보다 error prone하지 않다고 할 수 있다.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ahn9807</name></author>
	</entry>
	<entry>
		<id>http://junhoahn.kr/noriwiki/index.php?title=Pattern_matching&amp;diff=786&amp;oldid=prev</id>
		<title>Ahn9807: 새 문서: 분류: 프로그래밍 언어  == 개요 == 패턴 매칭은 일련의 토큰들이 특정 패턴에 포함되는지를 판단하는 구문을 말한다. 패턴매칭은 Modern programming langauge에서 많이 사용되며, 특히 함수형 언어혹은 함수형 언어의 특징을 포함하는 언어들에서 많이 사용된다. 이러한 예시로는 Rust, C#, Scala와 같은 언어들이 있다.  * sequence matching: 주어진 일련의 토큰들에서...</title>
		<link rel="alternate" type="text/html" href="http://junhoahn.kr/noriwiki/index.php?title=Pattern_matching&amp;diff=786&amp;oldid=prev"/>
		<updated>2023-02-25T05:10:36Z</updated>

		<summary type="html">&lt;p&gt;새 문서: &lt;a href=&quot;/noriwiki/index.php?title=%EB%B6%84%EB%A5%98:%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D_%EC%96%B8%EC%96%B4&quot; title=&quot;분류:프로그래밍 언어&quot;&gt;분류: 프로그래밍 언어&lt;/a&gt;  == 개요 == 패턴 매칭은 일련의 토큰들이 특정 패턴에 포함되는지를 판단하는 구문을 말한다. 패턴매칭은 Modern programming langauge에서 많이 사용되며, 특히 &lt;a href=&quot;/noriwiki/index.php?title=%ED%95%A8%EC%88%98%ED%98%95_%EC%96%B8%EC%96%B4&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;함수형 언어 (없는 문서)&quot;&gt;함수형 언어&lt;/a&gt;혹은 함수형 언어의 특징을 포함하는 언어들에서 많이 사용된다. 이러한 예시로는 &lt;a href=&quot;/noriwiki/index.php?title=Rust&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Rust (없는 문서)&quot;&gt;Rust&lt;/a&gt;, &lt;a href=&quot;/noriwiki/index.php?title=C&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;C (없는 문서)&quot;&gt;C#&lt;/a&gt;, &lt;a href=&quot;/noriwiki/index.php?title=Scala&quot; title=&quot;Scala&quot;&gt;Scala&lt;/a&gt;와 같은 언어들이 있다.  * sequence matching: 주어진 일련의 토큰들에서...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[분류: 프로그래밍 언어]]&lt;br /&gt;
&lt;br /&gt;
== 개요 ==&lt;br /&gt;
패턴 매칭은 일련의 토큰들이 특정 패턴에 포함되는지를 판단하는 구문을 말한다. 패턴매칭은 Modern programming langauge에서 많이 사용되며, 특히 [[함수형 언어]]혹은 함수형 언어의 특징을 포함하는 언어들에서 많이 사용된다. 이러한 예시로는 [[Rust]], [[C#]], [[Scala]]와 같은 언어들이 있다. &lt;br /&gt;
* sequence matching: 주어진 일련의 토큰들에서 구문의 위치를 파악하는 것이다. (e.g. where is the first &amp;quot;a&amp;quot; in &amp;quot;pattern_matching&amp;quot;?)&lt;br /&gt;
* tree matching: 주어진 일련의 토큰의 구조에서 구문이 어떤 토큰에 포함되어 있는지를 파악하는 것이다. (e.g. what type of Nation(Korea)?)&lt;br /&gt;
&lt;br /&gt;
== 예시 ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;scala&amp;quot;&amp;gt;&lt;br /&gt;
expr match {&lt;br /&gt;
    case variant_id_1(field_id_11, ... ) =&amp;gt; expr1&lt;br /&gt;
    case variant_id_2(field_id_22, ... ) =&amp;gt; expr2&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
이를 좀더 구체적인 예로 생각해 보자면,&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;scala&amp;quot;&amp;gt;&lt;br /&gt;
shape match {&lt;br /&gt;
    case Triangle(a, b, c)=&amp;gt; a + b + c&lt;br /&gt;
    case Rectangle(h, w) =&amp;gt; 2 * (h + w)&lt;br /&gt;
    _ =&amp;gt; todo!()&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
와 같이 shape의 타입을 판단하여 다른 결과를 가져오는 match패턴을 생각할 수 있다.&lt;/div&gt;</summary>
		<author><name>Ahn9807</name></author>
	</entry>
</feed>