- Seiya Konno
- Works at Uniba Inc. (http://uniba.jp)
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
theory subseq imports "~~/src/HOL/Hoare/Hoare_Logic" begin | |
definition is_subseq :: "'a list => 'a list => bool" where | |
"is_subseq xs ys == | |
(\<exists>c. | |
(\<forall>i. i + 1 < length ys --> c i < c (i + 1)) | |
\<and> (length ys > 0 \<longrightarrow> c (length ys - 1) < length xs) | |
\<and> (\<forall>i. i < length ys \<longrightarrow> ys ! i = xs ! (c i)))" | |
fun is_subseq2 :: "'a list => 'a list => bool" where |
明けましておめでとうございます. @susisu2413 です.
この記事は OUCC アドベントカレンダー 2014 21日目の記事です. 昨日は @spring_raining 氏による大学のグループ開発でgitを布教する方法でした.
盛んに「関数型で脱アルゴリズム」などと叫ばれる昨今ですが, その真偽はさておき,
処理の単位として関数を用いるのは処理の一般化や再利用をする場合に役に立つことが多いです (たぶん).
関数型っぽい処理としては, 生の JavaScript では Array
のメソッドに map
, filter
, reduce
などがあります
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
$ echo 'import Dispatch; func f() {}; DispatchQueue.global(qos: .default).async { f() }; dispatchMain()'|swiftc - | |
$ lldb | |
(lldb) target create main | |
Current executable set to 'main' (x86_64). | |
(lldb) b f | |
Breakpoint 1: 9 locations. | |
(lldb) process launch -v DYLD_LIBRARY_PATH=/usr/lib/system/introspection -v DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib | |
Process 33297 launched: '/Users/norio/github/swift-dev/SourceKitten/main' (x86_64) | |
Process 33297 stopped | |
* thread #2, queue = 'com.apple.root.default-qos', stop reason = breakpoint 1.1 |
func c(_ g: @escaping (Int) -> Void) {}
func a() {
let f: ((Int) -> Void) -> Void
f = { (g) -> Void in
c(g)
}
}
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
class Number {} | |
class Zero : Number {} | |
class Succ<N:Number> : Number {} | |
typealias One = Succ<Zero> | |
typealias Two = Succ<Succ<Zero>> | |
typealias Three = Succ<Succ<Succ<Zero>>> | |
class Eq<S: Number, T: Number> {} | |
class Add<S: Number, T:Number> : Number {} |
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
class Binding | |
def return_if(name) | |
eval "return #{name}" if local_variable_get(name) | |
end | |
end | |
def foo(v) | |
binding.return_if(:v) | |
'v is nil' | |
end |
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
Set<String> keys = map.keySet(); | |
for (String key : keys) { | |
//some condes | |
} | |
//↑が↓になった | |
Set<String> keys = map.keySet(); | |
String[] keyarray = keys.toString().split(","); | |
for(int i=0; i<keyarray.length; i++){ |
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
#!/bin/sh | |
nc -w 10 $IRC_SERVER 6667 << EOF &>/dev/null | |
PASS $IRC_PASS | |
NICK $IRC_NICK | |
USER $IRC_NICK 8 * : $IRC_NICK | |
JOIN $IRC_CH | |
PRIVMSG $IRC_CH : $1 | |
QUIT | |
EOF |