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
    
  
  
    
  | /* | |
| ============================================================================ | |
| Name : Buffer.c | |
| Author : Jooyung Han | |
| Version : | |
| Copyright : | |
| Description : Hello World in C, Ansi-style | |
| ============================================================================ | |
| */ | 
  
    
      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
    
  
  
    
  | // | |
| // main.c | |
| // ant | |
| // | |
| // Created by Jooyung Han on 1/31/16. | |
| // Copyright © 2016 Jooyung Han. All rights reserved. | |
| // | |
| #include <stdio.h> | |
| #include <stdlib.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
    
  
  
    
  | {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} | |
| module Lib | |
| ( | |
| kMeans | |
| ) where | |
| import GHC.Exts (groupWith) | |
| import Data.List (transpose, sort) | |
| import Data.List.Split (chunksOf) | 
  
    
      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 main | |
| import "fmt" | |
| type genf func(chan<- uint8) | |
| func gen(f genf) <-chan uint8 { | |
| c := make(chan uint8) | |
| go f(c) | |
| return c | 
  
    
      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 nn [s] (->> s (partition-by identity) (mapcat (juxt count first)))) | |
| (defn ant [] (iterate nn [1])) | |
| (-> (ant) (nth 1000000) (nth 1000000)) | 
  
    
      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
    
  
  
    
  | process.on('message', function(message) { | |
| console.log("message received", message); | |
| process.send(message.toUpperCase(), function(err) { | |
| console.log("replied",err); | |
| }); | |
| }); | 
  
    
      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
    
  
  
    
  | function* Init() { | |
| yield 1; | |
| } | |
| function* Next(it) { | |
| var prev = it.next().value; | |
| var count = 1; | |
| for (let n of it) { | |
| if (n == prev) { | |
| count++; | 
  
    
      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 csp = require("js-csp"); | |
| function Init() { | |
| return csp.go(function* () { | |
| return 1; | |
| }); | |
| } | |
| function Next(i) { | |
| var out = csp.chan(); | 
  
    
      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
    
  
  
    
  | /** | |
| * @template T, S | |
| * @param {[T]} items | |
| * @param {function(T):Promise<S>} f | |
| * @return {Promise<[S]>} | |
| */ | |
| function traverse(items, f) { | |
| if (items.length == 0) { | |
| return Promise.resolve([]); | |
| } | 
  
    
      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
    
  
  
    
  | const ant = function *(s = "1") { | |
| yield s; | |
| yield* ant(s.replace(/(.)\1?\1?/g, g => g.length + g[0])); | |
| } | |
| for (var i=0, a = ant(); i++<10; ) { | |
| console.log(a.next().value) | |
| } |