본문 바로가기

Programing/JVM(Java, Kotlin)

[Kotlin] Kotlin Koans

참고로 Koan이란 공안(公案)의 일본식 발음을 영어로 표기한 것이다.
불교에서 온 영어로 뛰어난 선(禪) 수행자의 깨달음이나 인연 또는 언행이다.
한국어로는 공안보다는 간화선(看話禪)이라는 용어를 찾아보면 이해하는데 도움이 된다.

접근 경로:

Kotlin (v1.4.21): kotlinlang.org/

Play Kotlin Language > Koans: play.kotlinlang.org/koans/overview

Educational Products 2020.3 > Learner Start Guide (2020-12-11)

- Install EduTools Plugin

EduTools 1.6M, 4.4.6, 4.4-2020.3-517, 2020-12-25

더보기
With the EduTools plugin, you can learn and teach programming languages such as Kotlin, Java, Python, JavaScript, Rust, Scala, C/C++ and Go in the form of coding tasks and custom verification tests right inside of JetBrains IntelliJ Platform based IDEs.
 How It Works
Install EduTools plugin: Go to Preferences → Plugins (or Configure → Plugins from the Welcome Screen) and search for the EduTools plugin.
As an Educator:
Create your own interactive course with custom tasks, checks, tests, hints, and lots more.
Share your course publicly or privately with your students or co-workers on Stepik, a learning management, and MOOC platform. Or you can save your course as an archive file.
Let learners independently complete their assignments with the assistance of your integrated tests.
Change Notes
4.4 With this release we've focused on overall quality of the plugin and fixed many bugs. 4.3
We've introduced a new My Courses tab in the Course Selection view
The login widget for JetBrains Academy now shows which user is currently logged in.
Courses in the Course Selection view are now divided into collapsible groups
External links in the Check Panel are now accompanied by an arrow icon
4.2
We’ve added support for the 2020.3 versions of IntelliJ-based IDEs
The JetBrains Academy tab in the Course Selection view now shows the selected project for logged-in users
All supported programming languages now have their own default placeholder texts
External links in the Task Description view are now accompanied by an arrow icon
The Course Selection view has received various small cosmetic refinements
4.1
A new UI for errors in the Course Selection view
Improvements for JetBrains Academy:
Cosmetic refinements for the Topics tab
More elaborate error notifications about an unsupported port, missing plugin requirements, or an unsupported programming language
Navigating away from an already completed stage no longer prompts you to replace or keep changes if there are no new changes
Improvements for educators:
Support for custom screenshots for dark themes
Files specified in the .courseignore file are excluded from the course archive
Support for IntelliJ's changes to the Welcome screen
Bug fixes for Codeforces integration
4.0
Various cosmetic refinements for the Course Selection view
More elaborate errors for problems with the environment (for example, no interpreter) when checking tasks
Improvements for JetBrains Academy:
Introduced a new sharable gif to post to Twitter upon completing a JetBrains Academy project
Code Challenges with languages different from selected projects are now opened in a separate project
Warnings for code challenges that are run locally but are missing additional context
Polished support for Scala code challenges
Support for stages containing Git object files
Various bug fixes and cosmetic improvements
3.9
Added support for the 2020.2 versions of IntelliJ-based IDEs
Task Descriptions are rendered using JCEF in the 2020.2 versions of IntelliJ-based IDEs
The EduTools plugin does not require an IDE restart after installation (dynamic loading)
The default Rust course template takes advantage of Cargo workspaces so Rust courses can be imported into the IDE faster
YouTube videos can be embedded in Task Descriptions
Added Scala support for JetBrains Academy
Codeforces content is now automatically updated in the IDE after it is updated on the Codeforces website
3.8
New tabbed view for course selection: content is now conveniently grouped by supported platforms
Submissions display for JetBrains Academy
Task description now shows the last verification result
Codeforces integration improvements
3.7
New UI for browsing course cards
Courses that require additional plugin are now displayed
Many improvements for JetBrains Academy:
Massive performance improvements
Auto update for JetBrains Academy projects
Various bug fixes
Performance improvements for browse courses dialog
Bug fixes for Scala language support
Python unittest assert results are shown to the user
3.6
A new, easier-to-use UI for filtering courses.
Many improvements for JetBrains Academy:
Project and code challenges performance improvements
More detailed error messages
Support for JetBrains Academy Android courses
Many bug fixes
A fix for the problem with synchronizing theory tasks with Stepik.
"View as Educator" disabled for Coursera, JetBrains Academy, CheckiO, and Stepik courses.
A fix for Java 11 support for Stepik courses.
More detailed error messages for Codeforces.
3.5
New dialog for section/lesson/task creation that allows creating tasks of different types including theory and output tasks
New look for course descriptions
C++ support for Codeforces
Support for code snippets and TeX in multiple-choice tasks
Improved stability of JetBrains Academy’s code challenges support
3.4
Codeforces support
Supported IntelliJ Platform 2020.1
Changed naming from Hyperskill to JetBrains Academy
Bug fixes related to JetBrains Academy integration
Beta support of JetBrains Academy frontend track
Improved stability of updating missions from CheckiO
3.3
Go support
Python: automatic installation of packages if requirements.txt file is provided
Editor notification promoting and simplifying course update for learners
Additional content (for example, custom task name or code samples) is preserved for multiple-choice tasks when publishing to Stepik
Default course description provided for new courses to make new course creation easier
Fixed checking process termination
3.2
Greatly improved stability of Hyperskill integration
C++: Catch framework support
Supported using Java 13 for Java, Kotlin and Scala courses
Hide "Peek solution" for particular tasks
Improved stability of course update on learner's side
CheckiO: order of stations, formatting
Go support as an experimental feature
3.1
Correctly show task description in markdown format
Fix and speed up opening of some courses like Algorithmic Toolbox and Atomic Kotlin
Hide Gradle/sbt output in console when running learner's code
Stop playing of video task's sounds on project closing
C++: fix importing courses from Stepik
Rust: show expected/actual results in task description panel if test fails on assert_eq macro
3.0
C++ support for educators
Video support in Stepik courses
See and run submissions if you're authorized on Stepik
"Peek solution" button can be hidden for all tasks in a course
"Insert Shortcut" action for task descriptions in educator mode
Python: more detailed check output for syntax errors
Shortcut rendering fixes for markdown task description files
YAML configuration files for storing course structure in student mode
YAML code insight improvements and bug fixes
Stepik integration fixes
New Educator and Learner pictures in role selection dialog
2.9
Now it's possible to configure placeholder dependencies on placeholder creation
Code insight improvements for YAML configs:
Non-existing elements are highlighted as errors
Non-existing elements (files, lessons etc) can be created right from their usage
Navigation to selected element from its usage
Completion showing available files, lessons etc in corresponding places in config files
%IDE_NAME% in task description is automatically replaced with corresponding IDE name
Fixes related to Hyperskill
2.8
Python: unittest is now default for tests in python courses (old tests are still supported for existing courses)
Rust: Cargo workspaces are now used to speed up courses loading in student mode
Fixed issues related to YAML format
2.7
YAML configuration files for managing course structure in educator mode
Android courses use androidx libraries
It's no longer needed to specify author on new course creation (only when generating local course archive)
Multiple-choice tasks support for local courses (previously, only choice tasks from Stepik were supported)
Python: tests results can be viewed in Test View in educator mode
Improved performance of checking in Gradle-based courses
"Next" button always shown for "Theory" tasks
2.6
Plugin available in 2019.2
Support C++ courses from Stepik
Support Kotlin and Python projects from Hyperskill
2.5
Improved Expected/Actual output in task description for Gradle-based courses
Improved Expected/Actual output in task description for output based tasks
Improved template for default Java tasks
Promote sections for the large courses
Improved "Add placeholder dependency" dialog
Import stepik course by id dialog reworked
Placeholders rendering improved
2.4
Update Hyperskill projects action added
Improved Expected/Actual output in task description for JavaScript
Added featured JavaScript course
Added featured Scala course (in Russian)
Added notification suggesting to login to Stepik for remote courses
'Reset task' asks a confirmation now
"Choose role" dialog is shown in Pycharm Edu and Idea Edu only
2.3
Added hyperskill.org support
Added language levels for Java and Kotlin
CheckiO support improved
Added JavaScript support
Added Rust support
Improved highlighting for the code snippets in task description
Added font control to the task description
2.2
Fixed checker for stepik course tasks
2.1
Python and Javascript CheckIO support
Improved courses list loading speed
Fixed several Coursera-related issues
Show changed files for Stepik course imported from zip
Do not overwrite IDEA shortcuts
2.0
Support Coursera Kotlin course
Task description and check panel redesigned
Full support for Atomic Kotlin
Import local course is available on Welcome Screen
Hints for the task moved to the task description
1.8
Atomic Kotlin course preview
Action for updating additional files on Stepik
Update additional files in student projects
It's now possible to customize build.gradle and settings.gradle
1.7
Load solutions in background
Push single task to stepik
Support links to psi elements in task description (EDU-1222)
Do not load solutions if user wasn't enrolled to this course before
Improved notification about new courses
Improved course uploading to Stepik
1.6
Added Scala support
1.5
Answer placeholders improvements
Introduce placeholder dependencies
Introduce groups of lessons (sections)
'View as instructor' action from Browse courses dialog
Improve task description editing (open separate file)
Improve course update on students side
1.4
Studio 3.1 compatibility
1.3
Introduce Java courses
Local .png images are displayed in task description
Separate source and test directories for JVM based courses
Course progress moved to the Course tree view on the left
Support for markdown tables in task descriptions
Hints support markdown
Silent "Build" tool window while gradle project creation
Open first task automatically after opening course
Do not show standard "New Project" message if one project already opened
System font is used in task description panel
Allow to hide solved lessons
Allow referring IDE shortcuts in task descriptions
1.2
Added progress for subtasks
Fix for "failed to launch checking" error if course was open for a long time
Removed "posted from edu tools" comment from loaded solutions
Code colorized regarding default programming language for course instead of using only python
"Open on Stepik" link is not overlapping task description
Proper language is used in Create New Stepik Course dialog
Do not force showing tool window stripes
Fixed exception from Settings if no Kotlin project opened
Default score is set for every step in EduTools courses
Progress for theory is added
Save last archive location
1.1
Import Stepik Course action from Browse Courses
"Compare with Answer" action on Task Description panel
Courses verified by JetBrains are highlighted
Courses filtering by natural language
Tags in course descriptions can be clicked to filter courses
Subtasks are enabled for Kotlin courses
1.0.2
Your solutions and progress are now saved if you have been authorized on Stepik
Various fixes for educators
1.0.1
Kotlin Koans are now available in Android Studio 3.0
It's now possible to create courses for Kotlin in Android Studio 3.0
Course creation has been made easier in IntelliJ IDEA with new "Create New Course" dialog and File->Course Creator->Create Course Preview action
Your solutions and progress are now saved if you have been authorized on Stepik

설치 후에는 Welcome 화면에 My Courses 라는 기능이 추가된다.

Start New Course 버튼을 누르면 여러 코스를 선택할 수 있다. Community Courses를 선택한다.

로그인을 하면 여러 장치간 단계를 동기화를 할 수 있다고 한다.

Log in 버튼을 누르면 stepik.org/ 을 통해 회원가입 및 인증 완료를 할 수 이싿.

인증완료는 로컬서버를 통해 콜백을 주는 것으로 추측된다.

해당 포트를 확인해보면 idea라는 프로세스가 포트를 LISTEN 하고 있는 것을 확인할 수 있다.

sudo lsof -i -n -P | grep 63342

PID 1088은 IntelliJ IDEA 이다.

인텔리제이상에는 로그인하라는 메시지가 사라지는데 어떤 것으로 되었는지 보이지는 않는다.

Kotlin Koans의 첫 과제는 함수완성이다.

문제를 해결하는데 도움이되는 function syntax 등의 링크를 살펴 볼 수 있다.

일단 답은 맞았지만 리팩토링이 더 가능하다.

expression body라는 것으로 바꿀 수 있기 때문이다.

Peek Solution... 을 통해 모범답안을 볼 수 있다.

Level 1을 마치면 아래와 같은 동영상이 나온다.

2020-12-25
2020-12-28

2020-12-29 (화)

43개의 task 중 22개를 했다.

Collection Aggregate Operations에 대해 하는 과정이 막혔다.

예상은 했지만 flatMap을 사용하는 것이 모범답안으로 나와 있었다.

일단은 getProductWithMaxPrice 라는 extension function을 도입해서 map으로 구현하도록 했는데 flatMap이 더 유연한 것 같다.

또한 callable reference를 사용하라고 하는데 lambda를 사용할 경우 서로 다른 it이 서로 모호해질 수 있는데 이런 경우에 유용하다.

2020-12-30 (수)

24/43 완료 (55.8%)

3level.gif.zip
0.49MB

2021-01-04 (월)

32/43 완료 (74.4%)

4level.gif.zip
0.52MB

2021-01-29 (목)

오랫만에 했다.