Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
- 更新
2014-11-20
- バージョン
0.0.5
- 作者
@voluntas
- URL
概要
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
{:user {:dependencies [[org.clojure/tools.namespace "0.2.3"] | |
[spyscope "0.1.3"] | |
[criterium "0.4.1"]] | |
:injections [(require '(clojure.tools.namespace repl find)) | |
; try/catch to workaround an issue where `lein repl` outside a project dir | |
; will not load reader literal definitions correctly: | |
(try (require 'spyscope.core) | |
(catch RuntimeException e))] | |
:plugins [[lein-pprint "1.1.1"] | |
[lein-beanstalk "0.2.6"] |
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
import PIL.Image | |
from cStringIO import StringIO | |
import IPython.display | |
import numpy as np | |
def showarray(a, fmt='png'): | |
a = np.uint8(a) | |
f = StringIO() | |
PIL.Image.fromarray(a).save(f, fmt) | |
IPython.display.display(IPython.display.Image(data=f.getvalue())) |
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
Show hidden characters
// installed Clojure packages: | |
// | |
// * BracketHighlighter | |
// * lispindent | |
// * SublimeREPL | |
// * sublime-paredit | |
{ | |
"word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?", | |
"paredit_enabled": true, |
この記事のあの画像を見てビビッと来てしまったので, 周りにいる人とErgodoxの購入検討をはじめました(随時更新)
➜ FalbaTech
選んでいくスタイル。
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
import chainermn | |
from chainermn.communicators._memory_utility import array_to_buffer_object | |
import mpi4py.MPI | |
comm = chainermn.create_communicator('naive') | |
def alltoall_demo(xp): | |
mpi_comm = comm.mpi_comm |
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
// A B C D E F G H I J K M | |
// 0 1 2 3 4 5 6 7 8 9 10 11 | |
struct HKeys { | |
static const uint64 T0[12][8]; | |
static const uint64 T1[12][8]; | |
uint64 poi(uint64 key, uint64 level) | |
{ | |
return (key >> 3*level)&0x7ULL; | |
} |