Skip to content

Instantly share code, notes, and snippets.

Joe Groff jckarter

Block or report user

Report or block jckarter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jckarter
jckarter / async_swift_proposal.md
Created Aug 15, 2017 — forked from lattner/async_swift_proposal.md
Concrete proposal for async semantics in Swift
View async_swift_proposal.md

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@jckarter
jckarter / property.swift
Created May 1, 2015
Capture property getter/setter
View property.swift
public class Property<T> {
let getter: () -> T
let setter: T -> ()
public init(_ getter: () -> T, _ setter: T -> ()) {
self.getter = getter
self.setter = setter
}
public var value: T {
View gist:6757629
#include <vector>
struct vec4 {
float __attribute__((vector_size(16))) elts;
};
void putVec4(vec4 *out, const std::vector<float> &v) {
*out = {{v[0], v[1], v[2], v[3]}};
}
@jckarter
jckarter / factor-modules.md
Created Aug 23, 2012
Factor modules design
View factor-modules.md

A package system for Factor

Factor's current module system and development model is heavily monolithic, reflecting Factor's history as a small-scale hobby project. The default settings encourage development within the Factor source tree and make it difficult to accommodate packaged read-only installations or projects developed outside of the source tree. Altering the module search path to accommodate these use cases is currently a manual and error-prone process. This proposal describes a new model for module lookup and installation with the following improvements:

  • a standardized search path for modules, allowing for global, user-local, project-local, and
@jckarter
jckarter / tbb40-libc++-c++11-support.diff
Created Jul 21, 2012
Patch Intel Threading Building Blocks to support clang -std=c++11 -stdlib=libc++ on macosx
View tbb40-libc++-c++11-support.diff
diff -Nur -x 'macos_*' tbb40_20120613oss.orig/build/macos.clang-libcxx.inc tbb40_20120613oss/build/macos.clang-libcxx.inc
--- tbb40_20120613oss.orig/build/macos.clang-libcxx.inc 1969-12-31 16:00:00.000000000 -0800
+++ tbb40_20120613oss/build/macos.clang-libcxx.inc 2012-07-20 15:10:31.000000000 -0700
@@ -0,0 +1,11 @@
+include $(tbb_root)/build/macos.clang.inc
+
+LIBS += -stdlib=libc++
+CPLUS_FLAGS += -stdlib=libc++
+
+CPP11_FLAGS = -std=c++11 -D_TBB_CPP0X
View fml.md

fml

The function manipulation language

"I just implemented Conway's Game of Life in two lines of code. #fml"

pad = x flip[stitch] 0, stitch 0, flip[cat] 0, cat 0
life = pad, neighborhoods[3 3], [ravel, [sum in?: [x @ 4, + 3; 3]]]/2
@jckarter
jckarter / gist:1227286
Created Sep 19, 2011
+ methods in factor
View gist:1227286
( scratchpad ) \ + see-methods
USING: math math.private ;
M: bignum + bignum+ ; inline
USING: math math.complex.private ;
M: complex + [ + ] complex-op ; inline
USING: math math.private ;
M: fixnum + fixnum+ ; inline
You can’t perform that action at this time.