apt-get update
apt-get install -y zlib1g-dev libncurses5-dev ghc cabal-install happy alex
cabal update
cabal install cabal-install
export PATH=$HOME/.cabal/bin:./.cabal-sandbox/bin:$PATH
#!/bin/sh | |
#_( | |
#_DEPS is same format as deps.edn. Multiline is okay. | |
DEPS=' | |
{:deps {clj-time {:mvn/version "0.14.2"}}} | |
' | |
#_You can put other options here | |
OPTS=' |
--[[ | |
* ReaScript Name: Parent script | |
* About: For devs | |
* Author: X-Raym | |
* Author URI: https://www.extremraym.com | |
* Repository: X-Raym/REAPER-ReaScripts | |
* Licence: GPL v3 | |
* REAPER: 5.0 | |
* Version: 1.0 | |
--]] |
object TransducerUniversal { | |
type Reduct[-A, R] = (R, A) => R | |
trait Trans[+A, -B] { def apply[R](f: Reduct[A, R]): Reduct[B, R] } | |
def map[A, B](f: A => B): Trans[B, A] = new Trans[B, A] { def apply[R](rf: Reduct[B, R]) = (r, a) => rf(r, f(a)) } | |
def filter[A](p: A => Boolean): Trans[A, A] = new Trans[A, A] { def apply[R](rf: Reduct[A, R]) = (r, a) => if (p(a)) rf(r, a) else r } | |
def comp[A,B,C](t1 : Trans[A, B], t2 : Trans[C, A]): Trans[C, B] = new Trans[C, B] { def apply[R](rf: Reduct[C, R]) = t1(t2(rf)) } | |
def sequence[A, B](t: Trans[B, A], data: Seq[A]) = data.foldLeft(Seq[B]())(t(_ :+ _)) | |
implicit class Compable[A,B](t1: Trans[A, B]) { |
(defmacro test-> | |
"Takes an expression and a set of test/form pairs. Threads expr (via ->) | |
through each form for which the corresponding test expression (not threaded) is true." | |
[expr | |
& clauses] | |
(assert (even? (count clauses))) | |
(let [g (gensym) | |
pstep (fn [[test step]] `(if ~test (-> ~g ~step) ~g))] | |
`(let [~g ~expr | |
~@(interleave (repeat g) (map pstep (partition 2 clauses)))] |
(ns datomic-play.core | |
(:use [datomic.api :only [db q] :as d]) | |
(:require [clojure.core.logic :as l] | |
[clojure.pprint :as pp])) | |
(def uri "datomic:dev://localhost:4334/hello") | |
(defprotocol IUnifyWithDatum | |
(unify-with-datum [u v s])) |
(defn analysis->map | |
"Convert Java Object expr into nested maps" | |
; result type: | |
; (rec X (U {:op :def | |
; :env {:source Object | |
; :line Object} | |
; :var Var} | |
; {:op :if | |
; :env {:source Object | |
; :line Object} |
;; outlet code for implementing traditional macro expansion | |
;; macros | |
(define (expand form) | |
(cond | |
((variable? form) form) | |
((literal? form) form) | |
((macro? (car form)) | |
(expand ((macro-function (car form)) form))) |
(defproject clojurescript "0.1.0-SNAPSHOT" | |
:source-path "src/clj" | |
:dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]]) |