Re: Saving / Loading a Datascript DB
Wukong, there’s also https://github.com/tonsky/datascript-transit Best, Nikita On Monday, September 26, 2016 at 7:15:16 PM UTC+7, Wukong Sun wrote: > > Hi, > > Is there a easy way to save/load a datascript DB to file? > > I'm not looking to use datomic. I just need a way to save my datascript > db to file and to read it later. > > Thanks! > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: First time using DataScript
Alan, On Tuesday, September 27, 2016 at 7:38:29 AM UTC+7, Alan Thompson wrote: > > Hi - I was answering a question on StackOverflow, and after solving it > using functions from clojure.core, I thought it was the prefect candidate > for a little DataScript. Basically the user wants to do a "natural join" > on column :obs/A, then print out pairs of :obs/value from type :x and type > :y. The DataScript version removes a lot of tedious, manual indexing, > filtering, unification, etc. > > > (ns clj.core > (:require [tupelo.core :as t] > [datascript.core :as d] > [clojure.set :as set] )) > (t/refer-tupelo) > > (def data > [ {:type :x :local/id 1, :obs/A "11",:obs/value 2.0, > :obs/color "yellow"} > {:type :x :local/id 2, :obs/A "12",:obs/value 4.0, > :obs/color "blue"} > {:type :x :local/id 3, :obs/A "13",:obs/value 3.0, > :obs/color "green"} > {:type :x :local/id 3, :obs/A "15",:obs/value 7.0, > :obs/color "red"} > > {:type :y :local/id 2, :obs/A "11",:obs/value 7.0, > :obs/shape "square"} > {:type :y :local/id 2, :obs/A "13",:obs/value 4.0, > :obs/shape "circle"} > {:type :y :local/id 6, :obs/A "15",:obs/value 3.0, > :obs/shape "triangle"} ] ) > > (newline) (println "data") (pretty data) > > (def conn (d/create-conn {})) > (d/transact! conn data) > > (def labelled-result > (d/q '[:find ?a ?value1 ?value2 > :where >[?ex :type :x] [?ex :obs/A ?a] [?ex :obs/value ?value1] >[?ey :type :y] [?ey :obs/A ?a] [?ey :obs/value ?value2] > ] @conn )) > (newline) (println "labelled-result") (pretty labelled-result) > > (defn -main [& args] ) > > With the result: > > > > > > data > > [{:type :x, > > :local/id 1, > > :obs/A "11", > > :obs/value 2.0, > > :obs/color "yellow"} > > {:type :x, > > :local/id 2, > > :obs/A "12", > > :obs/value 4.0, > > :obs/color "blue"} > > {:type :x, > > :local/id 3, > > :obs/A "13", > > :obs/value 3.0, > > :obs/color "green"} > > {:type :x, :local/id 3, :obs/A "15", :obs/value 7.0, :obs/color "red"} > > {:type :y, > > :local/id 2, > > :obs/A "11", > > :obs/value 7.0, > > :obs/shape "square"} > > {:type :y, > > :local/id 2, > > :obs/A "13", > > :obs/value 4.0, > > :obs/shape "circle"} > > {:type :y, > > :local/id 6, > > :obs/A "15", > > :obs/value 3.0, > > :obs/shape "triangle"}] > > > labelled-result > > #{["13" 3.0 4.0] ["11" 2.0 7.0] ["15" 7.0 3.0]} > > > Cool stuff. > > Alan > > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] clojure-future-spec, a backport of clojure.spec for 1.8
Matan, spec is pretty isolated part of Clojure, so it’s basically a copy-paste job with couple of gaps filled in that were introduced in 1.9. Updating it is basically getting diff from clojure and applying it to my repo. Sometimes with some manual corrections. Nikita. On Sat, Sep 24, 2016 at 1:40 AM Matan Safriel <dev.ma...@gmail.com> wrote: > Nikita, this is cool, e.g. as lighttable does not yet fully support 1.9. > Can you say something about how are these backports derived? so that I can > get an intuition into how much it is at par with the real thing? > Does it involve a lot of code rewrite to backport each 1.9 alpha version? > > > On Wednesday, June 29, 2016 at 3:16:39 PM UTC+3, Nikita Prokopov wrote: >> >> Hi! >> >> Not sure if a good idea or bad, but if you were eager to play with latest >> version of clojure.spec but don’t want to upgrade your production to alpha >> version of the language, you can add clojure.spec capabilities as a library >> to 1.8: >> >> https://github.com/tonsky/clojure-future-spec >> >> :dependencies [ >> [org.clojure/clojure "1.8.0"] >> [clojure-future-spec "1.9.0-alpha8"] >> ] >> >> (require '[clojure.spec :as spec]) >> (require '[clojure.spec.gen :as spec.gen]) >> (require '[clojure.future :refer :all]) >> >> clojure.future namespace contains all new clojure.core functions like >> int?, seqable? etc >> >> The version numbers will follow clojure 1.9 versions. Expect this lib >> upgraded with every new Clojure alpha release until 1.9 if finally out. >> >> Nikita. >> > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/qZZXSzY7apA/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ANN: Tongue, DYI i18n library for Clojure/Script
Tongue is a do-it-yourself i18n library for Clojure and ClojureScript. Tongue is very simple yet capable: - Dictionaries are just Clojure maps. - Translations are either strings, template strings or arbitrary functions. - No additional build steps, no runtime resource loading. - It comes with no built-in knowledge of world locales. It has all the tooling for you to define locales yourself though. - Pure Clojure implementation, no dependencies. - Can be used from both Clojure and ClojureScript. In contrast with other i18n solutions relying on complex and limiting string-based syntax for defining pluralization, wording, special cases etc, Tongue lets you use arbitrary functions. It gives you convenience, code reuse and endless possibilities. As a result you have a library that handles exaclty your case well with as much detail and precision as you need. https://github.com/tonsky/tongue -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: clojure.spec and generic map with couple of special keys
That’s what I needed! Thanks On Tue, Jul 5, 2016 at 8:15 PM gsnewmark <gildr...@gmail.com> wrote: > If I'm not mistaken, similar issue was recently discussed on the > Clojurians Slack (direct link - > https://clojurians.slack.com/archives/clojure-spec/p146738221722 , > archive link - > https://clojurians-log.clojureverse.org/clojure-spec/2016-07-01.html - > discussion starts from @ghadi's post at 17:10:00). > > The basic idea is to validate namespaced keywords first, remove them using > the conformer, and then validate rest of the keys. > > > On вт, лип 5, 2016 at 4:32 , Sam Estep <samuel.es...@gmail.com> wrote: > > I ran into this same issue while trying to spec Clojure's destructuring > language. I asked a question about this on Stack Overflow: > http://stackoverflow.com/q/38151446/5044950 > > On Tuesday, July 5, 2016 at 9:16:40 AM UTC-4, Nikita Prokopov wrote: >> >> Imagine I have a generic keyword => string map with a special key that >> stores a number: >> >> { ::count 7 >> :x "x" >> :y "y" >> :z "z" >> ... } >> >> Both cases are easy to validate on their own: >> >> (s/def ::count number?) >> (s/conform (s/keys ::count) { ::count 7 }) >> >> (s/conform (s/map-of keyword? string?) { :x "x", :y "y", :z "z" }) >> >> But how do I write a spec to validate them when they are in a single map? >> >> I tried to use s/every but then another problem popped up: how do I >> reference or check another spec from inside s/every predicate? In my case, >> values are more complex than string? and have their own spec. >> >> Please help >> >> Nikita >> > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/WiMV5EEAVhM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: clojure.spec regression bug for 1.9.0-alpha6
How to I make spec/fdef and regular clojure.test (not generative ones) work together? I’d like for my :ret specs and HOF :ret specs to be checked during regular tests. Is that possible? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
clojure.spec and generic map with couple of special keys
Imagine I have a generic keyword => string map with a special key that stores a number: { ::count 7 :x "x" :y "y" :z "z" ... } Both cases are easy to validate on their own: (s/def ::count number?) (s/conform (s/keys ::count) { ::count 7 }) (s/conform (s/map-of keyword? string?) { :x "x", :y "y", :z "z" }) But how do I write a spec to validate them when they are in a single map? I tried to use s/every but then another problem popped up: how do I reference or check another spec from inside s/every predicate? In my case, values are more complex than string? and have their own spec. Please help Nikita -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ANN] clojure-future-spec, a backport of clojure.spec for 1.8
Hi! Not sure if a good idea or bad, but if you were eager to play with latest version of clojure.spec but don’t want to upgrade your production to alpha version of the language, you can add clojure.spec capabilities as a library to 1.8: https://github.com/tonsky/clojure-future-spec :dependencies [ [org.clojure/clojure "1.8.0"] [clojure-future-spec "1.9.0-alpha8"] ] (require '[clojure.spec :as spec]) (require '[clojure.spec.gen :as spec.gen]) (require '[clojure.future :refer :all]) clojure.future namespace contains all new clojure.core functions like int?, seqable? etc The version numbers will follow clojure 1.9 versions. Expect this lib upgraded with every new Clojure alpha release until 1.9 if finally out. Nikita. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
No conform & throw variant in clojure.spec?
Hi! I noticed there’s no conform variant that throws instead of returning keyword in clojure.spec. Is it intentional? I’m asking because it seems repetitive to check return value, then call explain-data, and create an exception with explain-data in it. Maybe there’s a better way to use clojure.spec? Nikita. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: ClojureScript 1.7.170, Enhanced Build Pipeline
On Monday, November 23, 2015 at 4:12:54 PM UTC+6, Nikita Prokopov wrote: > Any advice what to do with deps.cljs? > > Exception in thread "main" java.lang.AssertionError: No ns form found in > /Users/prokopov/Dropbox/ws/cognician/c3/src/deps.cljs, > compiling:(/private/var/folders/0h/9vv4g3d955l6ctwwl4k9xjy4gn/T/form-init7898631568113094426.clj:1:125) > > $ cat src/deps.cljs > { > :externs ["cognician/chat/externs.js"] > } > $ > > I’m using CLJS 1.7.170 and lein-cljsbuild 1.1.1 Looks like cljsbuild issue: https://github.com/emezeske/lein-cljsbuild/pull/428 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: ClojureScript 1.7.170, Enhanced Build Pipeline
Any advice what to do with deps.cljs? Exception in thread "main" java.lang.AssertionError: No ns form found in /Users/prokopov/Dropbox/ws/cognician/c3/src/deps.cljs, compiling:(/private/var/folders/0h/9vv4g3d955l6ctwwl4k9xjy4gn/T/form-init7898631568113094426.clj:1:125) $ cat src/deps.cljs { :externs ["cognician/chat/externs.js"] } $ I’m using CLJS 1.7.170 and lein-cljsbuild 1.1.1 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ANN: DataScript, in-memory database and datalog queries in ClojureScript
Hi! I’m glad to announce my new library, DataScript. It’s an open-source, from-the-scratch implementation of in-memory immutable database aimed at ClojureScript with API and data model designed after Datomic. Full-featured Datalog queries included. Library is here: https://github.com/tonsky/datascript Also check out this blog post about why you may need a database in a browser: http://tonsky.me/blog/decomposing-web-app-development/ Feedback welcome! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: DataScript, in-memory database and datalog queries in ClojureScript
Hi Daniel, First sentence was written from Datomic standpoint. In Datomic, all history is kept in the database ref. Given ref to an immutable DB, you can rewind back to any point in time. I can guess that each DB value consist of indexes to current, latest state + append-only history log. There's also special API call for it, history. In DataScript, however, each immutable DB value is a value for just now, for latest moment that holds true. I do not keep history for values and do not support history API. There's not append-only history log built-in into DataScript. But still, DataScript DB is based on persistence data structures, meaning that DB before transact! and DB after transact! share a lot of inner structure between them. You can, on top of that immutable DB values, create just a vector of databases and store values of DB as it evolves there. This kind of history is not in the box, but is trivial to add on top. Motivation for that is that you rarely need audit queries in the browser where DB may exist for 30 seconds and dies when browser window closes. Immutability is important, referencing and doing queries to historical DB value are important, but doing queries accross whole history is not so. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: Om, a ClojureScript binding to Facebook's React
Hi David, cool work, Just wondering, why in todomvc you rely so heavily onto #js literals, and prefer dsl-like syntax (dom/...) instead of some declarative markup like hiccup? Is it because of performance reasons? Thanks! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure in production
We're using Clojure for a year in one of our backend project (real-time social feeds aggregation processing) at AboutEcho.com (Novosibirsk Ulyanovsk, Russia). 1.5.1 + a little bit of ClojureScript for internal dashboard. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.