SlideShare ist ein Scribd-Unternehmen logo
1 von 37
p.s. 본 문서는 Scala의 가장 기초적인 문법만을 다루고 있습니다.
1. 함수형 언어란?
2. 스칼라의 탄생
3. 스칼라 기초 문법
4. 스칼라의 특징
5. 참조
*목차*
by 토니토닉 2
Image source : http://matt.might.net/articles/compiling-up-to-lambda-calculus/images/y_combinator.jpg
Image source : http://img.brothersoft.com/screenshots/softimage/l/lambda_calculator-365323-1273647129.jpeg
by 토니토닉
3
Image source : http://languagelog.ldc.upenn.edu/myl/BlondieLambda.gif
by 토니토닉
4
John McCarthy (1927.09.04 ~ 2011.10.24)
미국 MIT에서 LISP를 개발한 개발자.
Image source :
http://z4.enha.kr/http://upload.wikimedia.org/wikipedia/commons/thu
mb/4/49/John_McCarthy_Stanford.jpg/320px-John_McCarthy_Stanford.jpg
특징 명령형 방법 함수형 방법
프로그래머가 중점을 두는 부분 작업을 수행하는 방법(알고리즘)과 상태의 변
경을 추적하는 방법
원하는 정보와 필요한 변환
상태 변경 중요 존재하지 않음
실행 순서 중요 중요도가 낮음
주요 흐름 제어 루프, 조건 및 함수(메서드) 호출 재귀를 비롯한 함수 호출
주요 조작 단위 클래스나 구조체의 인스턴스 1급(first-class) 개체와 데이터 컬렉션인 함수by 토니토닉
5
※함수형 프로그래밍 언어의 한 갈래
Image source : http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Mark_Odersky_photo_by_Linda_Poeng.jpg/220px-Mark_Odersky_photo_by_Linda_Poeng.jpg
by 토니토닉 6
by 토니토닉 7
Image source : http://markgoldenstein.com/scala-vs-java-weniger-code-mehr-inhalt/
by 토니토닉 8
by 토니토닉 9
by 토니토닉 10
by 토니토닉 11
* capitalize 함수는 문자열의 첫글자를 대문자로 바꿔서 반환하는 함수
by 토니토닉 12
by 토니토닉 13
https://groups.google.com/forum/#!topic/scala-korea/dfkcfM5yM9M
by 토니토닉 14
by 토니토닉 15
by 토니토닉 16
by 토니토닉 17
http://www.slideshare.net/ennorunne/scala-for-java-programmers-2973915
by 토니토닉 18
by 토니토닉 19
http://www.scala-lang.org/old/node/71%3Fsize=_original.html#
• null
• nothing(=Nil)
by 토니토닉 20
by 토니토닉 21
by 토니토닉 22
클로저라는 이름은 함수 리터럴의 본문에 있는 모든 자유변수(free variable) 에 대한 바인딩(binding)을 ‘포획(capturing)’해서 자유 변수가 없게 ‘닫는(closing)’행위에서 따온 말.
by 토니토닉 23
by 토니토닉 24
by 토니토닉 25
<결과 화면>
 getter, setter | (혹은 property) 개념
by 토니토닉 26
by 토니토닉 27
by 토니토닉 28
by 토니토닉 29
by 토니토닉 30
1. 처음으로 t가 Sum인지 확인한다. 만약 맞다면 왼쪽 서브트리를
새로운 변수 l에 오른쪽 서브트리를 새로운 변수 r에 할당 한다.
그리고 화살표를 따라 화살표의 오른편으로 계산을 이어 나간다.
화살표의 오른편에서는 화살표의 왼편에서 할당된 변수 l과 r을
사용 한다.
2. 첫번째 확인이 성공하지 못하면 트리는 Sum이 아니라는 이야기
이다. 다음으로는 t가 Var인지 확인한다. 만약 맞다면 Var 노드 안
에 포함된 이름을 변수 n에 할당한다. 그리고 화살표의 오른쪽으
로 진행한다.
3. 두번째 확인 역시 실패하면 t는 Sum도 Var도 아니라는 뜻이다.
이제는 Const에 대해 확인 해본다. 만약 맞다면 Const 노드 안의
값을 변수 v에 할당하고 화살표의 오른쪽으로 진행한다.
4. 마지막으로 모든 확인이 실패하면 패턴 매칭이 실패 했음을 알리
는 예외가 발생하게 된다. 이러한 상황은 확인 한 것 외에 Tree의
하위 클래스가 더 존재 할 경우 일어난다.
by 토니토닉 31
by 토니토닉 32
by 토니토닉 33
by 토니토닉 34
by 토니토닉 35
by 토니토닉 36
by 토니토닉 37

Weitere ähnliche Inhalte

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

함수형 프로그래밍 언어 스칼라(Scala) 소개