Skip to content

Instantly share code, notes, and snippets.

View Kuniwak's full-sized avatar
💭
I may be slow to respond.

Yuki Kokubun Kuniwak

💭
I may be slow to respond.
View GitHub Profile
func c(_ g: @escaping (Int) -> Void) {}

func a() {
    let f: ((Int) -> Void) -> Void
    
    f = { (g) -> Void in
        c(g)
    }
}
@norio-nomura
norio-nomura / terminal.sh-session
Last active August 26, 2018 06:38
How to use `thread backtrace -e true` in `lldb`.
$ 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
@hatsugai
hatsugai / subseq.thy
Created May 7, 2020 06:25
subsequence
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