Add a function annotation for scoping in unit tests

2016-03-23 Thread sundbry
Hi everyone,

What are your opinions on adding a special metadata to functions to provide 
it in scope for tests? This would be a nice language feature to have:

For example,

(ns banana)
(defn- ^:+test phone [] "ring ring ring")

(ns banana-test 
   ...)
(deftest ring-ring [] 
  ; We can call the private function from here
  (is (sting? (banana/phone)))

Is this feature available in any current test frameworks?

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


Language-agnostic schema definition for Transit?

2016-03-23 Thread Paul Lam
Is there something like JSON Schema http://json-schema.org/examples.html 
specifically for Transit? Perhaps with a validator tool too.

-- 
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: Add a function annotation for scoping in unit tests

2016-03-23 Thread Alex Miller
Private functions (really vars marked private holding a function) can 
always be accessed via the var #' syntax:

(ns banana-test 
   ...)
(deftest ring-ring [] 
  (is (sting? (#'banana/phone)))

This is the way private functions are typically tested.


On Wednesday, March 23, 2016 at 6:53:12 AM UTC-5, sundbry wrote:
>
> Hi everyone,
>
> What are your opinions on adding a special metadata to functions to 
> provide it in scope for tests? This would be a nice language feature to 
> have:
>
> For example,
>
> (ns banana)
> (defn- ^:+test phone [] "ring ring ring")
>
> (ns banana-test 
>...)
> (deftest ring-ring [] 
>   ; We can call the private function from here
>   (is (sting? (banana/phone)))
>
> Is this feature available in any current test frameworks?
>

-- 
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: Add a function annotation for scoping in unit tests

2016-03-23 Thread Alex Miller
I guess the other important detail there is that when you invoke a var 
holding a function, it invokes the function.

On Wednesday, March 23, 2016 at 7:01:41 AM UTC-5, Alex Miller wrote:
>
> Private functions (really vars marked private holding a function) can 
> always be accessed via the var #' syntax:
>
> (ns banana-test 
>...)
> (deftest ring-ring [] 
>   (is (sting? (#'banana/phone)))
>
> This is the way private functions are typically tested.
>
>
> On Wednesday, March 23, 2016 at 6:53:12 AM UTC-5, sundbry wrote:
>>
>> Hi everyone,
>>
>> What are your opinions on adding a special metadata to functions to 
>> provide it in scope for tests? This would be a nice language feature to 
>> have:
>>
>> For example,
>>
>> (ns banana)
>> (defn- ^:+test phone [] "ring ring ring")
>>
>> (ns banana-test 
>>...)
>> (deftest ring-ring [] 
>>   ; We can call the private function from here
>>   (is (sting? (banana/phone)))
>>
>> Is this feature available in any current test frameworks?
>>
>

-- 
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: Add a function annotation for scoping in unit tests

2016-03-23 Thread sundbry
Thanks Alex, that's very helpful.

-- Ryan

On Wednesday, March 23, 2016 at 5:02:43 AM UTC-7, Alex Miller wrote:
>
> I guess the other important detail there is that when you invoke a var 
> holding a function, it invokes the function.
>
> On Wednesday, March 23, 2016 at 7:01:41 AM UTC-5, Alex Miller wrote:
>>
>> Private functions (really vars marked private holding a function) can 
>> always be accessed via the var #' syntax:
>>
>> (ns banana-test 
>>...)
>> (deftest ring-ring [] 
>>   (is (sting? (#'banana/phone)))
>>
>> This is the way private functions are typically tested.
>>
>>
>> On Wednesday, March 23, 2016 at 6:53:12 AM UTC-5, sundbry wrote:
>>>
>>> Hi everyone,
>>>
>>> What are your opinions on adding a special metadata to functions to 
>>> provide it in scope for tests? This would be a nice language feature to 
>>> have:
>>>
>>> For example,
>>>
>>> (ns banana)
>>> (defn- ^:+test phone [] "ring ring ring")
>>>
>>> (ns banana-test 
>>>...)
>>> (deftest ring-ring [] 
>>>   ; We can call the private function from here
>>>   (is (sting? (banana/phone)))
>>>
>>> Is this feature available in any current test frameworks?
>>>
>>

-- 
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.math.combinatorics/combinations throws exception on n=1

2016-03-23 Thread Matthias Grabmair
I am just using the math combinatorics library and spent some time 
debugging until I found out that combinations does not accept n=1. Is this 
intentional?

 

*=> (clojure.math.combinatorics/combinations #{1 2 3 4} 1)*

 

*UnsupportedOperationException nth not supported on this type: 
PersistentHashSet  clojure.lang.RT.nthFrom (RT.java:933)*


*expected: ((1)(2)(3)(4))*

-- 
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.math.combinatorics/combinations throws exception on n=1

2016-03-23 Thread Mark Engelberg
The input should be a sequence not a set, so call seq on the input before
passing it to this function.

Sorry if that was unclear from the docs.  (For some inputs, it is more
forgiving, but when you call combinations with n=1, it calls distinct on
the set, and clojure.core's implementation of distinct doesn't work on
sets).

On Wed, Mar 23, 2016 at 3:45 PM, Matthias Grabmair <
matthias.grabm...@gmail.com> wrote:

> I am just using the math combinatorics library and spent some time
> debugging until I found out that combinations does not accept n=1. Is this
> intentional?
>
>
>
> *=> (clojure.math.combinatorics/combinations #{1 2 3 4} 1)*
>
>
>
> *UnsupportedOperationException nth not supported on this type:
> PersistentHashSet  clojure.lang.RT.nthFrom (RT.java:933)*
>
>
> *expected: ((1)(2)(3)(4))*
>
> --
> 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 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.math.combinatorics/combinations throws exception on n=1

2016-03-23 Thread Matthias Grabmair
Thanks, this helps! 

Generally, is there any reason why combinations should not work on sets? I 
may have tunnel vision here as they are everywhere in the systems I build.



On Wednesday, March 23, 2016 at 7:54:05 PM UTC-4, puzzler wrote:
>
> The input should be a sequence not a set, so call seq on the input before 
> passing it to this function.
>
> Sorry if that was unclear from the docs.  (For some inputs, it is more 
> forgiving, but when you call combinations with n=1, it calls distinct on 
> the set, and clojure.core's implementation of distinct doesn't work on 
> sets).
>
> On Wed, Mar 23, 2016 at 3:45 PM, Matthias Grabmair  > wrote:
>
>> I am just using the math combinatorics library and spent some time 
>> debugging until I found out that combinations does not accept n=1. Is this 
>> intentional?
>>
>>  
>>
>> *=> (clojure.math.combinatorics/combinations #{1 2 3 4} 1)*
>>
>>  
>>
>> *UnsupportedOperationException nth not supported on this type: 
>> PersistentHashSet  clojure.lang.RT.nthFrom (RT.java:933)*
>>
>>
>> *expected: ((1)(2)(3)(4))*
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@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.math.combinatorics/combinations throws exception on n=1

2016-03-23 Thread Mark Engelberg
On Wed, Mar 23, 2016 at 7:05 PM, Matthias Grabmair <
matthias.grabm...@gmail.com> wrote:

>
> Thanks, this helps!
>
> Generally, is there any reason why combinations should not work on sets? I
> may have tunnel vision here as they are everywhere in the systems I build.
>
>
A lot of the functions produce permutations/combinations/etc. that are
lexicographic in terms of the index of the elements.

In other words, if you ask for permutations of  a three element sequence,
you'll always get back permutations in this order:
[first-element second-element third-element]
[first-element third-element second-element]
[second-element first-element third-element]
[second-element third-element first-element]
[third-element first-element second-element]
[third-element second-element first-element]

This gives you control: it is up to you to put them in a seq (or vector) in
the order you want the elements, and then call the function.  For a
traditional lexicographic order, you would sort the items before calling
the function.  It doesn't make sense for the function to try to sort things
first, because in Clojure, many things are not comparable, and maybe that's
not the order you want anyway.

This is why it is not built to accept sets.  Sets have no notion of order.
If you are happy with just calling seq on the set and accepting that order,
great, you can do that, but you may want to do something more specific
(like sorting the elements).

The reason you may want to sort the elements first is for testing
purposes.  I believe that calling seq on a set can produce different
results depending on the way the set was built, so calling combinations on
two equal sets (that happened to be built differently) would produce
differently ordered results.  If you put things into a seq in a certain
order, you're guaranteed to get the same result.

Make sense?

-- 
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: Interest in a Full Featured Clojure Blog Engine

2016-03-23 Thread Nate B
  // , What ended up happening with this? 

My company and I could really use a full featured blogging engine in 
Clojure.

https://groups.google.com/forum/#!topic/clojure/rCmPYa0Vw-4

On Thursday, July 18, 2013 at 7:24:06 AM UTC-7, frye wrote:
>
> Hello, 
>
> I'm thinking of how to build a composable blogging engine in Clojure. 
> There have been a few attempts at this, with cow-blog 
>  and my-blog 
> . But these seem to be 
> abandoned, and not heavily used. Vijay Kiran, last year, even wrote a 
> series of blog posts (see here 
> )
>  
> about building a blog engine. As far as a list of posts goes, the data 
> structure for each record was simple: 
>
>- title
>- content
>- status
>- created-date
>- published-date
>- author 
>
>
> I think this is the most basic thing you could do, to get running. But I'm 
> thinking of approaching the feature set of Wordpress 
> . So I'm thinking of the 
> Data Structure(s) of features like: 
>
>- Web UI component; wyswyg editor, themes  
>- Server component; embeddable in Compojure or Pedestal 
>- Database component; 
>- raw data structures, txt, rtf, images, audio, videos, documents 
>   - adapters for Datomic, SQL(Postgres, etc), NoSQL (Mongo, etc)
>   - tags / categories for content 
>- Authentication & Authorization; OpenID 
>- Workflow component; preview, collaboration & editor review  
>- Commenting component; default or an external comments service, like 
>disqus  or discourse 
>- Administration Console
>- Plug-in support  
>- Import / Export 
>- Multi-lang / Internationalization 
>
>
> I know that I currently wish I had a Clojure weblog engine that I could 
> stick into a site I'm building. If there's already something available, 
> I'll obviously just use that. But otherwise, is this something that would 
> be interesting to people? 
>
>
> Thanks 
>
> Tim Washington 
> Interruptsoftware.ca / Bkeeping.com 
> 416.843.9060 
>
>

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