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
| (defprotocol RandomOperations | |
| (uniform [this]) | |
| (exponential [this rate]) | |
| (normal [this avg stddev]) | |
| (geometric [this rate])) | |
| (extend-protocol RandomOperations | |
| java.util.Random | |
| (uniform [this] |
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
| ;; code of a simple program that counts to zero. | |
| (def count-to-zero-code | |
| '(defn count-to-zero [n] | |
| (if (zero? n) | |
| 0 | |
| (count-to-zero (dec n))))) | |
| ;; simple AST | |
| (defrecord Function [name args body]) |
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
| (defn base->base | |
| [input-bit-width output-bit-width] | |
| (comp | |
| (number->bits input-bit-width) | |
| (partition-all output-bit-width) | |
| (map bits->number))) |
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
| import random | |
| import bisect | |
| from array import array | |
| def decode(n): | |
| return INDEX[n] | |
| class VertexSet(object): | |
| def __init__(self): | |
| self.items = array('H') |
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
| 'use strict'; | |
| const VERTEX_COUNT = 7*7*7*7*7; | |
| const VERTEX_DEGREE = 243; | |
| function buildGraph() { | |
| function* range(lo,hi) { | |
| var index = 0; | |
| for (var i = lo ; i < hi ; i++) { | |
| yield i; |
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
| <html> | |
| <body> | |
| <div> | |
| <div id="results"></div> | |
| <div> | |
| <script> | |
| 'use strict'; | |
| function appendResult(div, data) { | |
| var list = document.createElement("ul"); |
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
| package com.igal | |
| import java.lang.{Iterable => JavaIterable} | |
| import org.apache.flink.api.common.functions.{GroupReduceFunction, Partitioner} | |
| import org.apache.flink.api.common.operators.Order | |
| import org.apache.flink.api.java.utils.ParameterTool | |
| import org.apache.flink.api.scala.{DataSet, _} | |
| import org.apache.flink.util.Collector |
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
| FROM ubuntu:latest | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| autoconf \ | |
| libtool \ | |
| pkg-config \ | |
| libprotobuf-dev \ | |
| protobuf-compiler \ | |
| protobuf-compiler-grpc \ |
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
| Smoke Python Test | |
| ================= | |
| from datetime import timedelta | |
| from statefun import * | |
| ################################################################################ |
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
| type TodoItem = { | |
| title: string, | |
| completed: boolean, | |
| } | |
| export default restate.object({ | |
| name : "todo", | |
| handlers: { | |
| add: async (ctx: ObjectContext, item: TodoItem) => { | |
| const items = await ctx.get("items") ?? []; |
OlderNewer