This file contains 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 findByTitle: (String) -> (MutableList<Movie>) -> List<Movie> = | |
{ query -> { collection -> | |
val predicate = matches(query) | |
filter(predicate)(collection) | |
}} | |
val filter: ((Movie) -> Boolean) -> (List<Movie>) -> List<Movie> = | |
{ predicate -> { collection -> | |
collection.filter(predicate) | |
}} |
This file contains 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 findByTitle: (String) -> (MutableList<Movie>) -> List<Movie> = | |
{ query -> { collection -> | |
val predicate = matches(query) | |
filter(predicate)(collection) | |
}} | |
val filter: ((Movie) -> Boolean) -> (List<Movie>) -> List<Movie> = | |
{ predicate -> { collection -> | |
collection.filter(predicate) | |
}} |
This file contains 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
;; Copyright (c) Alan Dipert. All rights reserved. | |
;; The use and distribution terms for this software are covered by the | |
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; By using this software in any fashion, you are agreeing to be bound by | |
;; the terms of this license. | |
;; You must not remove this notice, or any other, from this software. | |
(ns alandipert.kahn | |
(:require [clojure.set :refer [difference union intersection]])) |
This file contains 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 core.sync.mutex : Mutex; | |
import core.thread : Thread, Fiber; | |
/** | |
* chan allows messaging between threads without having to deal with locks, similar to how chan works in golang | |
*/ | |
shared | |
class chan(T) { | |
Mutex lock; | |
private bool closed_; bool closed() {synchronized (lock) {return closed_;}} void Close() { synchronized(lock) { closed_ = true; } } |