Apple recently released a language called Swift. As a language it appears to be the best of both worlds -- a script language that emits native codes. But I've got a feeling it means more than just a language. The talk roughly consists of 4 parts as follows: * Introducing Swift * Script Languages vs "Compiler" Languages * Free Software vs. Open Source * The Sunset of Our CultureRead less
println(2.isPrime) // true println(42.isPrime) // false println(0x7FFFffff.isPrime) // true (M31) println(0.nextPrime) // 2 println(Int.max.prevPrime) // 9223372036854775783 on OS X println(Int.Prime.within(0..<100)) // [2, 3, 5, 7, ... 97] println(Int.Prime.within(Int.max-100..<Int.max)) // [9223372036854775783] DESCRIPTION 0...UInt.maxの範囲でまともな速度で判定します。 判定は軽く試し割りした後Miller-Rabin法で。後者は確率的アルゴリズムですが、
Swiftではデフォルト状態だとtupleの比較が出来ないというのは以前書いた通りだが、関数どうしも===できないので、出来るようにしてみた。 SYNOPSIS func peekFunc<A,R>(f:A->R)->(fp:Int, ctx:Int) { // let (hi, lo):(Int, Int) = reinterpretCast(f) typealias IntInt = (Int, Int) let (hi, lo) = unsafeBitCast(f, IntInt.self) let offset = sizeof(Int) == 8 ? 16 : 12 let ptr = UnsafePointer<Int>(lo+offset) return (ptr.memory, ptr.successor().memory) } @infix func === <A,R>(
2017年07月20日09:00 カテゴリVALU If you can't beat them, join them. 君子は豹変す ⇔ 豹変しなけりゃ君子じゃない。続きを読む dankogai コメント( 1 ) 2017年03月19日16:30 カテゴリevalparkOpen Source evalpark - Swift入園しました というわけでおしらせです。続きを読む dankogai コメント( 0 )トラックバック( 0 ) 2017年03月17日10:30 カテゴリevalparkOpen Source ようこそevalparkへ え?もう本番ですか…? Welcome to Evalpark! 続きを読む dankogai コメント( 0 )トラックバック( 0 ) 2015年12月03日19:30 カテゴリMath 「「0÷0=」を実行すると「エラー」になる理由」を見
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く