Re: Minimum Viable Database Component

2015-04-30 Thread Malcolm Sparks
I think it can be a dangerous road trying to create abstractions over data 
sources. It can be a lot of work maintaining a stub/mock implementation to 
work alongside a database, and sometimes it's not that much more work (or 
less work) to install Postgres, SQLite, or whatever you're using, locally.

One of the pain points of working with databases is managing their state, 
and this is one of the reasons why stub/mock implementations initially look 
attractive. However, there are solid alternative approaches to making the 
job of managing databases a lot easier.

For example, https://github.com/juxt/joplin is a good choice for managing 
database schema migrations, seeding databases with state (for test setups) 
and has a good range of supported data sources. (Disclosure: I work for 
juxt)

On Thursday, April 30, 2015 at 4:54:38 AM UTC+1, Andy Chambers wrote:

 Hi All,

 I'm trying to follow the component architecture for an app I'm working 
 on and wondered if I was missing something. In the Just enough structure 
 talk, one of the examples Stuart presents is a DB component that contains 
 just a small selection of DB related functions (i.e. insert, and query 
 IIRC) so that when you need to mock it out for your tests, you don't have 
 to implement the entire JDBC interface.

 This makes sense but I'm wondering if anyone has released such a subset 
 (possibly expanded to include things like transactions, and maybe a few 
 utility query builders) as open source ideally with a corresponding mock 
 implementation. With the popularity of the component library, I'm surprised 
 not to find ready made components I can just plug into my app.

 If there's nothing like this already, then I guess I have an idea for a 
 new project. Anyone think this is a good idea or would everyone's ideal DB 
 component look a little different? Look forward to hearing your thoughts.

 Cheers,
 Andy


-- 
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: Minimum Viable Database Component

2015-04-30 Thread Jeroen van Dijk
Hi Andy,

I'm not aware of such a project, but I can confirm that it is an approach
that we apply internally at AdGoji and has been working well for us.  For
instance, we have (simple) components that mock Kafka and Redis in a way
that make them feature compatible to these services in the context of our
platform. For Kafka we have one mock component for testing (so you can can
test what has been pushed to Kafka) and we have one for development that
just logs to the file system (in a human-readable) form.

Although it doesn't replace real testing with these external services, it
does make the development flow a lot faster as boot-time is quicker, easier
cleanup etc.

Cheers,
Jeroen

On Thu, Apr 30, 2015 at 5:54 AM, Andy Chambers achambers.h...@gmail.com
wrote:

 Hi All,

 I'm trying to follow the component architecture for an app I'm working
 on and wondered if I was missing something. In the Just enough structure
 talk, one of the examples Stuart presents is a DB component that contains
 just a small selection of DB related functions (i.e. insert, and query
 IIRC) so that when you need to mock it out for your tests, you don't have
 to implement the entire JDBC interface.

 This makes sense but I'm wondering if anyone has released such a subset
 (possibly expanded to include things like transactions, and maybe a few
 utility query builders) as open source ideally with a corresponding mock
 implementation. With the popularity of the component library, I'm surprised
 not to find ready made components I can just plug into my app.

 If there's nothing like this already, then I guess I have an idea for a
 new project. Anyone think this is a good idea or would everyone's ideal DB
 component look a little different? Look forward to hearing your thoughts.

 Cheers,
 Andy

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


ring.middleware.reload and figwheel

2015-04-30 Thread Daniel Kersten
Hi,

I've got a clojure(script) project where I use figwheel to live-reload cljs
and this works great, but I'm now trying to set up live reloading of the
server-side clojure too.
Since I don't want to run multiple jvm/lein instances, I'm using figwheels
:ring-handler feature to add my server ring handler into figwheels embedded
webserver.
In the past, I've live-reloaded my server code using the reloaded workflow,
but since figwheel gives me a cljs repl and not a clj repl, I don't know
how to do that without running the server independently.

So, instead I'm just trying to get ring.middleware.reload working, but its
not picking up file changes.

Has anyone got this working? Alternatively, does anyone have any tips on
getting a nice workflow without running multiple jvm/lein instances?

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.


Clojure Async/State Machine/Workflow Libraries?

2015-04-30 Thread Tim Visher
Hey All,

Anyone have any tips on clojure 'workflow' libraries? 
https://github.com/relaynetwork/impresario is very close, but lacks some 
basic features like exception transitions, etc. 

Basically, I'm looking for a library that allows me to create a workflow 
that will happen asynchronously, recording it's progress in a db. I think i 
could probably whip something together without _too_ much trouble using 
core.async but this feels like something that's probably already been 
written.

Thanks in advance!

--

In Christ,

Timmy V.

http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail

-- 
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][book] Clojure Reactive Programming

2015-04-30 Thread Pieter Vallen
Thanks for writing the book. Just bought it (before the marketing 
discussion;-)) and really like what I've read so far!

Cheers,
Pieter

Op dinsdag 24 maart 2015 15:26:02 UTC+1 schreef Leonardo Borges:

 Hi all,

 Some of you may know that I have been working on a book for the better 
 part of last year.

 I'm happy to announce it has finally been published! Here's the link: 
 https://www.packtpub.com/web-development/clojure-reactive-programming

 I hope you find it useful! I've had a great time putting it together!

 Cheers,
 Leonardo Borges
 www.leonardoborges.com


-- 
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] Ubergraph 0.1.0

2015-04-30 Thread kovas boguta
Very cool!

On a related note: I would be interested in a similar library focused on
DAG's. Any thoughts there?






On Wed, Apr 29, 2015 at 10:00 PM, Mark Engelberg mark.engelb...@gmail.com
wrote:

 https://github.com/Engelberg/ubergraph

 Ubergraph is a versatile, general-purpose graph data structure for
 Clojure. It is designed to complement and extend Loom, a popular Clojure
 collection of graph protocols and algorithms.

 Ubergraph implements all of Loom's protocols and draws them together in
 one namespace, making it a one-stop, batteries-included graph
 implementation.  But more importantly, Ubergraph goes beyond Loom's
 protocols, allowing a mixture of directed and undirected edges within a
 single graph, multiple parallel edges between a given pair of nodes (aka
 multigraphs), multiple weight attributes per edge, and changeable weights.

 The ubergraph.alg namespace contains an assortment of algorithms
 compatible with graphs, digraphs, multigraphs, and multidigraphs (and
 backwards-compatible with Loom graphs).  A highlight of the ubergraph.alg
 namespace is its feature-rich shortest-paths algorithm, which supports a
 number of useful search options: edge filters, node filters, goal
 predicates, multiple starting nodes, multiple ending nodes, using any
 attribute or function as the cost for an edge, and 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 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.


Newbie

2015-04-30 Thread Pitou Khmer
Dear all experts here, 

Could you share me the presentation that describing about Clojure for 
newbie developer to make more easy to understand? 

Thanks, 
Pitou  

-- 
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: complex numbers in clojure

2015-04-30 Thread Alan Forrester
On 28 April 2015 at 05:22, Mikera mike.r.anderson...@gmail.com wrote:
 Complex numbers are tricky because:
 - They need to be fast in order to be useful for numerical computing. The
 obvious implementations that you might create with boxed values,
 vectors/maps, multimethods and protocols are likely to be unacceptable for
 many use cases
 - You still want to be able to use them in a generic way, with operations
 that play nicely with other values (Doubles etc.)

 I have thought about this a lot w.r.t. core.matrix and have come to the
 conclusion that there is no simple, elegant answer that meets all use cases.

 What I'd like to suggest is:
 a) The community converge on a single, minimal, lightweight representation
 for a boxed complex scalar value. This is probably best as a Java class (for
 easy interop with Java libraries). I think
 http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/complex/Complex.html
 is a good candidate
 b) A lightweight wrapper library that provides nice complex functions in
 Clojure, using the above type. Nothing fancy. But can make extensive use of
 type hints etc. for performance so should be pretty fast

If somebody wrapped the commons math 3 complex library, what would
count as good performance?

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: Minimum Viable Database Component

2015-04-30 Thread Stuart Sierra
Hi Andy,

That was just an example I made up for the slides, and not a very good one.

Usually, the functions/protocols you implement for your components are 
specific to your application.

–S


On Thursday, April 30, 2015 at 4:54:38 AM UTC+1, Andy Chambers wrote:

 Hi All,

 I'm trying to follow the component architecture for an app I'm working 
 on and wondered if I was missing something. In the Just enough structure 
 talk, one of the examples Stuart presents is a DB component that contains 
 just a small selection of DB related functions (i.e. insert, and query 
 IIRC) so that when you need to mock it out for your tests, you don't have 
 to implement the entire JDBC interface.

 This makes sense but I'm wondering if anyone has released such a subset 
 (possibly expanded to include things like transactions, and maybe a few 
 utility query builders) as open source ideally with a corresponding mock 
 implementation. With the popularity of the component library, I'm surprised 
 not to find ready made components I can just plug into my app.

 If there's nothing like this already, then I guess I have an idea for a 
 new project. Anyone think this is a good idea or would everyone's ideal DB 
 component look a little different? Look forward to hearing your thoughts.

 Cheers,
 Andy


-- 
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] Ubergraph 0.1.0

2015-04-30 Thread Mark Engelberg
Ubergraph can certainly represent DAGs, since DAGs are just a special case
of directed graphs.  There is also the function ubergraph.alg/dag? to test
whether a graph is a DAG.  There are included algorithms, such as
topological sorting, which only work on a DAG, and other functions, such as
shortest-path which will work just as well on a DAG.

So what sorts of functionality would you be looking for in a DAG-only
library?


On Thu, Apr 30, 2015 at 6:21 AM, kovas boguta kovas.bog...@gmail.com
wrote:

 Very cool!

 On a related note: I would be interested in a similar library focused on
 DAG's. Any thoughts there?






 On Wed, Apr 29, 2015 at 10:00 PM, Mark Engelberg mark.engelb...@gmail.com
  wrote:

 https://github.com/Engelberg/ubergraph

 Ubergraph is a versatile, general-purpose graph data structure for
 Clojure. It is designed to complement and extend Loom, a popular Clojure
 collection of graph protocols and algorithms.

 Ubergraph implements all of Loom's protocols and draws them together in
 one namespace, making it a one-stop, batteries-included graph
 implementation.  But more importantly, Ubergraph goes beyond Loom's
 protocols, allowing a mixture of directed and undirected edges within a
 single graph, multiple parallel edges between a given pair of nodes (aka
 multigraphs), multiple weight attributes per edge, and changeable weights.

 The ubergraph.alg namespace contains an assortment of algorithms
 compatible with graphs, digraphs, multigraphs, and multidigraphs (and
 backwards-compatible with Loom graphs).  A highlight of the ubergraph.alg
 namespace is its feature-rich shortest-paths algorithm, which supports a
 number of useful search options: edge filters, node filters, goal
 predicates, multiple starting nodes, multiple ending nodes, using any
 attribute or function as the cost for an edge, and 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 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.


-- 
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] Ubergraph 0.1.0

2015-04-30 Thread kovas boguta
I want an API that is optimized around tree traversal and replacement.
Clojure.walk and zippers can be pretty great, as of course the associative
aspect of maps and vectors.

Going from a tree of maps and vectors to a graph representation makes
things harder and less direct.

Theres some challenges about providing such an abstraction, was just
wondering if anyones thought about this.



On Thu, Apr 30, 2015 at 1:37 PM, Mark Engelberg mark.engelb...@gmail.com
wrote:

 Ubergraph can certainly represent DAGs, since DAGs are just a special case
 of directed graphs.  There is also the function ubergraph.alg/dag? to test
 whether a graph is a DAG.  There are included algorithms, such as
 topological sorting, which only work on a DAG, and other functions, such as
 shortest-path which will work just as well on a DAG.

 So what sorts of functionality would you be looking for in a DAG-only
 library?


 On Thu, Apr 30, 2015 at 6:21 AM, kovas boguta kovas.bog...@gmail.com
 wrote:

 Very cool!

 On a related note: I would be interested in a similar library focused on
 DAG's. Any thoughts there?






 On Wed, Apr 29, 2015 at 10:00 PM, Mark Engelberg 
 mark.engelb...@gmail.com wrote:

 https://github.com/Engelberg/ubergraph

 Ubergraph is a versatile, general-purpose graph data structure for
 Clojure. It is designed to complement and extend Loom, a popular Clojure
 collection of graph protocols and algorithms.

 Ubergraph implements all of Loom's protocols and draws them together in
 one namespace, making it a one-stop, batteries-included graph
 implementation.  But more importantly, Ubergraph goes beyond Loom's
 protocols, allowing a mixture of directed and undirected edges within a
 single graph, multiple parallel edges between a given pair of nodes (aka
 multigraphs), multiple weight attributes per edge, and changeable weights.

 The ubergraph.alg namespace contains an assortment of algorithms
 compatible with graphs, digraphs, multigraphs, and multidigraphs (and
 backwards-compatible with Loom graphs).  A highlight of the ubergraph.alg
 namespace is its feature-rich shortest-paths algorithm, which supports a
 number of useful search options: edge filters, node filters, goal
 predicates, multiple starting nodes, multiple ending nodes, using any
 attribute or function as the cost for an edge, and 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 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.


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

Re: [ANN] Ubergraph 0.1.0

2015-04-30 Thread Mark Engelberg
I've worked with many DAGs represented as trees just using Clojure's maps
and vectors in a straightforward manner, and like you say, that's often
enough to get the job done.

I think where Loom and Ubergraph really start to pay off is when you need
to associate attributes to the various nodes and edges.  You say a graph
representation makes manipulations harder and less direct, but on the
contrary, I find graph representations significantly easier to move around
the structure and make modifications.  Ubergraph is a persistent data
structure that allows efficient adding and deletion of nodes and edges and
updating of attributes (more efficient than if you stored it as a tree, and
needed to rebuild the tree all the way up to the root with every change).
Also, in Ubergraph all nodes are aware of their incoming edges, so you are
not limited in traversing your DAG in the direction of your one-way edges
as you are with a tree.  There are a number of different traversals
available in the alg namespace.

One disadvantage of implementing a DAG as a graph rather than a tree is
that with a tree, it is trivial to delete an entire subtree, whereas that
would be a more complex operation with a graph representation.

Hope that helps to understand the pros and cons of this particular data
structure.


On Thu, Apr 30, 2015 at 11:01 AM, kovas boguta kovas.bog...@gmail.com
wrote:

 I want an API that is optimized around tree traversal and replacement.
 Clojure.walk and zippers can be pretty great, as of course the associative
 aspect of maps and vectors.

 Going from a tree of maps and vectors to a graph representation makes
 things harder and less direct.

 Theres some challenges about providing such an abstraction, was just
 wondering if anyones thought about this.



 On Thu, Apr 30, 2015 at 1:37 PM, Mark Engelberg mark.engelb...@gmail.com
 wrote:

 Ubergraph can certainly represent DAGs, since DAGs are just a special
 case of directed graphs.  There is also the function ubergraph.alg/dag? to
 test whether a graph is a DAG.  There are included algorithms, such as
 topological sorting, which only work on a DAG, and other functions, such as
 shortest-path which will work just as well on a DAG.

 So what sorts of functionality would you be looking for in a DAG-only
 library?


 On Thu, Apr 30, 2015 at 6:21 AM, kovas boguta kovas.bog...@gmail.com
 wrote:

 Very cool!

 On a related note: I would be interested in a similar library focused on
 DAG's. Any thoughts there?






 On Wed, Apr 29, 2015 at 10:00 PM, Mark Engelberg 
 mark.engelb...@gmail.com wrote:

 https://github.com/Engelberg/ubergraph

 Ubergraph is a versatile, general-purpose graph data structure for
 Clojure. It is designed to complement and extend Loom, a popular Clojure
 collection of graph protocols and algorithms.

 Ubergraph implements all of Loom's protocols and draws them together in
 one namespace, making it a one-stop, batteries-included graph
 implementation.  But more importantly, Ubergraph goes beyond Loom's
 protocols, allowing a mixture of directed and undirected edges within a
 single graph, multiple parallel edges between a given pair of nodes (aka
 multigraphs), multiple weight attributes per edge, and changeable weights.

 The ubergraph.alg namespace contains an assortment of algorithms
 compatible with graphs, digraphs, multigraphs, and multidigraphs (and
 backwards-compatible with Loom graphs).  A highlight of the ubergraph.alg
 namespace is its feature-rich shortest-paths algorithm, which supports a
 number of useful search options: edge filters, node filters, goal
 predicates, multiple starting nodes, multiple ending nodes, using any
 attribute or function as the cost for an edge, and 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 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 

Re: Clojure Async/State Machine/Workflow Libraries?

2015-04-30 Thread Vjeran Marcinko
If you're looking for something similar to some BPM (BPMN, BPEL...) engines 
in Clojure land, I *think* there is nothing similar here. I'm actually 
researching that area occasionally, and thinking wishfully about 
implementing one in Clojure someday.

When core.async appeared first, since it also comes from process area of 
IT (CSP, actors, process algebra...), I thought it would be sufficient for 
that case also, but unfortunately it seems it has some strong differences 
between BPM engines which are session-based, meaning, each message that 
is received over channel marked as 'session creator' spawns new async 
process which is long, very long running (potentially years), and all 
subsequent messages that have correlation value for that process are routed 
to that session afterwards. 

Biggest similarity is that both approaches (BPM enginer and core.async) 
invert control of execution, meaning, you write easy-to-grasp sequential 
code which is executed asynchronously, but one would need option to stop 
the execution in some point of go block, persist it, and continue it 
later. In Java, Apache ODDE, which is BPEL engine, uses Pi-calculus engine 
underneath, that uses continuations queue and is able to persist the 
session on demand, and dehydrate it again when needed, even if that moment 
comes a year later..

In other words, we need something like durable, restartable, GO blocks, for 
each indivudual long-running session, and there can be hundreds of 
thousands of them active in a system simultaneously (think about hundred k 
of active purchase orders...).

-Vjeran

On Thursday, April 30, 2015 at 1:35:25 PM UTC+2, Tim Visher wrote:

 Hey All,

 Anyone have any tips on clojure 'workflow' libraries? 
 https://github.com/relaynetwork/impresario is very close, but lacks some 
 basic features like exception transitions, etc. 

 Basically, I'm looking for a library that allows me to create a workflow 
 that will happen asynchronously, recording it's progress in a db. I think i 
 could probably whip something together without _too_ much trouble using 
 core.async but this feels like something that's probably already been 
 written.

 Thanks in advance!

 --

 In Christ,

 Timmy V.

 http://blog.twonegatives.com/
 http://five.sentenc.es/ -- Spend less time on mail


-- 
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: Newbie

2015-04-30 Thread Gary Schiltz
If you like videos, the ClojureTV https://www.youtube.com/user/ClojureTV 
YouTube channel is a good place to start. Dimitri Sotnokov has a free, 
concise introduction to the language that you can download from the 
publisher's page for his book Web Development with Clojure 
https://pragprog.com/book/dswdcloj/web-development-with-clojure. There 
are so many good resources out there now that don't want you to think I'm 
singling those two out as being better than anything else, they are just 
what I've been looking at lately (in addition to the Day of Datomic 
videos). You shouldn't have any trouble finding vastly more help, and the 
Clojure community is very supportive and friendly. Good luck on your 
journey!

On Thursday, April 30, 2015 at 8:26:26 AM UTC-5, Pitou Khmer wrote:

 Dear all experts here, 

 Could you share me the presentation that describing about Clojure for 
 newbie developer to make more easy to understand? 

 Thanks, 
 Pitou  


-- 
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] clasew 0.1.18

2015-04-30 Thread Frank Castellucci

https://github.com/FrankC01/clasew

*clasew *- Clojure AppleScriptEngine Wrapper

*Intent* - classes provides an idiomatic Clojure wrapper for Java 
ScriptManager: specifically apple.AppleScriptManager, as well as providing 
scriptable applications HOF DSLs.

Realizing that the audience for such capability may be minimal, others may 
find this a useful addition to the 'niche' library. Feedback (+/-) and 
comments (+/-) are always welcome and appreciated.

Frank V. Castellucci

-- 
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: Newbie

2015-04-30 Thread Jeff Heon
I quite like these two resources for total beginners.

(Starts up assuming you know nothing about Lisp.)
aphyr.com/tags/Clojure-from-the-ground-up

(Quite humorous)
http://www.braveclojure.com/

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


flip in clojure

2015-04-30 Thread Vagmi Mudumbai
Hi,

I was introducing one of my colleagues to clojure[1] and we were
trying to parse the reddit json as an exercise.

(require '(clj-http.client :as client))
(require '(clojure.data.json :as json))

(def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100;)
(def ^:const headers {:headers {User-Agent showoffclojure.core by vagmi}})

(let [entries_ (- REDDIT-URL
   (client/get headers)
   (:body)
   (json/read-str :key-fn keyword)
   (:data)
   (:children))]
  (map :data entries))

It would have been nice if we were able to write the map as a part of
the threading macro. So if there were a flip function like in haskell,
we could flip the args to the function hand have the map in the
threading macro. I could not find one so I wrote one.

(defn flip [fn_]
  (fn [x y  args]
(apply fn_ (into [y x] args

Now I can bring in the map as a part of the - threading macro.

(- REDDIT-URL
(client/get headers)
(:body)
(json/read-str :key-fn keyword)
(:data)
(:children)
((flip map) :data))

This seems to be rather easy and useful and gets rid of the let block.
Are there any implications to performance or impact to laziness by
using flip? This would be useful even on the transduced version of
map like ((flip transduce) (map :data)) on the last expression.

Regards,
Vagmi


[1]: 
(http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/)
and

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


Embedded systems and transpiling Clojure to Nim

2015-04-30 Thread Alan Moore
All,

I just ran across Nim (previously Nimrod) which is a garbage collected 
systems programming language that looks like a suitable target for 
transpiling Clojure. See:

http://nim-lang.org/

My goal in looking at this is to have Clojure available in native code on 
real-time embedded systems which is what I work on in my day job. It seemed 
like targeting LLVM was the way forward with this goal but I have not heard 
of any progress in this area and it feels large and foreboding. Obviously 
targeting LLVM gives you a lot beyond just native code but it is limited in 
the processors it supports. We use Freescale PPC processors which neither 
LLVM nor most Javascript engines support, or if they do, they do so in a 
very limited way - e.g. only certain procs, etc.

Having a compiler toolchain that resolves down to C, small executables and 
no/few dependencies is a huge advantage for using something like Nim.

Is this of interest to anyone else? I'd like to get a proof of concept 
started. Advice on porting Clojure to other languages would be greatly 
appreciated :-)

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: Clojure Async/State Machine/Workflow Libraries?

2015-04-30 Thread Alan Moore
Timmy,

Several BPM tools are derivatives of or are directly based upon business 
rule engines. They usually pile on a bunch of higher level abstractions, 
UIs and/or frameworks to make them business user friendly. I have not seen 
anything like this in Clojure.

However, you might want to take a look at Clara which is a rule engine 
written in Clojure. It would give you a lower level library upon which you 
could build the rest of the BPM feature sets.

If Clara doesn't give you all of what you need you could look into 
integrating with the JBoss/Drools tooling via Java interop.

Good luck!

Alan


On Thursday, April 30, 2015 at 10:11:43 AM UTC-7, Vjeran Marcinko wrote:

 If you're looking for something similar to some BPM (BPMN, BPEL...) 
 engines in Clojure land, I *think* there is nothing similar here. I'm 
 actually researching that area occasionally, and thinking wishfully about 
 implementing one in Clojure someday.

 When core.async appeared first, since it also comes from process area of 
 IT (CSP, actors, process algebra...), I thought it would be sufficient for 
 that case also, but unfortunately it seems it has some strong differences 
 between BPM engines which are session-based, meaning, each message that 
 is received over channel marked as 'session creator' spawns new async 
 process which is long, very long running (potentially years), and all 
 subsequent messages that have correlation value for that process are routed 
 to that session afterwards. 

 Biggest similarity is that both approaches (BPM enginer and core.async) 
 invert control of execution, meaning, you write easy-to-grasp sequential 
 code which is executed asynchronously, but one would need option to stop 
 the execution in some point of go block, persist it, and continue it 
 later. In Java, Apache ODDE, which is BPEL engine, uses Pi-calculus engine 
 underneath, that uses continuations queue and is able to persist the 
 session on demand, and dehydrate it again when needed, even if that moment 
 comes a year later..

 In other words, we need something like durable, restartable, GO blocks, 
 for each indivudual long-running session, and there can be hundreds of 
 thousands of them active in a system simultaneously (think about hundred k 
 of active purchase orders...).

 -Vjeran

 On Thursday, April 30, 2015 at 1:35:25 PM UTC+2, Tim Visher wrote:

 Hey All,

 Anyone have any tips on clojure 'workflow' libraries? 
 https://github.com/relaynetwork/impresario is very close, but lacks some 
 basic features like exception transitions, etc. 

 Basically, I'm looking for a library that allows me to create a workflow 
 that will happen asynchronously, recording it's progress in a db. I think i 
 could probably whip something together without _too_ much trouble using 
 core.async but this feels like something that's probably already been 
 written.

 Thanks in advance!

 --

 In Christ,

 Timmy V.

 http://blog.twonegatives.com/
 http://five.sentenc.es/ -- Spend less time on mail



-- 
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: flip in clojure

2015-04-30 Thread Robert Levy
from https://github.com/rplevy/mostly-useful (not updated in a while)

(defn flip
  given a function, create a flipped 2-argument function
  [f]
  (fn [a b] (f b a)))

(defmacro flop
  create a version of a function with a modified arity as specified by a
   vector of zero-indexed positions, e.g. [0 3 1 2]
  [f positions]
  (let [syms (vec (repeatedly (count positions) gensym))]
`(fn [~@syms] (~f ~@(map syms positions)



On Thu, Apr 30, 2015 at 5:49 PM, Jony Hudson jonyepsi...@gmail.com wrote:

 Another option is to use `as-`
 https://clojuredocs.org/clojure.core/as-%3E . It's more verbose ... I
 kind of like that aspect of it, but it may not be to everyone's taste.


 Jony


 On Friday, 1 May 2015 00:31:05 UTC+1, Vagmi Mudumbai wrote:

 Hi,

 I was introducing one of my colleagues to clojure[1] and we were
 trying to parse the reddit json as an exercise.

 (require '(clj-http.client :as client))
 (require '(clojure.data.json :as json))

 (def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100;)
 (def ^:const headers {:headers {User-Agent showoffclojure.core by
 vagmi}})

 (let [entries_ (- REDDIT-URL
(client/get headers)
(:body)
(json/read-str :key-fn keyword)
(:data)
(:children))]
   (map :data entries))

 It would have been nice if we were able to write the map as a part of
 the threading macro. So if there were a flip function like in haskell,
 we could flip the args to the function hand have the map in the
 threading macro. I could not find one so I wrote one.

 (defn flip [fn_]
   (fn [x y  args]
 (apply fn_ (into [y x] args

 Now I can bring in the map as a part of the - threading macro.

 (- REDDIT-URL
 (client/get headers)
 (:body)
 (json/read-str :key-fn keyword)
 (:data)
 (:children)
 ((flip map) :data))

 This seems to be rather easy and useful and gets rid of the let block.
 Are there any implications to performance or impact to laziness by
 using flip? This would be useful even on the transduced version of
 map like ((flip transduce) (map :data)) on the last expression.

 Regards,
 Vagmi


 [1]: (
 http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/)

 and

  --
 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: flip in clojure

2015-04-30 Thread Jony Hudson
Another option is to use `as-` https://clojuredocs.org/clojure.core/as-%3E 
. It's more verbose ... I kind of like that aspect of it, but it may not be 
to everyone's taste.


Jony

On Friday, 1 May 2015 00:31:05 UTC+1, Vagmi Mudumbai wrote:

 Hi, 

 I was introducing one of my colleagues to clojure[1] and we were 
 trying to parse the reddit json as an exercise. 

 (require '(clj-http.client :as client)) 
 (require '(clojure.data.json :as json)) 

 (def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100;) 
 (def ^:const headers {:headers {User-Agent showoffclojure.core by 
 vagmi}}) 

 (let [entries_ (- REDDIT-URL 
(client/get headers) 
(:body) 
(json/read-str :key-fn keyword) 
(:data) 
(:children))] 
   (map :data entries)) 

 It would have been nice if we were able to write the map as a part of 
 the threading macro. So if there were a flip function like in haskell, 
 we could flip the args to the function hand have the map in the 
 threading macro. I could not find one so I wrote one. 

 (defn flip [fn_] 
   (fn [x y  args] 
 (apply fn_ (into [y x] args 

 Now I can bring in the map as a part of the - threading macro. 

 (- REDDIT-URL 
 (client/get headers) 
 (:body) 
 (json/read-str :key-fn keyword) 
 (:data) 
 (:children) 
 ((flip map) :data)) 

 This seems to be rather easy and useful and gets rid of the let block. 
 Are there any implications to performance or impact to laziness by 
 using flip? This would be useful even on the transduced version of 
 map like ((flip transduce) (map :data)) on the last expression. 

 Regards, 
 Vagmi 


 [1]: (
 http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/)
  

 and 


-- 
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: Minimum Viable Database Component

2015-04-30 Thread Derek Troy-West
Hi Andy, 

 We use component at SMX, and do follow an approach similar to the one you 
hint at but as Stuart suggests we tend to have protocols that are more 
application-centric.
 
 For instance, we use Cassandra extensively and our general interaction 
with that is captured by the protocol:

(defprotocol Connection
  (bind [this stmt vals] bind values to a prepared statement)
  (prepare [this query] provide a prepared statement from a query)
  (execute [this stmt] [this stmt opts] execute a query or statement)
  (execute-batch [this stmts] [this stmts opts] execute a batch of 
statements)

That isn't an attempt to create an abstraction of Cassandra, it captures 
one way in which a number of our applications use Cassandra.

In certain test cases that allows us to use a stub-component which returns 
canned responses, in other cases we integrate with a test Cassandra 
cluster, both have merits.

One further advantage is this protocol would allow us to swap the 
underlying implementation (which is currently based on Alia 
- https://github.com/mpenet/alia) with something else if we ever wanted to 
without impacting consumers of that protocol. That wasn't the driver for it 
though, stubbed tests was.



On Thursday, April 30, 2015 at 1:54:38 PM UTC+10, Andy Chambers wrote:

 Hi All,

 I'm trying to follow the component architecture for an app I'm working 
 on and wondered if I was missing something. In the Just enough structure 
 talk, one of the examples Stuart presents is a DB component that contains 
 just a small selection of DB related functions (i.e. insert, and query 
 IIRC) so that when you need to mock it out for your tests, you don't have 
 to implement the entire JDBC interface.

 This makes sense but I'm wondering if anyone has released such a subset 
 (possibly expanded to include things like transactions, and maybe a few 
 utility query builders) as open source ideally with a corresponding mock 
 implementation. With the popularity of the component library, I'm surprised 
 not to find ready made components I can just plug into my app.

 If there's nothing like this already, then I guess I have an idea for a 
 new project. Anyone think this is a good idea or would everyone's ideal DB 
 component look a little different? Look forward to hearing your thoughts.

 Cheers,
 Andy


-- 
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: flip in clojure

2015-04-30 Thread Ben Wolfson
- and - actually play nice with each other in this direction:

(- 4
  range
  (- (map inc))
  last)

results in 4, because we end up with (- (range 4) (- (map inc)) last)
-- (- (- (range 4) (map inc)) last) -- (last (- (range 4) (map
inc))) -- (last (map inc (range 4))). Though all this saves you is a
single function call, and flip is a useful thing to have around anyway.

btw, as far as flip, you don't need the into call; you can just do:

(defn flip [f] (fn [x y  args] (apply f y x args))

though I don't know how if this is actually significant.


On Thu, Apr 30, 2015 at 3:47 PM, Vagmi Mudumbai m...@vagmim.in wrote:

 Hi,

 I was introducing one of my colleagues to clojure[1] and we were
 trying to parse the reddit json as an exercise.

 (require '(clj-http.client :as client))
 (require '(clojure.data.json :as json))

 (def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100;)
 (def ^:const headers {:headers {User-Agent showoffclojure.core by
 vagmi}})

 (let [entries_ (- REDDIT-URL
(client/get headers)
(:body)
(json/read-str :key-fn keyword)
(:data)
(:children))]
   (map :data entries))

 It would have been nice if we were able to write the map as a part of
 the threading macro. So if there were a flip function like in haskell,
 we could flip the args to the function hand have the map in the
 threading macro. I could not find one so I wrote one.

 (defn flip [fn_]
   (fn [x y  args]
 (apply fn_ (into [y x] args

 Now I can bring in the map as a part of the - threading macro.

 (- REDDIT-URL
 (client/get headers)
 (:body)
 (json/read-str :key-fn keyword)
 (:data)
 (:children)
 ((flip map) :data))

 This seems to be rather easy and useful and gets rid of the let block.
 Are there any implications to performance or impact to laziness by
 using flip? This would be useful even on the transduced version of
 map like ((flip transduce) (map :data)) on the last expression.

 Regards,
 Vagmi


 [1]: (
 http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/
 )
 and

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




-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

-- 
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: flip in clojure

2015-04-30 Thread Sean Corfield
I wonder how many code bases out there have their own variant of `flip`?

Here’s ours:

(defn flip
  Like partial except you supply everything but the first argument.
  ([f b] (fn [a] (f a b)))
  ([f b c] (fn [a] (f a b c)))
  ([f b c d  more]
   (fn [a] (apply f a b c d more

Sean


On Apr 30, 2015, at 4:44 PM, Ben Wolfson wolf...@gmail.com wrote:
 Though all this saves you is a single function call, and flip is a useful 
 thing to have around anyway.
 
 btw, as far as flip, you don't need the into call; you can just do:
 
 (defn flip [f] (fn [x y  args] (apply f y x args))
 
 though I don't know how if this is actually significant.
 
 
 On Thu, Apr 30, 2015 at 3:47 PM, Vagmi Mudumbai m...@vagmim.in 
 mailto:m...@vagmim.in wrote:
 Hi,
 
 I was introducing one of my colleagues to clojure[1] and we were
 trying to parse the reddit json as an exercise.
 
 (require '(clj-http.client :as client))
 (require '(clojure.data.json :as json))
 
 (def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100 
 http://reddit.com/r/clojure.json?limit=100)
 (def ^:const headers {:headers {User-Agent showoffclojure.core by vagmi}})
 
 (let [entries_ (- REDDIT-URL
(client/get headers)
(:body)
(json/read-str :key-fn keyword)
(:data)
(:children))]
   (map :data entries))
 
 It would have been nice if we were able to write the map as a part of
 the threading macro. So if there were a flip function like in haskell,
 we could flip the args to the function hand have the map in the
 threading macro. I could not find one so I wrote one.
 
 (defn flip [fn_]
   (fn [x y  args]
 (apply fn_ (into [y x] args
 
 Now I can bring in the map as a part of the - threading macro.
 
 (- REDDIT-URL
 (client/get headers)
 (:body)
 (json/read-str :key-fn keyword)
 (:data)
 (:children)
 ((flip map) :data))
 
 This seems to be rather easy and useful and gets rid of the let block.
 Are there any implications to performance or impact to laziness by
 using flip? This would be useful even on the transduced version of
 map like ((flip transduce) (map :data)) on the last expression.
 
 Regards,
 Vagmi
 
 
 [1]: 
 (http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/
  
 http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/)
 and


-- 
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 community organisation

2015-04-30 Thread Daniel Solano Gómez
On Wed Apr 29 11:10 2015, Hildeberto Mendonça wrote:
 This is a awesome idea!
 
 In my opinion, this organization would attract the maximum number of people
 if its mission is centred on Knowledge Management:
 
1. Wiki-based Clojure documentation, such as clojuredocs.org, containing
the official documentation, but constantly improved by the community with
more examples and rephrasing complex sentences, etc;
2. Wiki-based libraries documentation, related to Clojars and following
the same model of the previous documentation;
3. Agregation of content produced by bloggers and websites out there,
everything indexed by tags linked to Clojure versions and libraries in
clojars for cross-navigation;
4. Agregation of videos and slides produced by conference speakers,
instructors.
5. Everything gamefied so people can win points for their contributions
and increase their reputation like in stackoverflow.com.
 
 I would love to join as a member to have discounts in books, conferences,
 courses, tshirts, etc.
 
 I absolutely rate professional certifications, but I'm in favour of
 certified courses, so we can be sure the instructors are capable of
 teaching Clojure properly, with idiomatic code.
 
 What about promoting Clojure as a first language in universities? We would
 need to help teachers to create equivalent syllabus to the ones they are
 already using to teach Python, for example.
 
 So, this is my brainstorming.

Thank you for your input.  You've brought up a few key things that are
important to help grow the Clojure community, especially better
documentation and learning materials.  That's definitely something we
need to figure out how to promote.

I appreciate any ideas on how to an org can help ake this happen.

Sincerely,

Daniel

 
 On Wed, Apr 29, 2015 at 12:02 AM, Daniel Solano Gómez cloj...@sattvik.com
 wrote:
 
  Hello, all,
 
  I've brought up the idea of some sort of Clojure community organisation
  a few times on this mailing list.  The ideas is to help grow the Clojure
  community by doing things like supporting GSoC students, run
  infrastructure like Clojars, help run conferences, etc.  I have decided
  to start moving forward and apply for fiscal sponsorship from the
  Software Freedom Conservancy and Software in the Public Interest.  Those
  things take time to work themselves out.  In the meantime, I appreciate
  any input/feedback about what this org should do or what it should look
  like.  As such, I have posted a page on the community wiki to start
  braainstorming and discussing ideas
  http://dev.clojure.org/display/community/Clojure+Community+Organisation.
 
  A big thank you to everyone.  Participating in this community has been a
  very positive experience for me, and I would love to see it to continue
  to flourish.  I appreciate any help or advice on how to make this
  initiative succeed in supporting the community.
 
  Sincerely,
 
  Daniel
 
  --
  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.
 
 
 
 
 -- 
 Hildeberto Mendonça, Ph.D
 Blog: http://www.hildeberto.com
 Community: http://www.cejug.net
 Twitter: https://twitter.com/htmfilho
 
 -- 
 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 

Re: [ANN][book] Clojure Reactive Programming

2015-04-30 Thread Leonardo Borges
Thanks Pieter,

I hope you enjoy it!

Cheers,
Leo

On Thursday, April 30, 2015 at 9:35:01 PM UTC+10, Pieter Vallen wrote:

 Thanks for writing the book. Just bought it (before the marketing 
 discussion;-)) and really like what I've read so far!

 Cheers,
 Pieter

 Op dinsdag 24 maart 2015 15:26:02 UTC+1 schreef Leonardo Borges:

 Hi all,

 Some of you may know that I have been working on a book for the better 
 part of last year.

 I'm happy to announce it has finally been published! Here's the link: 
 https://www.packtpub.com/web-development/clojure-reactive-programming

 I hope you find it useful! I've had a great time putting it together!

 Cheers,
 Leonardo Borges
 www.leonardoborges.com



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