본문 바로가기

프로그래밍 언어 노트/Clojure

(28)
[clojure] clj-oauth2 를 통해서 github Oauth 를 가져와 보자 주요 코드 (ns ossss.routes.oauth (:require [ossss.config :refer [env]] [mount.core :refer [defstate]] [clj-http.client :as http] [clj-oauth2.client :as oauth2] [ring.util.http-response :as response])) ;; env 에 있는값을 쓰기 위해서 defstate 사용 (defstate github-oauth2 :start {:authorization-uri (env :authorize-uri) :access-token-uri (env :access-token-uri ) :redirect-uri "http://localhost:3000/oauth/callback" ..
[Clojure] Clojure 에서 Runtime 함수를 생성해보자 Clojure 에는 intern 이라는 함수가 존재한다. Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var. 네임스페이스에 새로운 var 를 추가할수있는데, 함수또한, var 에 바인된것에 불과하므로 intern 을 이용하여 함수를 런타임에 추가할수있다! functional programming - Clojure: ..
[Clojure/Luminus] Luminus + Intellij 시작 설정 Luminus 는 Clojure Fullstack Web framework 이며, 얕게 여러가지 프레임워크를 경험해본 결과, Luminus 가 제일 깔끔하고 자료도 많고 초보자한테는 딱 좋은 물건이다. 특히 Clojure + ClojureScript 환경의 Fullstack 템플릿이 아주 좋다 [기본 도큐먼트] 도 나름 충실하고, [예시 프로젝트] 도 많이 있다. 프로젝트 만들기 Clojure 의 필수툴인 개미핥기, 라이닝엔으로 새프로젝트를 만들수 있다. 나는 야근관련(...) 홈페이지를 만들기 위하여 yageun 이라는 프로젝트에 re-frame 을 추가하였다. lein new luminus +추가 종속성들.. luminus 의 장점중 하나가 풍부한 추가 프로파일들이다. 본인경우 ClojureScrip..
[Clojure] Idiomatic Clojure - Code Smells (관용적인 클로저 - 코드 스멜) 2021 첫글은 역시 Clojure 프로그래밍 언어를 공부할때, 문법다음으로 공부해하는것이 Idiom 이다. Idiom 을 아는것은, ~~ 스러운 코딩을 하는데 도움을 준다, (ex. python 스럽게 코딩하기, Java 를 Java 답게 코딩하기..) 그래서 Clojure/F# 에 대한 Idiom 을 찾아보던중 좋은 포스팅을 발견하였다. Idiomatic Clojure: Code Smells (bsless.github.io) Idiomatic Clojure: Code Smells We all make mistakes. We have all written bad pieces of code at some point of our lives. They might have been non-idiomatic, ..
[Clojure] Clojure Reactive 와 Clojure CSP(clojure.async) swannodette.github.io/2013/07/12/communicating-sequential-processes/ Communicating Sequential Processes Communicating Sequential Processes 12 July 2013 With the arrival of core.async, ClojureScript provides a powerful advantage over other popular compile to JavaScript languages like CoffeeScript, Dart, and TypeScript. These languages fail to address the sing swannodette.github.io CSP (고루틴) 의 구현체..
[Clojure] Clojure 프로젝트 시작 템플릿 확인 clj-templates.com/ clj-templates clj-templates.com Leiningen / Boot 에서 새프로젝트를 만들때 사용할수 있는 템플릿을 쉽게 확인할수있다. lein new Clojars 에서 템플릿만 뚝딱 가져온단다. 빌드툴 아이콘에 마우스를 가져다대면 바로 명령어를 확인할수있고 클릭하면 카피된다.
[Clojure] 종합선물세트(?) 같은 라이브러리 github.com/cloojure/tupelo cloojure/tupelo Tupelo: Clojure With A Spoonful of Honey. Contribute to cloojure/tupelo development by creating an account on GitHub. github.com Tupelo: Clojure With A Spoonful of Honey 다양한 Helper 함수들을 제공해주는 라이브러리, Clojure의 기본 함수들은 정말 강력하고 까리한데.. 가아끔 아니 이게 없다고? 할때가 있다. 특히 string 다룰때 그때 Java interop 해서 쓰면 왠지 지는기분인데.. 전반적으로 유용한 함수들을 적절히 모아놓은 라이브러리가 바로 이것 설명에서는 꿀 한 스푼과 클로..
[Clojure] clojure to xlsx (Excel) github.com/mjul/docjure mjul/docjure Read and write Office documents from Clojure. Contribute to mjul/docjure development by creating an account on GitHub. github.com OpenXML 를 지원하는 Java API 인 org.apache.poi 을 clojure에서 아주 편하게 쓸수있게 해주는 라이브러리 간단한 사용 예제 (use 'dk.ative.docjure.spreadsheet) ;; Create a spreadsheet and save it (let [wb (create-workbook "Price List" [["Name" "Price"] ["Foo Widget" 100..