如果我的结构是
{ :a :A
:b :B
:c {
:d :D
}
:e {
:f {
:g :G
:h :H
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想得到一个函数调用keys-in返回类似的东西:
[[:a] [:b] [:c :d] [:e :f :g] [:e :f :h]]
Run Code Online (Sandbox Code Playgroud)
所以我可以这样做:
(not-any? nil? (map #(get-in my-other-map %1) (keys-in my-map)))
Run Code Online (Sandbox Code Playgroud)
所以我可以肯定它my-other-map具有相同的键my-map
我想检查一下git存储库的总大小.有趣的是,当发送-h标志时,du给了我两个不同大小的国王.它实际上是双倍大小.
为什么是这样?什么是正确的尺寸?
MyMac:~/repositories/my-repo.git davidrod$ du -h
0B ./branches
64K ./hooks
4.0K ./info
0B ./objects/info
3.3M ./objects/pack
3.3M ./objects
4.0K ./refs/heads
8.0K ./refs/tags
12K ./refs
3.3M .
MyMac:~/repositories/my-repo.git davidrod$ du
0 ./branches
128 ./hooks
8 ./info
0 ./objects/info
6672 ./objects/pack
6672 ./objects
8 ./refs/heads
16 ./refs/tags
24 ./refs
6856 .
Run Code Online (Sandbox Code Playgroud) 想象一下,在 rails 中,我有@template一个ActionTemplate::View.
问题是:我怎样才能将@template@template.source转换<%= "hello from erb" %>成hello from erb?? 谢谢