Starting with Clojure

2017-05-09 Thread Kristian Koci
Hello community

I'm getting started with Clojure, seems like an exciting language, I've 
been into LISP many years ago, so I think is really cool to have such a 
language running on top of the jvm.

Anyways, I'll love to know in which industries is Clojure used the most?

Is there any example/name?

I'm just curious to know, if besides the exciting 
functional/experimental/scientific side, is there any significant steps 
forward in business :)

Thanks in advance!

-- 
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: need function equivalents of library macros?

2017-05-09 Thread Alex Miller
Is there any reason why you're using unqualified keys? If you're using 
qualified keys, then a simple (s/keys) spec will validate all registered 
keys in the map so you can cover all of your optional attribute cases that 
way.

Another possibility worth mentioning is using s/merge to combine well-known 
(smaller) map specs into larger combinations.


On Monday, May 8, 2017 at 10:38:34 AM UTC-5, Dave Tenny wrote:
>
> Let's say I have a namespace that provides access to the database,
> say our table has these fields (as clojure specs)
>
> (s/def ::job-id nat-int?) ; 1 2 3 ...
> (s/def ::job-name string?) ; frobozz-executor
> (s/def ::job-status keyword?) ; :queued, :in-progress, :completed
>
>
> And that I have the logic in place to convert to/from the types (e.g. 
> keywords).
>
> If I have a simple function to return records in from the jobs table it 
> might look like:
>
> (s/def ::job-record (s/keys :req-un [::job-id ::job-name ::job-status]))
>
> (s/fdef get-jobs
>   :args (s/cat :db database-handle?)
>   :ret (s/coll-of ::job-record))
>
> (defn get-jobs
>   [db]
>   ... returns vector of maps, one for each record, jdbc-style ...)
>
> (get-jobs) => [{:job-id 1 :job-name "frobozz-executor" :job-status 
> :queued} ...]
>
> Now here's where things get iffy in practice.  Suppose I have other 
> database interfaces that take similar but different maps or collections of 
> keywords.
>
> For example, a function like:
>
> (s/fdef get-selective-jobs
>   :args (s/cat :db database-handle? :fields (s/keys :opt-un [::job-id 
> ::job-name ::job-status])))
>
> (defn get-selective-jobs
>   [db fields]
>   ... return only fields from the database that are specified in the 
> fields parameter ...)
>
>
> Once you start getting some similar-but-different specs, it'd be nice 
> apply a bit of code building.
>
> e.g.
>
> (def job-field-keys [::job-id ::job-name ::job-status])
>
> (s/def ::job-record (s/keys* :req-un job-field-keys))
> (s/fdef get-selective-args
>   :args (s/cat* :db database-handle? :fields  (s/keys :opt-un 
> job-field-keys))
>
> Hopefully this is conducive to some thought/discussion of the subject, 
> and/or someone can just let me know how I should be doing this if there's 
> an easy way in the present spec implementation.
>
> Sidewise plea: inline specs for s/keys like you can do for s/cat.  s/keys 
> deliberate omision of inline specs does occasionally get in the way in 
> large namespaces.
>   
>
>
>

-- 
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: Starting with Clojure

2017-05-09 Thread adrian . medina
https://clojure.org/community/companies

https://clojure.org/community/community_stories

Might be insightful for you. Clojure has plenty of commercial use. 

On Tuesday, May 9, 2017 at 3:59:33 AM UTC-4, Kristian Koci wrote:
>
> Hello community
>
> I'm getting started with Clojure, seems like an exciting language, I've 
> been into LISP many years ago, so I think is really cool to have such a 
> language running on top of the jvm.
>
> Anyways, I'll love to know in which industries is Clojure used the most?
>
> Is there any example/name?
>
> I'm just curious to know, if besides the exciting 
> functional/experimental/scientific side, is there any significant steps 
> forward in business :)
>
> Thanks in advance!
>

-- 
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: need function equivalents of library macros?

2017-05-09 Thread Dave Tenny
My issues aren't about qualified or unqualified keys (and the APIs
generally need to accept unqualified keys - I do use qualified keys in
various contexts, just not this post where the topic is macros vs.
non-macro forms).

s/merge is a good point about composition.  However often all I really want
to do is take some list of, say, keywords, acceptable in a map or
collection that is a parameter, and 'disj' one keyword from it for another
spec because that particular keyword isn't valid or supported for an
interface in question.

At the end of the day, I feel I'm often forced to cut and paste too many
similar but different lists into various specs (fdef in particular).  The
ability to construct specs without macros might be useful.

On Tue, May 9, 2017 at 6:05 AM, Alex Miller  wrote:

> Is there any reason why you're using unqualified keys? If you're using
> qualified keys, then a simple (s/keys) spec will validate all registered
> keys in the map so you can cover all of your optional attribute cases that
> way.
>
> Another possibility worth mentioning is using s/merge to combine
> well-known (smaller) map specs into larger combinations.
>
>
> On Monday, May 8, 2017 at 10:38:34 AM UTC-5, Dave Tenny wrote:
>>
>> Let's say I have a namespace that provides access to the database,
>> say our table has these fields (as clojure specs)
>>
>> (s/def ::job-id nat-int?) ; 1 2 3 ...
>> (s/def ::job-name string?) ; frobozz-executor
>> (s/def ::job-status keyword?) ; :queued, :in-progress, :completed
>>
>>
>> And that I have the logic in place to convert to/from the types (e.g.
>> keywords).
>>
>> If I have a simple function to return records in from the jobs table it
>> might look like:
>>
>> (s/def ::job-record (s/keys :req-un [::job-id ::job-name ::job-status]))
>>
>> (s/fdef get-jobs
>>   :args (s/cat :db database-handle?)
>>   :ret (s/coll-of ::job-record))
>>
>> (defn get-jobs
>>   [db]
>>   ... returns vector of maps, one for each record, jdbc-style ...)
>>
>> (get-jobs) => [{:job-id 1 :job-name "frobozz-executor" :job-status
>> :queued} ...]
>>
>> Now here's where things get iffy in practice.  Suppose I have other
>> database interfaces that take similar but different maps or collections of
>> keywords.
>>
>> For example, a function like:
>>
>> (s/fdef get-selective-jobs
>>   :args (s/cat :db database-handle? :fields (s/keys :opt-un [::job-id
>> ::job-name ::job-status])))
>>
>> (defn get-selective-jobs
>>   [db fields]
>>   ... return only fields from the database that are specified in the
>> fields parameter ...)
>>
>>
>> Once you start getting some similar-but-different specs, it'd be nice
>> apply a bit of code building.
>>
>> e.g.
>>
>> (def job-field-keys [::job-id ::job-name ::job-status])
>>
>> (s/def ::job-record (s/keys* :req-un job-field-keys))
>> (s/fdef get-selective-args
>>   :args (s/cat* :db database-handle? :fields  (s/keys :opt-un
>> job-field-keys))
>>
>> Hopefully this is conducive to some thought/discussion of the subject,
>> and/or someone can just let me know how I should be doing this if there's
>> an easy way in the present spec implementation.
>>
>> Sidewise plea: inline specs for s/keys like you can do for s/cat.  s/keys
>> deliberate omision of inline specs does occasionally get in the way in
>> large namespaces.
>>
>>
>>
>> --
> 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/OBbq-jInyqI/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: What to read after 3 dozen "introduction to transducers" blog posts

2017-05-09 Thread Michael Willis
After he uses this one weird trick, you'll never guess what happens next!

On Saturday, May 6, 2017 at 11:56:13 AM UTC-6, Matching Socks wrote:
>
> This one.  
> https://tech.grammarly.com/blog/building-etl-pipelines-with-clojure
>
> "To be honest, this is a somewhat advanced usage of the transducers 
> machinery," says the Grammarly Engineering Blog, right after shoehorning a 
> BufferedReader into the mold with "reify IReduceInit".  I already felt I'd 
> got my money's worth from reading up to this half-way point.  But I was 
> astonished at what came next.  
>
>

-- 
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: need function equivalents of library macros?

2017-05-09 Thread Alex Miller

On Tuesday, May 9, 2017 at 6:21:29 AM UTC-5, Dave Tenny wrote:
>
> My issues aren't about qualified or unqualified keys (and the APIs 
> generally need to accept unqualified keys - I do use qualified keys in 
> various contexts, just not this post where the topic is macros vs. 
> non-macro forms).
>

spec pushes you towards qualified keys for good reasons (see Rich's 
original rationale), so I don't expect that we'll be adding more support 
for unqualified keys. The support that is there is intended as a bridge 
towards qualified keys.
 

> s/merge is a good point about composition.  However often all I really 
> want to do is take some list of, say, keywords, acceptable in a map or 
> collection that is a parameter, and 'disj' one keyword from it for another 
> spec because that particular keyword isn't valid or supported for an 
> interface in question.
>

I have found that when I'm seeing this a lot, either the code is not 
modeling the domain well by not factoring common attributes OR my domain 
structures are actually very dynamic and have many optional attributes that 
can occur in any combination. In the former case, I can usually step back 
and refactor the code so that attributes that are always grouped together 
have their own unit and functions. 

In the latter case, the key is often to spec less. Instead of trying to 
identify every attribute on every function input and output, just create a 
single map spec with all of the optional attributes. You can then constrain 
it further if needed by doing (s/merge ::common (s/keys :req [::foo 
::bar])) if needed.

Or another approach is to just use (s/keys) to validate all the attributes 
that happen to be in a map flowing through a function. This is exactly the 
use case that spec makes possible that few other validation approaches can 
handle well (the case of checking arbitrary attributes flowing through a 
system) and its enabled by the use of qualified names with global semantics.

At the end of the day, I feel I'm often forced to cut and paste too many 
> similar but different lists into various specs (fdef in particular).  The 
> ability to construct specs without macros might be useful.  
>

We don't have them available yet, but we will have specs for spec forms 
(see CLJ-2112). With specs for spec forms, you can programmatically 
transform or construct maps in this way. With spec forms, you can start 
from a spec, s/conform to data, manipulate that data in any way you like, 
then s/unform back to a spec. You can also start in the middle and 
construct the conformed data version of a spec and s/unform to the list 
form.

 

-- 
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: Starting with Clojure

2017-05-09 Thread Kristian Koci
Thank You very much!

El martes, 9 de mayo de 2017, 7:17:32 (UTC-4), adrian...@mail.yu.edu 
escribió:
>
> https://clojure.org/community/companies
>
> https://clojure.org/community/community_stories
>
> Might be insightful for you. Clojure has plenty of commercial use. 
>
> On Tuesday, May 9, 2017 at 3:59:33 AM UTC-4, Kristian Koci wrote:
>>
>> Hello community
>>
>> I'm getting started with Clojure, seems like an exciting language, I've 
>> been into LISP many years ago, so I think is really cool to have such a 
>> language running on top of the jvm.
>>
>> Anyways, I'll love to know in which industries is Clojure used the most?
>>
>> Is there any example/name?
>>
>> I'm just curious to know, if besides the exciting 
>> functional/experimental/scientific side, is there any significant steps 
>> forward in business :)
>>
>> Thanks in advance!
>>
>

-- 
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: Starting with Clojure

2017-05-09 Thread Alex Miller
There's a lot of stuff being posted right now 
at https://news.ycombinator.com/item?id=14302762 too.

On Tuesday, May 9, 2017 at 11:28:10 AM UTC-5, Kristian Koci wrote:
>
> Thank You very much!
>
> El martes, 9 de mayo de 2017, 7:17:32 (UTC-4), adrian...@mail.yu.edu 
> escribió:
>>
>> https://clojure.org/community/companies
>>
>> https://clojure.org/community/community_stories
>>
>> Might be insightful for you. Clojure has plenty of commercial use. 
>>
>> On Tuesday, May 9, 2017 at 3:59:33 AM UTC-4, Kristian Koci wrote:
>>>
>>> Hello community
>>>
>>> I'm getting started with Clojure, seems like an exciting language, I've 
>>> been into LISP many years ago, so I think is really cool to have such a 
>>> language running on top of the jvm.
>>>
>>> Anyways, I'll love to know in which industries is Clojure used the most?
>>>
>>> Is there any example/name?
>>>
>>> I'm just curious to know, if besides the exciting 
>>> functional/experimental/scientific side, is there any significant steps 
>>> forward in business :)
>>>
>>> Thanks in advance!
>>>
>>

-- 
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: Starting with Clojure

2017-05-09 Thread Kristian Koci
Awesome! :)

On Tue, May 9, 2017 at 4:32 PM, Alex Miller  wrote:

> There's a lot of stuff being posted right now at https://news.ycombinator.
> com/item?id=14302762 too.
>
>
> On Tuesday, May 9, 2017 at 11:28:10 AM UTC-5, Kristian Koci wrote:
>>
>> Thank You very much!
>>
>> El martes, 9 de mayo de 2017, 7:17:32 (UTC-4), adrian...@mail.yu.edu
>> escribió:
>>>
>>> https://clojure.org/community/companies
>>>
>>> https://clojure.org/community/community_stories
>>>
>>> Might be insightful for you. Clojure has plenty of commercial use.
>>>
>>> On Tuesday, May 9, 2017 at 3:59:33 AM UTC-4, Kristian Koci wrote:

 Hello community

 I'm getting started with Clojure, seems like an exciting language, I've
 been into LISP many years ago, so I think is really cool to have such a
 language running on top of the jvm.

 Anyways, I'll love to know in which industries is Clojure used the most?

 Is there any example/name?

 I'm just curious to know, if besides the exciting
 functional/experimental/scientific side, is there any significant
 steps forward in business :)

 Thanks in advance!

>>> --
> 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/R7sByu-Decs/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.
>



-- 
Kristian Koci
Linux User #582221
Public repository: https://github.com/kkoci


  









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


Data expansion alternatives and idioms

2017-05-09 Thread Steve Buikhuizen
In various projects and presentations there are "terse" data structures 
being expanded into full forms. Examples are:

   - Pedestal "terse" routes : using protocols called ExpandableRoutes
   - Vase schema literals : EDN reader literals
   - Yada routes : I haven't used it so unsure of the technique

and I'm sure there are many more. 

There are also techniques mentioned in blogs using "Data Macros" using 
Schema and now Spec where terse data is conformed and then transformed into 
longer forms.

I'm trying to understand the pros and cons of each of these techniques so I 
thought I'd put it out to the community. Maybe this could accelerate the 
convergence towards an
idiomatic technique that we can all reach for when we need it.

If you have used any of these (or others) what have you learned? 


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