Spy - Clojure / ClojureScript library for stubs, spies and mocks

2018-04-30 Thread Alex King






Spy  - a library that records 
calls and responses to and from a function, allowing you to verify 
interactions, primarily intended for use in unit / integration tests but 
there is no reason you can't use it in the REPL too for debugging. It's 
along the same lines as Mockito / Sinon Spy but it leaves the mocking part 
up to the user - focusing on recording interactions and providing some 
helper functions that can be used in verifying those interactions.


https://github.com/alexanderjamesking/spy


Feedback and contributions welcome!


Thanks,

Alex



-- 
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.


Spy - Clojure / ClojureScript library for stubs, spies and mocks

2018-04-30 Thread Didier
This looks cool for validation.

-- 
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: Spy - Clojure / ClojureScript library for stubs, spies and mocks

2018-04-30 Thread Alex King
I had to remove the original post due to the image, here's the link for 
anyone interested: https://github.com/alexanderjamesking/spy

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: Understanding GraalVM and Clojure

2018-04-30 Thread Nathan Fisher
Is there a runnable language test suite that is used to verify CLJ, CLJS,
and CLR compatibility? Thinking something similar to RubySpec that could be
used to validate the completeness/gaps in a particular implementation (eg
GraalVM).
On Sun, Apr 29, 2018 at 7:16 AM, Khalid Jebbari 
wrote:

> I've read it, it's really interesting. Alex Miller mentioned on Twitter
> that they'll work on removing some limitations over time. @Alex, can you
> confirm and expand a bit more ?
>
> Le sam. 28 avr. 2018 à 23:14, Nathan Fisher  a
> écrit :
>
>> Another interesting post on Clojure and Graal
>>
>> https://www.innoq.com/en/blog/native-clojure-and-graalvm/
>> On Sat, Apr 28, 2018 at 10:01 AM, Khalid Jebbari <
>> khalid.jebb...@gmail.com> wrote:
>>
>>> Thank you for the link.
>>>
>>> Le sam. 28 avr. 2018 à 00:35, Egg Syntax  a écrit :
>>>
 Karin Meier has done some experimentation using Clojure on GraalVM to
 call R and Python, and has a blog post
 
  and repo
 
  that
 you may find interesting.


 On Thursday, April 19, 2018 at 6:00:14 AM UTC-4, Khalid Jebbari wrote:
>
> Hello,
>
> Oracle has just announced GraalVM 1.0 release candidate:
> https://blogs.oracle.com/developers/announcing-graalvm
>
> It mentions a few JVM-based language but not Clojure (maybe just
> because of popularity).
> - Does it mean Clojure is not "compatible" with GraalVM ?
> - Does it mean Clojure needs to be reimplemented in terms of GraalVM's
> Truffle framework ?
> - Does it mean Clojure can be run as a native binary with fast startup
> time and minimized memory footprint ?
>
> If someone with some knowledge could explain to me the relationships
> between Clojure and GraalVM ? Bonus points if Alex Miller answers and 
> share
> the plans, if any, about their integration/interaction.
>
> Thanks a lot in advance. really curious to understand more.
>
 --
 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/iBY6hwqqp5c/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.
>>>
>> --
>> - sent from my mobile
>>
>> --
>> 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/iBY6hwqqp5c/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.

How to get result of default pprint from custom simple-dispatch

2018-04-30 Thread MS
I have a defrecord which is not pprinting exactly the way I want.

When print-dup is true, I want to eliminate any references to the 
namespace, as I want to write out to edn and read it back in, but without 
running eval while doing so, and without exposing the clojure 
implementation details to the user who ventures into reading the edn file.  
This is not for security, just to keep the edn file independent of 
namespaces.  The defrecord I'm printing has references to other defrecords, 
which also have an abbreviated form for edn writing.

When print-dup is false, I just want pprint and pr-str, etc., to show the 
defrecord name with the namespace, then the map, but normal pprint doesn't 
show the defrecord name.

I've resorted to copying most of pprint-map from the clojure source into my 
simple-dispatch.
This seems like overkill, but it gets what I want.

Can someone comment if this is the right way to go about it?  Is there some 
way to call the built-in (but private) pprint-map directly on my defrecord, 
after printing out the class name?


(ns toydb.edn.shapes
  (:require [jfxutils.core :as jfxc]
toydb.units))

(defrecord Circle [])

(defmethod print-method Circle [c, ^java.io.Writer writer]
  ;; Writes #toydb.shapes.Circle{:key1 val1, :key2 val2} without line-breaks
  (.write writer (str "#"
  (pr-str Circle)
  (pr-str (into {} c)

(defmethod print-dup Circle [c, ^java.io.Writer writer]
  ;; Writes #Circle{:key1 val1, :key val2} without line-breaks
  (.write writer "#Circle")
  (print-method (into {} c) writer))


(defmethod clojure.pprint/simple-dispatch Circle [c]
  ;; this is copied with minor modification from
  ;;  
https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/dispatch.clj
  ;; It seems like overkill to redefine it just to add classname at the 
beginning  
(let [amap (into {} c)]
(if clojure.core/*print-dup*
  (.write ^java.io.Writer *out* "#Circle")
  (.write ^java.io.Writer *out* (pr-str Circle))) ;; gets 
#namespace.classname
(clojure.pprint/pprint-logical-block
 :prefix "{" :suffix "}"
 (clojure.pprint/print-length-loop
  [aseq (seq amap)]
  (when aseq
(clojure.pprint/pprint-logical-block
 (clojure.pprint/write-out (ffirst aseq))
 (.write ^java.io.Writer *out* " ")
 (clojure.pprint/pprint-newline :linear)
;;  *current-length* is private to pprint-base
;;(set! *current-length* 0) ; always print both parts of the [k v] pair
 (clojure.pprint/write-out (fnext (first aseq
(when (next aseq)
  (.write ^java.io.Writer *out* ", ")
  (clojure.pprint/pprint-newline :linear)
  (recur (next aseq

























-- 
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] editscript: a diffing library for Clojure data

2018-04-30 Thread hyang
Hello,

I am happy to make available a diffing/patching library for Clojure data 
structures. 

https://github.com/juji-io/editscript

Two flavors of diffing algorithms are provided, with very different 
performance characteristics, suitable for different applications. 

* One optimizing diffing algorithm aimed to reduce the size of diffs. It is 
an A* based graph search algorithm that is optimized for speed, though much 
slower than the next one, it is still practical.
* Another is a straightforward tree walking algorithm that is about two 
orders of magnitude faster, but produce suboptimal results.

Hope this library will be of some use for someone. Comments, suggestions 
and contributions are also welcome.

-huahai

-- 
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.