Skip to content

Commit

Permalink
ported to pink-gorilla
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Oct 16, 2019
1 parent ceafdd7 commit fabe443
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# core-matrix-gorilla
# pinkgorilla-ui-core-matrix

[core.matrix](https://github.com/mikera/core.matrix) integration with [Gorilla REPL](http://gorilla-repl.org) that enables us to view core.matrix datasets as HTML tables in Gorilla-repl worksheets.
[core.matrix](https://github.com/mikera/core.matrix) integration with [Pink Gorilla REPL] that enables us to view core.matrix datasets as HTML tables in PinkGorilla-repl worksheets.

## Usage

Expand Down
4 changes: 4 additions & 0 deletions buildDeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

lein uberjar
lein deploy clojars

19 changes: 12 additions & 7 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
(defproject core-matrix-gorilla "0.1.0"
:description "Gorilla REPL integration for core.matrix datasets"
:url "https://github.com/shark8me/core-matrix-gorilla"
(defproject pinkgorilla-ui-core-matrix "0.1.0"
:description "PinkGorilla REPL integration for core.matrix datasets"
:url "https://github.com/pinkgorillawb/core-matrix-gorilla"
:license {:name "MIT"}
:dependencies [[org.clojure/clojure "1.8.0"]
[gorilla-renderable "1.0.0"]
[org.clojure/data.codec "0.1.0"]
[net.mikera/core.matrix "0.56.0"]])
:repositories [["clojars" {:url "https://clojars.org/repo"
:username "pinkgorillawb"
:sign-releases false}]]
:dependencies
[[org.clojure/clojure "1.8.0"]
[net.mikera/core.matrix "0.56.0"]
[org.clojure/data.codec "0.1.0"]
[org.clojars.deas/gorilla-renderable "2.1.0"] ;PinkGorilla Renderable
])
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(ns core-matrix-gorilla.render
(:require [clojure.data.codec.base64 :as b64]
[clojure.core.matrix.impl.dataset :as md]
[clojure.core.matrix.dataset :as cd]
[clojure.core.matrix :as cm]
[gorilla-renderable.core :as render]))
(ns pinkgorilla.ui.core-matrix
(:require
[clojure.data.codec.base64 :as b64]
[clojure.core.matrix.impl.dataset :as md]
[clojure.core.matrix.dataset :as cd]
[clojure.core.matrix :as cm]
[gorilla-renderable.core :as render] ;pink-gorilla Renderable
))

(defn list-like
"util function used in render"
Expand Down Expand Up @@ -37,17 +39,19 @@

;;Created another type just to pass parameters such as num rows and num columns to mview function
(defrecord AbridgedMatrixView [contents opts])

(extend-type AbridgedMatrixView
render/Renderable
(render [self & opts] (renderfn (:contents self) (:opts self))))

(defn mview
"view the dataset. Accepts an optional map with :nrows and :ncols keys for
number of rols and/or columns to display"
([^clojure.core.matrix.impl.dataset.DataSet dset] (mview dset {}))
([^clojure.core.matrix.impl.dataset.DataSet dset {:keys [nrows ncols] :or {nrows 10 ncols 10} :as opts}]
(AbridgedMatrixView. dset opts)))

(extend-type AbridgedMatrixView
render/Renderable
(render [self & opts] (renderfn (:contents self) (:opts self))))



;extend dataset type to show in gorilla-repl interface
(extend-type clojure.core.matrix.impl.dataset.DataSet
Expand Down

0 comments on commit fabe443

Please sign in to comment.