如何在Light Table 0.6.0中激活vim模式.文档在编辑器模式中说只是键入"vim"并且它将自动完成,但现在它没有?我应该为用户行为添加什么?
{:+ {
;; The app tag is kind of like global scope. You assign behaviors that affect
;; all of Light Table here
:app [(:lt.objs.style/set-skin "dark")]
;; The editor tag is applied to all editors
:editor [:lt.objs.editor/no-wrap
(:lt.objs.style/set-theme "default")]
;; Here we can add behaviors to just clojure editors
:editor.clojure [(:lt.objs.langs.clj/print-length 1000)]}
;; You can use the subtract key to remove behavior that may get added by
;; another diff
:- {:app []}}
Run Code Online (Sandbox Code Playgroud) 我有一个带有奇怪编码"UCS-2 Little Endian"的文本文件,我想用Java读取它的内容.

正如您在上面的屏幕截图中看到的那样,文件内容在Notepad ++中显得很好,但是当我使用此代码读取它时,只是在控制台中打印垃圾:
String textFilePath = "c:\strange_file_encoding.txt"
BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( filePath ), "UTF8" ) );
String line = "";
while ( ( line = reader.readLine() ) != null ) {
System.out.println( line ); // Prints garbage characters
}
Run Code Online (Sandbox Code Playgroud)
重点是用户选择要读取的文件,因此它可以是任何编码,并且因为我无法检测文件编码,所以我使用"UTF8"对其进行解码,但如上例所示,它无法正确读取.
有没有以正确的方式阅读这些奇怪的文件?或者至少可以检测出我的代码是否无法正确读取它?
是否可以在Clojure中为匿名函数执行var args?
例如,我该怎么转:
(#(reduce + (map * %1 %2 %3)) [1 2 3] [4 5 6] [7 8 9])
Run Code Online (Sandbox Code Playgroud)
变成像,
(#(reduce + (map * [& args])) [1 2 3] [4 5 6] [7 8 9])
Run Code Online (Sandbox Code Playgroud) 我试图让所有"移动"分区大小为k的字符串.基本上,我想沿着字符串移动一个大小为k的窗口并获得该k字.
这是一个例子,
k:3
输入:ABDEFGH
输出:ABD,EFG,BDE,FGH,DEF
我的想法是沿着输入走,放下一个头和分区,然后从先前(现在无头)序列再次掉头,但我不确定如何做到这一点...而且,也许有更好的方法这样做?以下是我的想法.
(#(partition k input) (collection of s where head was consecutively dropped))
Run Code Online (Sandbox Code Playgroud) 我不确定这是发布的最佳地点,但为什么不工作呢?线程宏不会将seq的结果传递给(map str)?
;; 1
(map str (seq (str (* 8 8)))) -> ("6" "4")
;; 2
(defn a [x y]
(-> (* x y)
str
seq
(map str)))
(a 8 8) -> Don't know how to create ISeq from: clojure.core$str
Run Code Online (Sandbox Code Playgroud) 如何创建正则表达式以匹配看起来像的字符串,
7440-44-0
Run Code Online (Sandbox Code Playgroud)
其中每个组由数字组成,组由连字符分隔,第二组(44)正好是两个字符长,最后一组(0)恰好是一个字符长?
这是我尝试过的,但我还在学习正则表达式.
Pattern.compile("[.\\d]-[\\d]{2}-[\\d]{1}")
Run Code Online (Sandbox Code Playgroud)