This script is created as an example to show how easy it is to use gstorm to crunch and consume data from rest apis.
Either download the script and run:
groovy ghstarred.groovy <your_github_id>
Or hotload it:
This script is created as an example to show how easy it is to use gstorm to crunch and consume data from rest apis.
Either download the script and run:
groovy ghstarred.groovy <your_github_id>
Or hotload it:
(ns variant | |
(:require [clojure.core.typed :as t])) | |
(t/defalias V | |
(t/Rec [V] | |
(t/U '[':lambda t/Sym V] | |
'[':if V V V] | |
'[':val t/Any]))) | |
(t/ann command [V -> t/Str]) |
(defmacro defvariant | |
[name [[tag & variant-binders] & other-binders] body] | |
`(defmethod ~name ~tag [[_# ~@variant-binders] | |
~@other-binders] | |
~body) | |
[name [tag & binders] body] | |
`(defmethod ~name ~tag [[_# ~@binders]] ~body)) | |
; CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(/tmp/form-init8620656005427572977.clj:1:1) |
(ns variants-playground.core | |
(:require [clojure.core.typed :as t :refer [cf defalias ann U Value Str HVec HMap]] | |
[clojure.core.match :refer [match]])) | |
(defmacro Variant [& lst] | |
`(U ~@(for [[tag & items] lst] | |
`(HVec [(Value ~tag) | |
(HMap :mandatory ~@items)])))) | |
(println (macroexpand '(Variant [:foo {:bar Str}]))) |
(defn download-report [{:keys [client date] :as state}] | |
;; snip | |
(assoc state :file downloaded-file)) | |
(defn upload-to-s3 [{:keys [file] :as state}] | |
;; snip | |
(assoc state :bucket bucket :key key)) | |
(defrecord Transition [op next-state]) |
(defmulti transmogrify | |
"Rewrites the last form of a thread-last to use transducer (if possible)." | |
(fn [f xform src & args] f)) | |
(defmacro transmogrify->> | |
"Like ->> but uses transducers" | |
([x] x) | |
([src & xs] | |
(let [end (last xs) | |
xforms (butlast xs) |
import com.intellij.openapi.actionSystem.AnActionEvent | |
import com.intellij.openapi.editor.markup.EffectType | |
import com.intellij.openapi.editor.markup.HighlighterTargetArea | |
import com.intellij.openapi.editor.markup.TextAttributes | |
import com.intellij.openapi.actionSystem.AnActionEvent | |
import com.intellij.openapi.actionSystem.LangDataKeys | |
import com.intellij.psi.PsiElement | |
import com.intellij.psi.PsiFile | |
import com.intellij.psi.PsiRecursiveElementWalkingVisitor |
;; 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]])) |
import com.intellij.openapi.actionSystem.AnActionEvent | |
import com.intellij.openapi.actionSystem.LangDataKeys | |
import com.intellij.openapi.editor.Document | |
import com.intellij.openapi.editor.markup.EffectType | |
import com.intellij.openapi.editor.markup.HighlighterTargetArea | |
import com.intellij.openapi.editor.markup.TextAttributes | |
import com.intellij.openapi.util.Condition | |
import com.intellij.psi.PsiDocumentManager | |
import com.intellij.psi.PsiElement | |
import com.intellij.psi.PsiFile |
(ns levenshtein | |
^{:doc "A purely functional implementation of the levenshtien distance in clojure"}) | |
(defn- compute-next-row | |
"computes the next row using the prev-row current-element and the other seq" | |
[prev-row current-element other-seq pred] | |
(reduce | |
(fn [row [diagonal above other-element]] | |
(let [update-val | |
(if (pred other-element current-element) |