This file contains hidden or 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
| var transactionalTryStatement = function(body, handlerId, handler, finalizer) { | |
| return bind(getState, function(state) { // Get the current state. | |
| return tryStatement( // Then evaluate a try statement with an exception handler that | |
| body, // restores the saved state and executes the passed in handler. | |
| handlerId, | |
| next(setState(state), handler), | |
| finalizer); | |
| }); | |
| }; |
This file contains hidden or 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
| var _ = {}; | |
| var placeholder = function(f /*, ...*/) { | |
| var bound = [].slice.call(arguments, 1); | |
| return function(/*...*/) { | |
| var indx = 0; | |
| return f.apply(f, [].reduce.call(arguments, function(p, c) { | |
| while (indx in bound) { | |
| var val = bound[indx]; | |
| if (val === _) |
This file contains hidden or 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
| model.location.subscribe(\current -> { | |
| if (current && current.start) | |
| cm.removeLineClass(current.start.line - 1, 'background', 'active-line'); | |
| }, null, 'beforeChange'); | |
| model.location.subscribe(\x -> { | |
| if (x) | |
| cm.addLineClass(x.start.line - 1, 'background', 'active-line'); | |
| }); |
This file contains hidden or 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
| var fac = let | |
| facImpl = \n, sum -> | |
| (n ? ['fac', n - 1, n * sum] : ['done', sum]), | |
| trampoline = \k -> { | |
| while (true) { | |
| switch (k[0]) { | |
| case 'done': return k[1]; | |
| case 'fac': k = facImpl(k[1], k[2]); break | |
| } |
This file contains hidden or 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
| var idToken = letter; | |
| var divToken = character('/'); | |
| var regularExpressionToken = binds( | |
| enumeration( | |
| between(character('/'), character('/'), | |
| eager <| many(letter)), | |
| optional('', letter)), | |
| \body, flag -> | |
| always('/' + body +'/' + flag + ')')); |
This file contains hidden or 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 | |
| KHEPRI="khepri" | |
| OPTIONS="" | |
| SRC=lib | |
| DEST=dist | |
| DEST_NODE=dist_node | |
| function _compile { |
This file contains hidden or 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
| var words = function(count, wl) { | |
| var out = []; | |
| for (var i = 0; i < count; ++i) { | |
| var len = Math.ceil(Math.random() * wl); | |
| var w = ''; | |
| while (len--) | |
| w += String.fromCharCode('a'.charCodeAt(0) + Math.floor(Math.random() * 26)) | |
| out.push(w); | |
| } | |
| return out; |
This file contains hidden or 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
| with | |
| import 'akh::base' {liftM2}, | |
| import 'akh::dcont' {runDCont of shift reset} | |
| in { | |
| var list = liftM2 @ \x y -> [x, y]; | |
| runDCont( | |
| reset \ p -> | |
| liftM2((+), | |
| shift @ p \k -> |
This file contains hidden or 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
| // Example only shows expansion logic, not perfect forwarding | |
| template<class F, class T, size_t... I> | |
| auto unpack(F f, T t, std::index_sequence<I...>) { | |
| return f(std::get<I>(t)...); | |
| } | |
| template<class F, class T> | |
| auto tuple_eval(F f, T arg) { | |
| return unpack(f, args, std::make_index_sequence<std::tuple_size<T>::value>()); | |
| } |
This file contains hidden or 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
| #include <utility> | |
| using iochar = char; | |
| using memval = unsigned char; | |
| /* BF Memory Cell */ | |
| template <memval val = 0> | |
| struct Cell { | |
| enum { value = val }; | |