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 / 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.

@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 / 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 / macro-debugging-in-clojurescript.adoc
Last active September 20, 2018 02:03
Macro debugging in ClojureScript
@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 / 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에서는 무명 함수에도 이와같이 이름을 붙일 수 있습니다. 아래처럼 디버깅할 때 요긴합니다.

Clojure and ClojureScript QnA

1. Macros in ClojureScript

1.1. Question

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

"Clojure Programming" 에 나온 예제

@philoskim
philoskim / gist:848373784728e79e606bb75f95b2bcb1
Created September 3, 2025 08:10
Excel에서 텍스트 데이터를 날짜 데이터로 오인하는 현상 방지하기
= Excel에서 텍스트 데이터를 날짜 데이터로 오인하는 현상 방지하기
* csv 파일을 Excel 프로그램에서 읽어 들일 때, 특정 칼럼의 텍스트 데이터를 날짜 데이터로
잘못 읽어들이는 경우가 있다. 이런 현상을 근본적으로 예방할 수 있는 방법을 소개한다.
* 참고로 다음에 소개하는 방법은, ``Microsoft 365 online 2025년 version``을 대상으로 실행했다.
. Excel 프로그램을 실행한다.
. 이 상태에서 .csv 파일을 직접 열지 않고, 메뉴 상의 ``[데이터 > 데이터 가져오기(파워 쿼리)]``를 선택한다.
. `[데이터 원본 선택]` 화면에서 `[텍스트/CSV]` 항목을 선택한다.
@philoskim
philoskim / how-to-load-csv-without-data-loss-in-excel.adoc
Created September 4, 2025 00:40
Excel에서 텍스트 데이터를 날짜 데이터로 잘못 읽어들이는 문제 해결하기

Excel에서 텍스트 데이터를 날짜 데이터로 잘못 읽어들이는 문제 해결하기

  • csv 파일을 Excel 프로그램에서 읽어 들일 때, 특정 칼럼의 텍스트 데이터를 날짜 데이터로 잘못 읽어들이는 경우가 있다. 이런 현상을 근본적으로 해결할 수 있는 방법을 공유하고자 한다.

  • 참고로 다음에 소개하는 방법은, Microsoft 365 online 2025년 version을 대상으로 실행했다.

    1. Excel 프로그램을 실행한다.

    2. 이 상태에서 .csv 파일을 직접 열지 않고, 메뉴 상의 [데이터 > 데이터 가져오기(파워 쿼리)]를 선택한다.

    3. [데이터 원본 선택] 화면에서 [텍스트/CSV] 항목을 선택한다.