Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README and Fixed Configuration Key derpecated (#1)
* Updated README and Fix configuration key. * Added draft posts.
- Loading branch information
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ kramdown: | |
input: GFM | ||
highlighter: rouge | ||
|
||
gems: | ||
plugins: | ||
- jekyll-paginate | ||
|
||
paginate: 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
layout: post | ||
title: "Scala trait - 스칼라의 trait" | ||
date: 2019-01-02 22:11:37 +0900 | ||
categories: [languages] | ||
tags : [scala, functional programming] | ||
--- | ||
|
||
Scala 에서는 `trait`이라는 신기한 녀석이 있다. | ||
|
||
`trait`은 어떤 녀석이고 무엇을 하는 녀석일까 | ||
|
||
<!--more--> | ||
|
||
Scala에서는 trait이라는 녀석이 있다. | ||
|
||
Java를 알고 있는 사람이라면 `interface`와 유사하다고 볼 수도 있다. | ||
|
||
`interface`와 유사하게 `trait`은 선언한 method를 하위 구현체에서 구현을 해주어야 한다. | ||
|
||
물론 `interface`와 `default method`처럼 작성할 수도 있다. | ||
|
||
다만 Java처럼 특정한 keyword 없이 구현할 수 있다. | ||
|
||
가령 자바에서 | ||
|
||
{% highlight java %} | ||
public interface Taste { | ||
public boolean isSweet(); | ||
|
||
public default boolean isNotSweet() { | ||
return !isSweet(); | ||
} | ||
} | ||
{% endhighlight %} | ||
|
||
이와 같이 작성한다면 | ||
|
||
스칼라에서는 | ||
|
||
{% highlight java %} | ||
trait Taste { | ||
def isSweet(): Boolean | ||
|
||
def isNotSweet(): Boolean = !isSweet() | ||
} | ||
{% endhighlight %} | ||
|
||
와 같은 형태로 작성할 수 있다 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
layout: post | ||
title: "Scala Mixin" | ||
date: 2019-01-03 22:11:37 +0900 | ||
categories: [languages] | ||
tags : [scala, functional programming] | ||
--- | ||
|
||
Scala에서는 mix-in 이라는 개념이 있다. | ||
|
||
`trait`을 사용할 경우에 사용이 가능한데 | ||
|
||
mix-in은 어떤 것이고 어떻게 사용할까? | ||
|
||
<!--more--> |