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
;;; Project Euler Problem 6 | |
;;; 「二乗の和と和の二乗の差はいくつか?」 | |
;;; http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%206 | |
(use 'clojure.test) | |
(defn sum-of-squares | |
"与えられた数列についてその二乗の和を返します" | |
[nums] | |
(apply + (map #(* % %) nums))) |
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
;;; Project Euler Problem 3 | |
;;; http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%203 | |
(use 'clojure.test) | |
(defn prime? | |
[n] | |
(if (= 1 n) | |
false | |
(every? (complement #(zero? (rem n %))) |
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
augroup clojure-extension | |
autocmd! | |
autocmd FileType vimclojure.clojure call s:vimclojure.define_repl_key_mappings() | |
augroup END | |
let s:vimclojure = {} | |
function! s:vimclojure.define_repl_key_mappings() | |
" define favorite key mappings here. | |
imap <buffer> <silent> <C-n> <Plug>ClojureReplDownHistory. | |
imap <buffer> <silent> <C-p> <Plug>ClojureReplUpHistory. |
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
augroup clojure-extension | |
autocmd! | |
autocmd FileType clojure call s:vimclojure.define_repl_key_mappings() | |
augroup END | |
let s:vimclojure = {} | |
function! s:vimclojure.define_repl_key_mappings() | |
if self.repl_buffer_p() | |
" define favorite key mappings here. | |
imap <buffer> <silent> <C-n> <Plug>ClojureReplDownHistory. |
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
(defn api-names-for-each-version-in-ns | |
[ns-sym] | |
(->> (ns-publics ns-sym) | |
vals | |
(map meta) | |
(filter :added) | |
(map (fn [{:keys [name added]}] {added [name]})) | |
(apply merge-with concat))) |
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
function! any_plugin#util#lock_constants(scope) | |
for name in keys(a:scope) | |
if name =~# '^\u' | |
lockvar! a:scope[name] | |
endif | |
endfor | |
endfunction |
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
function! any_plugin#util#define_boolean(scope) | |
let a:scope.FALSE = 0 | |
let a:scope.TRUE = !a:scope.FALSE | |
endfunction |
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
let g:kr4mb_identifier_aliases = { | |
\ 'to_dvorak': 'private.remap.device_kinesis_qwerty2dvorak_qwerty' | |
\ } | |
command! -nargs=0 DvorakEnable | |
\ KR4MBEnable to_dvorak | |
command! -nargs=0 DvorakDisable | |
\ KR4MBDisable to_dvorak | |
command! -nargs=0 DvorakToggle | |
\ KR4MBToggle to_dvorak |
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
" ユーザ定義コマンドが使えるようにプラグインの読み込みを行なう。 | |
call prefixedmap#load() | |
PrefixedMapBegin <SID>[Tag] | |
Pnnoremap <Nop> | |
Pnnoremap <silent> <Space> <C-]> | |
Pnnoremap <silent> j :<C-u>tag<CR> | |
Pnnoremap <silent> k :<C-u>pop<CR> | |
Pnnoremap <silent> s :<C-u>tags<CR> | |
Pnnoremap <silent> n :tnext<CR> |
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
PrefixedMapBegin <SID>[Tag] | |
" {map-command} {map-arguments} <Nop> | |
" -> {map-command} {map-arguments} {prefix-key} <Nop> | |
nnoremap <Nop> | |
" {map-command} {map-arguments} {lhs} {rhs} | |
" -> {map-command} {map-arguments} {prefix-key}{lhs} {rhs} | |
nnoremap <silent> <Space> <C-]> | |
nnoremap <silent> j :<C-u>tag<CR> | |
nnoremap <silent> k :<C-u>pop<CR> | |
nnoremap <silent> s :<C-u>tags<CR> |