Skip to content

Instantly share code, notes, and snippets.

View philoskim's full-sized avatar

Philos Kim philoskim

  • Seoul, South Korea
View GitHub Profile
@philoskim
philoskim / vscode-on-ubuntu.adoc
Last active March 23, 2024 23:36
Ubuntu에서 Visual Studio Code 한글 입력 안되는 현상 해결법

Ubuntu에서 Visual Studio Code 한글 입력 안되는 현상 해결법

Ubuntu 19.10에서 Visual Studio Code 사용 중 한영 전환키를 누르고 한글을 입력하려 했더니, 한글 입력이 안되고 영어만 계속 입력되는 현상을 발견했다. 그래서 인터넷을 검색해 봤더니 snap 형식의 Visual Studio Code를 설치한 경우에, Ubuntu의 입력기인 IBus와 충돌해서 일어나는 현상이라고 한다. 그런데 .deb 형식의 Visual Studio Code를 설치한 경우에는 그런 문제가 없다는 사실을 알게 되어, 설치해 봤더니 한글 입력이 정상적으로 이루어지는 것을 확인했다. 그래서 같은 문제를 겪는 사람들을 위해 이 해결법을 공유하고자 한다.

  • 먼저 이미 설치되어 있는 snap 형식의 Visual Studio Code를 제거한다.

Clojure and ClojureScript QnA

1. Macros in ClojureScript

1.1. Question

Clojure, ClojureScript 매크로 동작이 서로 다른가요?

"Clojure Programming" 에 나온 예제

@philoskim
philoskim / clojure-transducer-test.adoc
Last active December 24, 2018 02:49
Clojure Transducer Test

Clojure Transducer Test

transducer가 어떤 방식으로 작동하는지 알기 위해 테스트 코드를 작성했습니다. 아래의 my-filter, my-map, my-conj는 각각 clojure.corefilter, map, conj 함수의 내용 일부를 이 테스트를 위해 약간 수정한 것입니다. 코드가 약간 길기는 합니다만, 찬찬히 읽어 보면 이해하기 어려운 코드는 아닙니다.

Tip
참고로, 아래에서 outer-fn-in-으로 시작하는 함수는 transducer이고, inner-fn-in-으로 시작하는 함수는 reducing function입니다. Clojure에서는 무명 함수에도 이와같이 이름을 붙일 수 있습니다. 아래처럼 디버깅할 때 요긴합니다.
@philoskim
philoskim / clojure-blog.adoc
Last active November 1, 2018 04:15
Clojure blog

Clojure Blog

Table of Contents

1. reify의 발음

Clojure에 reify라는 함수가 있다. 이 단어는 '구체화 시키다', '실체화하다’라는 의미인데, 문제는 이 단어를 정확하게 발음하는 사람들이 의외로 드물다는데 있다. 이 단어의 정확한 발음은 [rí:əfài] (리어파이) 이다. 이 단어의 어원을 알면 정확한 발음을 하는데 도움이 되므로, 다음에 어원을 함께 소개한다.

@philoskim
philoskim / macro-debugging-in-clojurescript.adoc
Last active September 20, 2018 02:03
Macro debugging in ClojureScript
@philoskim
philoskim / how-to-alias-clojurescript-namespace-in-macros.adoc
Last active July 9, 2018 12:33
How to alias the ClojureScript namespaces in macros

How to alias the ClojureScript namespaces in macros

Problem

I wanted to alias a ClojureScript namespace in macros like this.

;; qna/very_very_long_namespace.cljs
@philoskim
philoskim / state-management.adoc
Last active May 8, 2018 01:50
Game state management by using nested refs in Clojure

Game state management by using nested refs in Clojure

(defn- ->vec [k]
  (if (vector? k) k [k]))

(defmacro get-in* [r ks]
@philoskim
philoskim / cljs-ns.adoc
Last active May 4, 2018 08:49
How to get *ns* string in ClojureScript

How to get *ns* string in ClojureScript

It’s not so easy to get *ns* string in ClojureScript as you might expect but here is a tip.

It is impossible to get *ns* string at run-time in ClojureScript (except in self-hosted ClojureScript) but it can be accessed at compile-time only. So you have to use a macro to get it as the following example.

I came up with this idea in the course of implementing set-ns-blacklist! and set-ns-whitelist! (https://github.com/philoskim/debux#debux-config) in my debux library.

@philoskim
philoskim / cljs-macro.adoc
Last active May 7, 2018 21:33
How to enumerate the ClojureScript macros

How to enumerate the cljs.core macros in ClojureScript

I wanted to enumerate the macros of cljs.core in ClojureScript. In general, it would not be needed for everyday ClojureScrit programming but I need it to author my debux library.

At first, I asked a question about this problem in Google Clojure Group but got no answers.

I decided to find the way by myself and finally found a way to enumerate the macros of cljs.core in Clojure REPL, so I want to share the exprerience with others here.

The functions of cljs.core are defined in src/main/cljs/cljs/core.cljs and the macros of cljs.core are defined in src/main/clojure/cljs/core.cljc. So you have to evaluate the src/main/clojure/cljs/core.cljc file in Clojure REPL, not in ClojureScript REPL, to get a list of the macros of cljs.core.