<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-500878250765995571</id><updated>2012-01-21T13:07:20.805+09:00</updated><category term='The Scheme Programming Language'/><category term='The Haskell School Of Expression'/><title type='text'>Just For Fun!</title><subtitle type='html'>Big brother is watching you.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-7898778524421505209</id><published>2011-08-25T17:11:00.001+09:00</published><updated>2011-08-25T17:13:21.130+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Haskell School Of Expression'/><title type='text'>Chapter 4. Shapes II: Drawing Shapes</title><summary type='text'>이번 장에서는 Shape를 Graphic으로 변경하여 윈도우에 그리는 코드를 작성해보자. 모듈 이름은 Draw라 하자.
module Draw (...) where

import Shape
import SOEGraphics

-- 윈도우의 사이즈: 600x500
xWin, yWin :: Int
xWin = 600
yWin = 500

-- 인치를 픽셀로 바꾸는 함수
inchToPixel :: Float -&gt; Int
inchToPixel x = round (100 * x)

-- 윈도우의 중심을 (0,0)으로 하는 것으로 쓰는 것이 편하므로 이것을 실제 윈도우의 좌표(좌상단을 (0,0)으로 하는 것)로 바꾸어 주는 함수를 만든다.
trans :: Vertex -&gt; Point
</summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/7898778524421505209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-4-shapes-ii-drawing-shapes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7898778524421505209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7898778524421505209'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-4-shapes-ii-drawing-shapes.html' title='Chapter 4. Shapes II: Drawing Shapes'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-6056602579850345360</id><published>2011-08-25T17:10:00.002+09:00</published><updated>2011-08-25T17:13:08.782+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Haskell School Of Expression'/><title type='text'>Chapter 3. Simple Graphics</title><summary type='text'>Hello World를 화면에 출력해보자.
Main.hs라는 파일에 아래의 내용을 입력한다.
-- module의 이름과 파일의 확장자를 뺀 이름이 같아야 한다.
module Main where
main = putStr "Hello World\n"

위 프로그램을 컴파일 후 실행하면 화면에 Hello World가 출력될 것이다. putStr의 type은 'String -&gt; IO ()'이다. I/O action을 취하는 것은 IO T 로 표시한다. 여기서 T는 type을 의미한다. IO ()는 I/O를 하고 아무것도 리턴하지 않는 것을 의미한다. IO String은 I/O를 하고 String을 리턴하는 것을 의미한다.

파일에 텍스트를 쓰고 화면에 텍스트를 표시하는 것을 둘 다 하고 싶을 수 </summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/6056602579850345360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-3-simple-graphics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6056602579850345360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6056602579850345360'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-3-simple-graphics.html' title='Chapter 3. Simple Graphics'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-6008738965257610605</id><published>2011-08-25T17:09:00.005+09:00</published><updated>2011-08-25T17:14:37.154+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Haskell School Of Expression'/><title type='text'>Chapter 2. A Module of Shapes: Part 1</title><summary type='text'>우리가 만든 함수나 타입들을 다른 곳에서 사용할 수 있게 하려면 module을 만든다.
module Shape (...) where -- ...에 외부에서 사용할 수 있게 하려는 함수나 타입을 적어준다.
...body-of-module...
이때 module Shape () where로 하면 아무것도 외부에서 사용할 수 없게 하는 것이고 module Shape where로 하면 모든 함수를 외부에서 사용할 수 있게 하는 것이다.

다른 곳에서 이 module을 사용하려면 import를 한다.
import Shape

새로운 data type을 만드려면 data를 사용하고 기존의 type을 이름만 바꾸려면 type을 사용한다.

새로운 data type 만들기.
data Shape = </summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/6008738965257610605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-2-module-of-shapes-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6008738965257610605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6008738965257610605'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-2-module-of-shapes-part-1.html' title='Chapter 2. A Module of Shapes: Part 1'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-7462610803461190026</id><published>2011-08-25T17:07:00.002+09:00</published><updated>2011-08-25T17:13:40.858+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Scheme Programming Language'/><title type='text'>Chapter 2. Getting Started</title><summary type='text'>함수 사용하는 방법은 (procedure arg1 arg2 ...)의 형태가 된다.
(+ 1/2 1/2) =&gt; 1
여러 값을 포함하는 데이터 구조로 list가 있다. list는 괄호 안에 여러 값들을 적는다.
(1 2 3 4 5)
list에 다양한 type이 올 수 있다.(참고: haskell의 경우는 같은 type만이 올 수 있다.)
(4.2 "hi")

procedure와 단순 list를 구별하는 방법은 어떻게 할까? 이를 위해 quote가 있다. quote를 사용하면 quote 뒤에 오는 것은 procedure가 아니라 단순 list의 data라는 것을 알린다.
예: (quote (+ 3 4)) =&gt; (+ 3 4)
quote에 대한 축약으로 '(single quotation mark)</summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/7462610803461190026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-2-getting-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7462610803461190026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7462610803461190026'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/chapter-2-getting-started.html' title='Chapter 2. Getting Started'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-6945015956234200770</id><published>2011-08-01T21:53:00.014+09:00</published><updated>2011-08-25T17:12:21.178+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Scheme Programming Language'/><title type='text'>Chapter 1. Introduction</title><summary type='text'></summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/6945015956234200770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/scheme-programming-language.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6945015956234200770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/6945015956234200770'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/scheme-programming-language.html' title='Chapter 1. Introduction'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-500878250765995571.post-7106628453874476401</id><published>2011-08-01T21:53:00.013+09:00</published><updated>2011-08-25T17:11:51.014+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Haskell School Of Expression'/><title type='text'>Chapter 1: Problem Solving, Programming and Calculation</title><summary type='text'>프로그래밍은 문제를 해결하는 것이다. 문제 해결은 computation by calculation으로 볼 수 있다.

예)
3 * ( 9 + 5 ) =&gt; 3 * 14 =&gt; 42

위의 예를 함수 형태로 바꾸어 볼 수 있다.

simple x y z = x * ( y + z )

함수란 input이 같으면 output이 항상 같게 나오는 것을 의미한다.

계산의 과정중에 있는 것을 expression이라 하고 이의 최종 결과를 value라 한다. 모든 expression은 type을 갖는다. type은 같은 집합으로 묶을 수 있는 expression의 집합이다. 정수는 Integer, 문자는 Char등으로 표시한다. type은 항상 대문자로 시작해야 하고 value는 소문자로 시작해야 </summary><link rel='replies' type='application/atom+xml' href='http://mysangle.blogspot.com/feeds/7106628453874476401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mysangle.blogspot.com/2011/08/haskell-school-of-expression.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7106628453874476401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/500878250765995571/posts/default/7106628453874476401'/><link rel='alternate' type='text/html' href='http://mysangle.blogspot.com/2011/08/haskell-school-of-expression.html' title='Chapter 1: Problem Solving, Programming and Calculation'/><author><name>mysangle</name><uri>http://www.blogger.com/profile/10645554138154717576</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_QzLbwNU7kgQ/TGZsChBlYeI/AAAAAAAAAbo/OynVQ6CC4BA/S220/IMG_0068.JPG'/></author><thr:total>0</thr:total></entry></feed>
