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
fatal error: Test!: file fatalErrorTest/main.swift, line 3 | |
Current stack trace: | |
0 libswiftCore.dylib 0x000000011af5910a reportBacktrace() + 42 | |
1 libswiftCore.dylib 0x000000011af58d8d reportOnCrash(char const*) + 45 | |
2 libswiftCore.dylib 0x000000011af58ece swift_reportFatalErrorInFile + 190 | |
3 libswiftCore.dylib 0x000000011ab76cf0 Swift.(_assertionFailed (Swift.StaticString, Swift.String, Swift.StaticString, Swift.UInt) -> ()).(closure #1).(closure #1).(closure #1) + 336 | |
4 libswiftCore.dylib 0x000000011af0fc17 partial apply forwarder for Swift.(_assertionFailed (Swift.StaticString, Swift.String, Swift.StaticString, Swift.UInt) -> ()).(closure #1).(closure #1).(closure #1) + 103 | |
5 libswiftCore.dylib 0x000000011ab761b7 reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@unowned ()) to @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@o |
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
Current stack trace: | |
0 libswiftCore.dylib 0x000000011040010a reportBacktrace() + 42 | |
1 libswiftCore.dylib 0x00000001103ffd8d reportOnCrash(char const*) + 45 | |
2 libswiftCore.dylib 0x00000001103ffece swift_reportFatalErrorInFile + 190 | |
3 libswiftCore.dylib 0x000000011001dcf0 Swift.(_assertionFailed (Swift.StaticString, Swift.String, Swift.StaticString, Swift.UInt) -> ()).(closure #1).(closure #1).(closure #1) + 336 | |
4 libswiftCore.dylib 0x00000001103b6c17 partial apply forwarder for Swift.(_assertionFailed (Swift.StaticString, Swift.String, Swift.StaticString, Swift.UInt) -> ()).(closure #1).(closure #1).(closure #1) + 103 | |
5 libswiftCore.dylib 0x000000011001d1b7 reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@unowned ()) to @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@out ()) + 23 | |
6 libswiftCore.dylib 0x00000 |
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 CCairo | |
class Surface { | |
private let surface: COpaquePointer | |
private let cr: COpaquePointer | |
init(format: cairo_format_t, width: Int, height: Int) { | |
self.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 240, 80) | |
self.cr = cairo_create(surface) | |
} | |
func writeToPNG(filename: String) { |
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 qualified Data.ByteString.Lazy.Char8 as L8 | |
import Data.Digest.Pure.MD5 (md5) | |
md5List l = zip (map (md5 . L8.pack . ("yzbqklnj" ++) . show) l) l | |
main = print $ filter (\(x,_) -> "00000" == take 5 (show x)) (md5List [0..]) |
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
(def fact (n) | |
(if (= n 0) | |
1 | |
(* n (fact (- n 1))))) |
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
define private i64 @fact(i64 %n) { | |
entry: | |
%n1 = alloca i64 | |
store i64 %n, i64* %n1 | |
%n2 = load i64, i64* %n1 | |
%eqtmp = icmp eq i64 %n2, 0 | |
%0 = sext i1 %eqtmp to i64 | |
%ifcond = icmp ne i64 %0, 0 | |
br i1 %ifcond, label %then, label %else |
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
func main() { | |
var z = 0 | |
func goto(label: String) { | |
switch label { | |
case "start": | |
goto("cond") | |
case "cond": | |
if z == 5 { | |
goto("end") | |
} else { |
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 Darwin | |
func printFile(fileName: String) { | |
var line: UnsafeMutablePointer<Int8> = nil | |
var len = 0 | |
var read = 0 | |
let file = fopen(fileName, "r") | |
guard file != nil else { return } | |
func goto(label: String) { | |
switch label { |
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
func while_(@autoclosure(escaping) cond: () -> Bool, body: () -> ()) { | |
func goto(label: String) { | |
switch label { | |
case "cond": goto(cond() ? "body" : "end") | |
case "body": | |
body() | |
goto("cond") | |
case "end": | |
fallthrough | |
default: break |
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
struct Goto { | |
typealias Closure = () -> () | |
var closures = [String: Closure]() | |
func to(label: String) { | |
guard let closure = closures[label] else { | |
fatalError("Unknown label: \(label)") | |
} | |
closure() | |
} | |
mutating func set(label: String, closure: () -> ()) { |