Re: ANN: durable-persistence for Clojure and ClojureScript

2016-09-08 Thread dgrnbrg
This sort of thing is also the goal of Datacrypt & Hitchhiker trees 
(https://github.com/datacrypt-project/hitchhiker-tree), which are designed 
to be highly optimized for I/O.

We've been making progress on the GC and adding new backends--it would be 
awesome to be able add a CLJS port too :)

Best,
David

On Thursday, September 8, 2016 at 4:28:08 PM UTC-6, Christian Weilbach 
wrote:
>
> Hi, 
>
> I have started some explorations for durable persitent indices in a 
> cross-platform fashion, that I wanted to for quite some time now. There 
> are some other implementations of persistent datastructures with 
> synchronous IO on the JVM, but I would like to go a step further and 
> generalize over any key-value store like medium. I am primarily 
> interested in critique and references to other work or experience 
> implementing efficient indices on disk. In the longer run I want to use 
> these indices as a building block for databases in Clojure(Script). 
>
> https://github.com/replikativ/durable-persistence 
>
> From the README: 
>
> This repository is for exploration of persistent datastructures on a 
> durable medium. The durable medium is abstracted away by a minimalistic 
> key-value protocol providing atomic operations (ACID) on single keys. 
> This decouples the implementation of the persistent datastructure from 
> the host and backend store. 
>
> The repository contains an adaptation of the cookbook in-memory version 
> of a red black tree. Instead of keeping all fragments in memory we 
> introduce a Reference type to fragments in the store and dynamically 
> load and store fragments. The root can be assigned to a fixed key, 
> modelling a durable identity similar to a Clojure atom. 
>
> The long term motivation is to provide efficient indices as a building 
> block for datatype management independent of JVM IO libraries spanning 
> also to ClojureScript and the Browser. With konserve an IndexedDB 
> storage backend for the Browser already exists. For this reason IO 
> should happen asynchronously through core.async in konserve. A durable 
> Index for DataScript would be nice :). 
>
>
> Feedback is appreciated :), 
> Christian 
>
>

-- 
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: Datomic namespaced idents question

2015-04-05 Thread dgrnbrg
Actually, in Datomic, the namespaces don't have any special meaning for the 
database itself--you can choose to use whatever namespace (or even no 
namespace)! Using namespaces is a convention to help you keep track of 
which attributes belong to which entities.

We don't use a separate model layer for our systems--the Datomic APIs are 
actually pretty rich when it comes to manipulating the system, between the 
transactions as data and the entity API.

On Sunday, April 5, 2015 at 11:32:50 AM UTC-4, Stig Brautaset wrote:

 I have a question regarding using Datomic from Clojure, but I think it's 
 more of a Clojure question than a Datomic question

 I understand that you must use namespaces in idents for logically distinct 
 types of entities. (Unless you intend them to be lumped together in the 
 same index.) Thus the :ids in two entities below don't conflict:

 {:foo/id 1
  :name Name of a Foo}

 {:bar/id 1
  :desc Bar's don't have names, they have desc}

 So far so good.

 My question is: do you expose this namespacing outside the model layer 
 when working in Clojure? I'm inclined to say that this namespacing is an 
 implementation detail of the database and so add/remove them in the model 
 layer. I would love to hear your opinions.

 Stig


-- 
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] ring.middleware.logger - Easy Ring Request Logging

2014-10-02 Thread dgrnbrg
These are very useful! Thanks!

On Wednesday, October 1, 2014 10:12:06 PM UTC-4, Paul Legato wrote:

 I'm happy to announce ring.middleware.logger 
 https://github.com/pjlegato/ring.middleware.logger, which logs details 
 of each Ring request to a file, or to arbitrary functions you provide. The 
 emphasis is on simplicity -- you can plug it in and go with sane 
 out-of-the-box defaults, without any user configuration required.

 You can find it at https://github.com/pjlegato/ring.middleware.logger and 
 on Clojars.

 I've been using it in production for several years, and it has now 
 stabilized to the point where I feel comfortable announcing it to a wider 
 audience. That said, it should be considered beta quality software -- API 
 changes are unlikely, but there may be bugs. Feature suggestions and 
 especially pull requests are welcome!

 You might like to use r.m.logger with its companion project, 
 https://github.com/pjlegato/ring.middleware.conditional -- this allows 
 you to activate any middleware selectively, based on arbitrary runtime 
 state. For example, combining it with ring.middleware.logger, you can log 
 only requests that have certain URI paths, certain IP addresses, or log 
 selectively based any other condition you like.

 Best,
 Paul Legato




-- 
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] Async Ring 0.1.0

2014-09-10 Thread dgrnbrg
Hi Paul,
Thanks for your feedback! I updated the comparison with pedestal when 
discussing the async queues to address this point.

I am also really excited about Jet--I think that it would be a great 
combination with Spiral!

One key difference in Spiral from Jet and Pedestal is that not only can you 
use core.async to make an async handler, but you can also make async 
middleware using core.async as well.

On Wednesday, September 10, 2014 6:29:11 AM UTC-4, Paul deGrandis wrote:

 Hi David,

 It's excellent to see this tools and others like it (eg: Max Penet's Jet - 
 https://github.com/mpenet/jet)!  The more ideas we get in this area, the 
 better all the tooling will become.
 There are a few things I'd like to clear about the notion of asynchronous 
 processing in general and the comparison to Pedestal specifically.  I think 
 in discussing the details, everyone will come out ahead.

 1. The interceptor queue is merely the current path.
 In your comparison, you state that Pedestal forces Interceptors to be 
 placed in a queue for execution.  This isn't entirely accurate.  You can 
 arbitrarily specify the order of interceptors (imagine a graph of connected 
 interceptors).  The interceptor queue is merely the current path of 
 interceptors executing (or scheduled to execute).  Any interceptor can 
 dynamically add more interceptors to that path during execution.  The 
 interceptor is the core abstraction from which all things are built in 
 Pedestal - it's the only abstraction.
 I have written a predicate dispatch Interceptor that allows 
 open/extensible rules to route requests - with the interceptor you can 
 create a Liberator-style system, QoS-style routing, or anything of similar 
 nature.  I also have written a cond-interceptor, that does a one-off 
 conditional dispatch.  Both will probably land in Pedestal's base 
 interceptors at some point.

 2. One notion of concurrency in Pedestal is managed with core.async
 In your comparison, you state the concurrency mechanism is pure 
 functions.  This is also not accurate.  The concurrency mechanism to signal 
 to the container you're going async, is to have an interceptor return a 
 core.async channel (we'll call this the context channel).  In the 
 application code, you continue forward using core.async.  Once you want the 
 web-server to resume processing your request, you place a context (a map) 
 on the context channel (sometimes others refer to the context channel as 
 the resume channel).  I think what you're getting at is there's a notion 
 of interceptors for entering, leaving, and handling errors - which I'll 
 address in the next item.

 3. There are two notions of async behavior - Pedestal delivers both.
 One notion of async behavior was discussed above - your application gives 
 up the current/main execution thread, continues execution on another 
 thread, and later gets resumed on one of the main execution threads.  To 
 truly do this in an asynchronous manner, one must separate the notion of 
 request and response.  This is why Pedestal uses a context, and why 
 function composition and coupling request and response will limit (or 
 prevent) async capabilities.  To be async in this sense, you must never 
 block the main execution thread at any point.
 Another notion of async behavior occurs when placing the actual response 
 on the wire - most applications do so in a blocking manner using standard 
 Java IO.  Recently, Pedestal added the capability to do this in a 
 non-blocking, asynchronous manner using NIO.  That is, in Pedestal, if your 
 response body is a ByteBuffer or a ReadableByteChannel, and you're running 
 on a container that supports NIO (Jetty), it will use NIO through the 
 entire container when handling the request.  If a developer can't get 
 manage to return a ByteBuffer or a ReadableByteChannel (or if the developer 
 is on a container that doesn't support NIO), they can still return a 
 core.async Channel and Pedestal will perform the standard IO response 
 within a `go`.  Using a core.async Channel has limits, and NIO should be 
 preferred if available.

 4. Routing and Extension
 Two pieces missing from the comparison were routing and general extension 
 mechanisms.  I won't dive too deep into the routing piece (it's data 
 driven, can be programmatically consumed or generated, can be read off of 
 the wire or out of a DB, etc), but I do want to touch upon the extension 
 piece a bit.  In Pedestal, all the major integration points are backed by 
 protocols - including the async handling discussed above.  This allows 
 developers to shape and extend Pedestal to fit any operational need.  
 Routing is also backed by protocols, which enables a developer to shape how 
 routing endpoints should be interrupted.  Pedestal's use of protocols
 throughout has proven extremely beneficial as I've tackled complex web 
 systems.

 I hope this helps clarify some topics and I look forward to further 
 discussion!

 Cheers,
 Paul



Re: [ANN] Async Ring 0.1.0

2014-09-09 Thread dgrnbrg
Async Ring has been renamed to Spiral, a Ring that doesn't block, to avoid 
future confusion.

On Tuesday, September 9, 2014 12:50:11 PM UTC-4, James Reeves wrote:

 Hi David,

 This looks very interesting, however I'd like to request that you change 
 the name to make it clear this project isn't an official part of Ring. 
 Usually I don't mind if a library uses Ring in its name, but in this case 
 it seems like there could be a future source of confusion if Ring itself 
 adopts an asynchronous approach.

 - James


 On 9 September 2014 16:24, David Greenberg dsg123...@gmail.com 
 javascript: wrote:

 Announcing the release of Async Ring! Ring is a great foundation for 
 building HTTP servers in Clojure. However, Ring fails to solve many 
 problems that high-performance and transactional HTTP servers must solve:


- What does the server do when it can't handle the request rate?
- How can the server dedicate more or fewer resources to different 
requests?
- How can long-running HTTP requests be easily developed, without 
blocking threads?


 Async Ring attempts to solve these problems by introducing a core.async 
 based API that is backwards compatible with Ring and popular Ring servers, 
 so that you don't need to rewrite your app to take advantage of these 
 techniques.


 Async Ring comes with many features:

- Ports of most ring middleware (just ask me and I'll port your 
favorites!)
- Beauty, a compojure  clout compatible concurrent quality-of-server 
router
- Integration with Jetty and Http-Kit, more coming
- Documentation and Examples


 Take a look here: https://github.com/dgrnbrg/async-ring

 Feedback and pull requests welcome!

 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 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: Strange behavior with alts! and :default in core async

2014-08-15 Thread dgrnbrg
So, if a list whose first element is a vector is provided after a get or a 
put in alt!, then that's treated as the binding form/code to be executed if 
that succeeds, but if a non-list is provided, then that is treated as a 
value to return if that action was taken (and that value is evaluated 
before any operation happens)?

On Friday, August 15, 2014 8:35:05 AM UTC-4, Daniel Solano Gómez wrote:

 On Thu Aug 14 19:04 2014, dgrnbrg wrote: 
  You're all right--that was a cut  paste error. I meant that I see this 
  behavior with alt!!, not alts! 

 With alt!!, it should probably be something like: 

 (let [result (alt!! [[inner-chan e]] ([v] (if v 
 :put-a-value 
 :channel-closed)) 
 :default :failed-to-put 
 :priority true)] 
   (println result)) 

 I hope this helps. 

 Sincerely, 

 Daniel 

  
  On Thursday, August 14, 2014 3:31:45 PM UTC-4, Ghadi Shayban wrote: 
   
   What Daniel said.  The call is incorrect, its args are alt-shaped, but 
 it 
   calls alt*s*. 
   
   alt is the macro that is shaped like cond. 
   alts is the function that takes a vector 
   
   Both take splatted options at the end. 
   
   Can never use single bang* except within go.* 
   
   go = ! 
   thread = !! 
   
   Unfortunately if the two are confused, the exception will happen... 
   probably elsewhere. 
   
   On Thursday, August 14, 2014 2:46:22 PM UTC-4, Eric Normand wrote: 
   
   Hi there, 
   
   The :default option is for a *value* that should be returned if none 
 of 
   the channels are available. The expression is evaluated *before* the 
   async/alts! call happens (just like normal parameters). 
   
   I think you are misunderstanding alts!. It should be used like this 
   
   (let [[val ch] (async/alts! [[inner-chan e]] :default :default)] 
 (if (= :default val) 
   (println inner-chan was not ready) 
   (if val 
 (println did the put to inner-chan) 
 (println inner-chan is closed 
   
   I hope that helps. Let me know if you have any more questions. 
   
   Eric 
   
   On Thursday, August 14, 2014 11:03:01 AM UTC-5, dgrnbrg wrote: 
   
   When I use alts!, it seems that both the put and :default action run 
   every time. I've included the code sample below: 
   
   (let [inner-chan (async/chan (async/buffer 1000)) 
 mult (async/mult inner-chan) 
 (async/thread 
   (while true 
 (let [e (.take linked-blocking-queue)] 
   (async/alts! 
 [[inner-chan e]] (println did the put) 
 :default (println failed to put) 
 :priority true) 
   
   
   Elsewhere in the code, I tap the mult before I start putting 
 elements 
   onto the linked-blocking-queue. For every element I put onto the 
 LBQ, I see 
   both messages: did the put and failed to put. What is going on 
 here? 
   
   
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.com 
 javascript: 
  Note that posts from new members are moderated - please be patient with 
 your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  --- 
  You received this message because you are subscribed to the Google 
 Groups Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:. 
  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.


Strange behavior with alts! and :default in core async

2014-08-14 Thread dgrnbrg
When I use alts!, it seems that both the put and :default action run every 
time. I've included the code sample below:

(let [inner-chan (async/chan (async/buffer 1000))
  mult (async/mult inner-chan)
  (async/thread
(while true
  (let [e (.take linked-blocking-queue)]
(async/alts!
  [[inner-chan e]] (println did the put)
  :default (println failed to put)
  :priority true)


Elsewhere in the code, I tap the mult before I start putting elements onto 
the linked-blocking-queue. For every element I put onto the LBQ, I see both 
messages: did the put and failed to put. What is going on here?

-- 
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: Strange behavior with alts! and :default in core async

2014-08-14 Thread dgrnbrg
You're all right--that was a cut  paste error. I meant that I see this 
behavior with alt!!, not alts!

On Thursday, August 14, 2014 3:31:45 PM UTC-4, Ghadi Shayban wrote:

 What Daniel said.  The call is incorrect, its args are alt-shaped, but it 
 calls alt*s*.

 alt is the macro that is shaped like cond.
 alts is the function that takes a vector

 Both take splatted options at the end.

 Can never use single bang* except within go.*

 go = !
 thread = !!

 Unfortunately if the two are confused, the exception will happen... 
 probably elsewhere.

 On Thursday, August 14, 2014 2:46:22 PM UTC-4, Eric Normand wrote:

 Hi there,

 The :default option is for a *value* that should be returned if none of 
 the channels are available. The expression is evaluated *before* the 
 async/alts! call happens (just like normal parameters).

 I think you are misunderstanding alts!. It should be used like this

 (let [[val ch] (async/alts! [[inner-chan e]] :default :default)]
   (if (= :default val)
 (println inner-chan was not ready)
 (if val
   (println did the put to inner-chan)
   (println inner-chan is closed

 I hope that helps. Let me know if you have any more questions.

 Eric

 On Thursday, August 14, 2014 11:03:01 AM UTC-5, dgrnbrg wrote:

 When I use alts!, it seems that both the put and :default action run 
 every time. I've included the code sample below:

 (let [inner-chan (async/chan (async/buffer 1000))
   mult (async/mult inner-chan)
   (async/thread
 (while true
   (let [e (.take linked-blocking-queue)]
 (async/alts!
   [[inner-chan e]] (println did the put)
   :default (println failed to put)
   :priority true)


 Elsewhere in the code, I tap the mult before I start putting elements 
 onto the linked-blocking-queue. For every element I put onto the LBQ, I see 
 both messages: did the put and failed to put. What is going on here?



-- 
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: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-06 Thread dgrnbrg
The core of the matter is that http-kit's async channels are 
these: 
https://github.com/http-kit/http-kit/blob/master/src/java/org/httpkit/server/AsyncChannel.java

And core.async's are 
these: 
https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async/impl/channels.cljs#L27

You need to write your own glue code to interface these libraries together.

On Tuesday, May 6, 2014 2:32:09 PM UTC-4, tbc++ wrote:

 First of all, this shouldn't work at all, since you aren't requiring 
 core.async, so you shouldn't be getting anything about that library at all. 
 Perhaps you need to reload your repl, or perhaps there's something missing 
 in your gist?

 Thanks,

 Timothy


 On Mon, May 5, 2014 at 3:15 PM, Valentin Luchko akm...@gmail.comjavascript:
  wrote:

 Here is the gist
 https://gist.github.com/valichek/ba510de9ff2cf3d0c502

 P.S. sorry if my first post was odd
 понедельник, 5 мая 2014 г., 20:03:09 UTC+3 пользователь Valentin Luchko 
 написал:

 Could you explain me why after 
 clients;; = {#AsyncChannel 
 /0:0:0:0:0:0:0:1%0:-/0:0:0:0:0:0:0:1%0:60071 
 true}
 (into {} clients) ; = #ManyToManyChannel clojure.core.async.impl.
 channels.ManyToManyChannel@5d9c832a
 I get IllegalArgumentException java.lang.IllegalArgumentException: No 
 implementation of method: :take! of protocol: 
 #'clojure.core.async.impl.protocols/ReadPort 
 found for class: nil
 AsyncChannel is from http-kit

 and
 (merge {} clients) ;; #ManyToManyChannel clojure.core.async.impl.
 channels.ManyToManyChannel@5d9c832a

 How {#AsyncChannel /0:0:0:0:0:0:0:1%0:-/0:0:0:0:0:0:0:1%0:60071 
 true} is transformed to #ManyToManyChannel clojure.core.async.impl.
 channels.ManyToManyChannel@5d9c832a?
 I suspect it is because I use AsyncChannel as a key, but what is going 
 on?
  



  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 “One of the main causes of the fall of the Roman Empire was that–lacking 
 zero–they had no way to indicate successful termination of their C 
 programs.”
 (Robert Firth) 


-- 
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: Sliding Windows

2014-04-30 Thread dgrnbrg
We've had lots of luck with Narrator: https://github.com/ztellman/narrator

It's got loads of powerful features, including realtime  batch mode, 
integration with core.async and lamina, windows, functions, and recursive 
analyses.

On Tuesday, April 29, 2014 10:25:39 PM UTC-4, Paulo Suzart wrote:

 Hi Guys,

 I was looking for a very simple stream processing lib. We have some in 
 clojure (lamina, meltdown, esper, eep).

 The simplest one was clojure werkz eep, but they don't provide sliding 
 windows. I ender up writing this: 
 http://paulosuzart.github.io/blog/2014/04/27/sliding-window-events-with-clojure/

 And publishing this very small implementation using meltdown. 
 https://github.com/paulosuzart/sw . It is enough for a very simple use 
 case I have to deal. If anyone knows any other sliding window impl please 
 share.

 Regards

 -- 
 Paulo Suzart
 @paulosuzart 


-- 
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 Major breaking public API changes coming to several ClojureWerkz projects

2014-04-27 Thread dgrnbrg
Is this slated for Welle too? I didn't see it mentioned. 

-- 
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: dependencies from github

2014-03-27 Thread dgrnbrg
Voom is a Lein plugin that lets you depend on a repository and pins you to a 
specific commit. It also provides tools manage systems spanning multiple repos. 
You can find it here: https://github.com/LonoCloud/lein-voom and see the video 
from clojure/west here: 
https://m.youtube.com/watch?v=axztcYJUN4Ilist=PLZdCLR02grLp__wRg5OTavVj4wefg69hM

-- 
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] Kria, an async driver for Riak 2

2014-03-07 Thread dgrnbrg
This is really exciting! One question I have is how mature is Kria? Given that 
riak 2 isn't yet out, I'm still curious as to what kinds of testing/burn in 
you've done?

-- 
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] lein-modules 0.1.0 - multi-module support in Leiningen

2014-02-10 Thread dgrnbrg
Could you compare lein-modules with lein-voom? I can see that they have 
different features, but I'm trying get a handle on when each might be 
appropriate.

This looks like a great tool for large projects. Thank you!

On Monday, February 10, 2014 9:36:13 AM UTC-5, Jim Crossley wrote:

 Maven multi-module projects provide support for project aggregation, 
 letting you define parent-child relationships among a group of projects to 
 achieve interdependence-based build ordering, limited project inheritance, 
 and centralized dependency management.

 Maven's pom.xml files are verbose, error-prone, and just generally gross, 
 especially for multi-module projects, so I wanted to see if I could provide 
 the above features using Leiningen. The fruit of my labor thus far is this 
 plugin:

https://github.com/jcrossley3/lein-modules

 Project inheritance is achieved using Leiningen profiles. This is more 
 flexible than Maven, where the values subject to inheritance are 
 hard-coded. And profiles defined in your project's ancestors are activated 
 appropriately for each task, as you would expect.

 Dependency management is a lot simpler, too: it's just a map of dependency 
 symbols to version strings, from which your dependency specs are populated 
 by Leiningen middleware.

 See the README for more details and an example.

 Love,
 Jim



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: data-readers, spyscope

2014-02-01 Thread dgrnbrg
I have reproduced your issue--it is very strange, as on some of my machines 
spyscope works, and others, it fails the same as it does for you. This 
makes me think I am inadvertently relying on an unknown implementation 
detail. I have now observed that even when spyscope gets loaded into 
*data-readers* and is required, it still complains:

user= (require 'spyscope.core)
nil
user= *data-readers*
{base64 #'datomic.codec/base-64-literal, db/fn 
#'datomic.function/construct, db/id #'datomic.db/id-literal, spy/t 
#'spyscope.core/trace, spy/d #'spyscope.core/print-log-detailed, spy/p 
#'spyscope.core/print-log}
user= #spy/d (println hi)
#RuntimeException java.lang.RuntimeException: No reader function for tag 
spy/d

On Saturday, February 1, 2014 8:12:53 AM UTC-5, Dave Tenny wrote:

 Java 1.7.0.45
 Lein 2.3.4
 Clojure 1.5.1

 I'm trying to use https://github.com/dgrnbrg/spyscope and have put the 
 documented bits in my ~/.lein/profiles.clj
 but cannot get it to work.

 {:user {:dependencies [...  [spyscope 0.1.4] ...]
 :injections [(require 'spyscope.core)
  ]}}

 But when I do 'lein repl'
 *data-readers* doesn't contain the required mappings to the spy 
 definitions.

 If at the REPL I try something like

 (set! *data-readers* '{spy/p spyscope.core/print-log})

 and then

 #spy/p abc

 I get 

 RuntimeException No dispatch macro for: s 
  clojure.lang.Util.runtimeException (Util.java:219)


 What's the proper way to make spyscope work for all lein user profiles?





-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure debugging repl

2014-01-24 Thread dgrnbrg
I have an implementation of this that's thoroughly integrated into vim.

clojure code: https://github.com/dgrnbrg/redl
vim plugin: https://github.com/dgrnbrg/vim-redl

The code itself is written with core.async, and is capable of monitoring a 
thread, inspecting its stack while its running, stopping it, and 
programmatically creating breakpoints that give you a repl with captured 
locals.

I'd love for this work to be extended to a generic nrepl handler, but I 
don't have the time to do so at the moment.

On Friday, January 24, 2014 6:46:23 PM UTC-5, Jarrod Swart wrote:

 The second version of The Joy of Clojure talks about building a debugging 
 repl that allows insertion of breakpoints into code.  Perhaps something 
 similar could be done here.

 On Friday, January 24, 2014 4:38:59 PM UTC-5, t x wrote:

 Found it, apparently it's

 debug-repl = swank-clojure = CDT = ritz

 It appears cider does not yet support this, so ritz is probably the most 
 powerful at the moment.


 On Fri, Jan 24, 2014 at 3:39 AM, t x txre...@gmail.com wrote:

 Hi,

   One thing I miss from pre-Clojure scheme days is as follows:

 ## What I want

 1 = (foo) ;; I'm calling foo at the repl
 ... foo executes ...
 ... at some point, an exception is thrown ...

 2 = my interpreter _starts a new repl_
   * at the point where the exception was thrown
   * lets me examine local environment variables
   * lets me execute commands
   * lets me resume the execution


 ## Why it can't work

 Now, I understand why this can not work in general in Clojure, i.e. the 
 following example:

 (defn foo []
   (.someJavaFunctionThatThrowsException object))

 In this case, the above is impossible since the exception is thrown from 
 _java land_ rather than Clojure land.


 ## Why it might work

 Now, I'm not writing any code in java. The work I'm doing is pure 
 clojure. I can throw when the exception is thrown.


 Is there some library, where instead of doing

 (defn foo []
   ...
   (throw (ex-data ...))
   ...)

 I instead do:

 (defn foo []
   ...
   (something-went-wrong-please-fire-up-a-repl)
   ...)

 ?
  
 Thanks!




-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Looking for a reference binary parsing

2014-01-24 Thread dgrnbrg
I have found Gloss to be a pleasure to work with, and the fact that it 
handles framing, arbitrary header logic, and streaming decoding made it the 
best choice when I was writing codecs for binary formats whose files 
didn't/needed to be streamed, rather than bulk-loaded.

On Friday, January 24, 2014 10:56:23 AM UTC-5, James Reeves wrote:

 You might want to take a look at Gloss ( https://github.com/ztellman/gloss) 
 and Buffy ( 
 https://github.com/clojurewerkz/buffy ).

 - James


 On 24 January 2014 15:08, Kashyap CK ckka...@gmail.com javascript:wrote:

 Hi,
 I need to write a parser for MP4 - essentially, read an MP4 file and 
 create an in-memory representation of its structure.
 I'd appreciate it very much if I could get some suggestions on libraries 
 that I could use for this.
 Is there a https://github.com/youngnh/parsatron like library that works 
 on binary files as well?
 Regards,
 Kashyap

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: .cljrc

2013-11-25 Thread dgrnbrg
Another great feature of Leiningen is the :injections key in project.clj. 
This lets you run arbitrary code on the Leiningen-managed JVM startup. I 
recommend this when using Spyscope, which is a debugging tool that only 
needs to be required before you can use it: 
https://github.com/dgrnbrg/spyscope#usage

Using :injections is a powerful to customize the default referred vars, as 
well.

On Monday, November 25, 2013 10:01:12 AM UTC-5, Moritz Ulrich wrote:

 Leiningen profiles in ~/.lein/profiles.clj will be merged into the 
 current project.clj by leiningen. Also dumented in 
 https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.mdhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Ftechnomancy%2Fleiningen%2Fblob%2Fstable%2Fdoc%2FPROFILES.mdsa=Dsntz=1usg=AFQjCNGPecCbKEDAS5MWZP4qvsqXetVkTw
  

 On Mon, Nov 25, 2013 at 3:34 PM, Dave Tenny dave@gmail.comjavascript: 
 wrote: 
  With all my attention on trying to learn things about clojure, I've 
 either 
  missed or forgotten how do to a simple thing. 
  
  As I learn clojure I'm writing a few definitions that represent tools I 
 like 
  to use in development. 
  
  What is the simplest way to have those tools present in arbitrary 
 clojure 
  REPLs started with lein repl, emacs cider-jack-in, etc., without putting 
  them in project.clj files for every lein project I'm working on ? 
  
  I just want to load some things into the user (or other default ns if my 
  hypothetical .cljrc changes it) namespace and have it happen all the 
 time, 
  except when I'm doing release builds and such of a particular project. 
  
  Suggestions? 
  
  
  -- 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to use core.cache to store the results of expensive computations?

2013-10-25 Thread dgrnbrg
I've been looking through examples of usages of core.cache, and I have not 
been able to understand how to make a ref or atom backed cache that offers 
a simple API to the application programmer: I want to provide a key and a 
thunk, and have the cache either return me the cached value (if it's in the 
cache), or invoke the thunk and store it in the cache, returning the 
thunk's value.

How can I do this?

Thanks,
David

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Graph API

2013-06-17 Thread dgrnbrg
I think that there's already a project working on this called Loom. The 
furthest-developed fork is here: https://github.com/aysylu/loom which 
appears to have protocols for graphs, bindings to Titanium (the 
Clojurewerkz graph DB library), visualization support, and implementations 
of several algorithms.

Maybe there's a way to incorporate these projects?

On Monday, June 17, 2013 3:38:45 PM UTC-4, Stephen Kockentiedt wrote:

 Hello,

 I want to create a graph API similar to what core.matrix is for matrices. 
 I have created some protocols which every graph implementation has to 
 satisfy and a prototype implementation. Now I want your feedback on these 
 protocols. Which functions do you want to see which aren't there? Which 
 functions should be changed? Are there problems with the general design? 
 Have you any other feedback?

 Here are the protocol definitions:

 (defprotocol PGraph
   Minimal functionality of a graph.
   (directed? [g]
 Returns true if the graph is directed and false if the
  graph is undirected. If it is undirected, all functions
  taking two nodes must be commutative with regard to
  these nodes.)
   (nodes [g]
 Returns a set or sequence of all nodes of the graph. May
  not contain duplicates.)
   (has-edge? [g n1 n2]
 Returns true if the graph g has an edge from node n1
  to node n2.)
   (direct-successors [g n]
 Returns a set or sequence of all nodes n2 for which
  (has-edge? g n n2) returns true. May not contain
  duplicates.))

 (defprotocol PPredecessorGraph
   Optional functionality of a graph which can give a
list of all direct predecessors of a node.
   (direct-predecessors [g n]
 Returns a set or sequence of all nodes n2 for which
  (has-edge? g n2 n) returns true. May not contain
  duplicates.))

 (defprotocol PEditableGraph
   Minimal functionality of an editable graph.
   (mutable? [g]
 Returns true if the graph is mutated in place.
  If true is returned, the other functions change
  the graph passed as the first argument and return
  the same graph object. If false is returned, the
  functions return a new graph and the old graph is
  unchaged.)
   (add-node [g n]
 Adds the node n to the graph g. If it already
  contained n, the graph will not be changed.)
   (remove-node [g n]
 Removes the node n from the graph g. If it did
  not contain n, the graph will not be changed.)
   (add-edge [g n1 n2]
 Adds an edge from node n1 to node n2 to the graph g.
  If one or both of the nodes is not present it will
  be added to the graph. If the edge was already present,
  the graph will not be changed.)
   (remove-edge [g n1 n2]
 Removes the edge from node n1 to the node n2 from
  the graph g. If it did not contain the edge, the graph
  will not be changed.))

 (defprotocol PWeightedGraph
   Functionality of a graph whose edges can be weighted.
   (edge-weight [g n1 n2]
 Returns the weight of the edge from node n1 to
  node n2.))

 (defprotocol PEditableWeightedGraph
   Functionality of a weighted graph whose weights can be
changed.
   (update-edge-weight [g n1 n2 f]
 Updates the weight of the edge from node n1 to node n2,
  where f is a function taking the old value and returning
  the new one. If the graph did not contain the edge, it
  will be created.))

 (defprotocol PNodeDataGraph
   Functionality of a graph which stores data with its
nodes.
   (node-data [g n]
 Returns the data of the node n.))

 (defprotocol PEditableNodeDataGraph
   Functionality of a graph which stores editable data
with its nodes.
   (update-node-data [g n f]
 Updates the data of the node n, where f is a function
  taking the old value and returning the new one. If the
  graph did not contain the node, it will be added.))

 (defprotocol PEdgeDataGraph
   Functionality of a graph which stores data with its edges.
   (edge-data [g n1 n2]
 Returns the data of the edge from node n1 to node n2.))

 (defprotocol PEditableEdgeDataGraph
   Functionality of a graph which stores editable data
with its edges.
   (update-edge-data [g n1 n2 f]
 Changes the data of the edge from node n1 to n2, where
  f is a function taking the old value and returning the
  new one. If the graph did not contain the edge, it will
  be added.))


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

Re: Clojure in production

2013-06-13 Thread dgrnbrg
We are using Clojure at Two Sigma to monitor, schedule, and optimize our 
cluster.

On a related note, we're hiring: 
http://functionaljobs.com/jobs/149-distributed-systems-developer-at-two-sigma-investments

On Monday, June 10, 2013 5:47:25 PM UTC-4, Plinio Balduino wrote:

 Hi there 

 I'm writing a talk about Clojure in the real world and I would like to 
 know, if possible, which companies are using Clojure for production or 
 to make internal tools. 

 Thank you 

 Plínio Balduino 


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.

2013-05-31 Thread dgrnbrg
I'd like to point out a similar library I wrote for Clojure called 
spyscope: https://github.com/dgrnbrg/spyscope

With spyscope, you can write a handful of characters and get the stack 
frame, form, and its value pretty-printed and logged to a queue for future 
querying.

On Thursday, May 30, 2013 8:28:19 PM UTC-4, David Jacobs wrote:

 That's true -- that's why I wrote up the Letters debugging mini-library 
 for Ruby (lettersrb.com). However, there's friction there, too, and a 
 surprising number of people don't think to do this.   


 On Thursday, May 30, 2013 at 5:25 PM, Timothy Baldridge wrote: 

  Not really true, most of my programs contain this function: 

  (defn debug [x] 
  (pprint x) 
  x) 

  Now I can do this: 

  (comp foo debug bar) 

  Also, with some reader literal magic, I could write something to let me 
 do this: 

  (myfunc foo #dbg bar) 



  On Thu, May 30, 2013 at 6:12 PM, David Jacobs 
  da...@wit.iojavascript:(mailto:
 da...@wit.io javascript:) wrote: 
   Two more things: 
 
   1) printing is often not a viable option for lazily eval-ed sequences 
 or async processes -- the output gets jumbled! And believe me, when a new 
 Clojure dev sees that for the first time, he/she wants to quit.   
   2) printing is terrible for elegant clojure code -- thing (comp f g h 
 (partial map z)) -- in order to figure out anything about dynamic data 
 flowing through, you have to break apart that composition or add a let 
 binding in one of those functions before returning a value. Both of those 
 involve a lot of friction. 
 
 
   On Thursday, May 30, 2013 5:00:13 PM UTC-7, raould wrote: 
for a long time haskell did not have a debugger. that sucked, imho. 
   
 
   --   
   --   
   You received this message because you are subscribed to the Google 
   Groups Clojure group. 
   To post to this group, send email to 
   clo...@googlegroups.comjavascript:(mailto:
 clo...@googlegroups.com javascript:) 
   Note that posts from new members are moderated - please be patient 
 with your first post. 
   To unsubscribe from this group, send email to 
   clojure+u...@googlegroups.com javascript: (mailto:
 clojure%2b...@googlegroups.com javascript:) 
   For more options, visit this group at 
   http://groups.google.com/group/clojure?hl=en 
   ---   
   You received this message because you are subscribed to the Google 
 Groups Clojure group. 
   To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript: (mailto:
 clojure%2b...@googlegroups.com javascript:). 
   For more options, visit https://groups.google.com/groups/opt_out. 
 
 




  --   
  “One of the main causes of the fall of the Roman Empire was that–lacking 
 zero–they had no way to indicate successful termination of their C 
 programs.” 
  (Robert Firth)   

  --   
  --   
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to 
  clo...@googlegroups.comjavascript:(mailto:
 clo...@googlegroups.com javascript:) 
  Note that posts from new members are moderated - please be patient with 
 your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: (mailto:
 clojure+u...@googlegroups.com javascript:) 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 
  ---   
  You received this message because you are subscribed to the Google 
 Groups Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript: (mailto:
 clojure+u...@googlegroups.com javascript:). 
  For more options, visit https://groups.google.com/groups/opt_out. 







-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.

2013-05-28 Thread dgrnbrg
There's not much you can do to retrieve the locals around an exception with 
adding a Java Agent. REDL is able to get the locals around uses of 
redl.core/break, since it's a macro and that's an ability of macros.

On Monday, May 27, 2013 10:10:39 PM UTC-4, Lee wrote:


 On May 27, 2013, at 9:54 PM, Softaddicts wrote: 
  Lets take a real life example, [etc.] 
  
  Debugging was not a viable option. [etc.] 
  
  This project was extreme in this regard but it prove to me that 
 reviewing code offline 
  and thinking about how to improve it gives much more payback than using 
 the 
  debugger to fix a specific problem. 

 Okay, sometimes debuggers don't help... but sometimes they do! And often 
 it's necessary to step back and think... but sometimes having some key 
 information (like the value of the arguments to my function, or of some 
 other locals, that led to the error) makes the thinking a lot more 
 productive. 

 Elsewhere on this thread: 

 On May 27, 2013, at 9:36 PM, dgrnbrg wrote: 
  For Vim users, I ported the debug repl. This is a tool that allows you 
 to create a REPL in the middle of the call stack, which allows you to 
 suspend the evaluation of functions, lazy seqs, etc, and then inspect the 
 locals and globals at that location. If you've already installed Fireplace, 
 then you just need add the vim plugin and include redl in your project.clj, 
 and use :Repl or :ReplHere to create a repl, and then use redl.core/break 
 and redl.core/continue to use the debugger. You can find the vim component 
 here: https://github.com/dgrnbrg/vim-redl and the Clojure component here: 
 https://github.com/dgrnbrg/redl 

 This sounds pretty neat... but I also don't use Vim. (It's also not 
 completely clear to me from this description if you can get the locals from 
 the context of an error, rather than from a manual suspension.) 

 Is there anything that will provide the values of locals at an error 
 (whether interactively or in a big dump) regardless of the IDE or launch 
 method that one uses? 

 Or if there's nothing that's so general then is there anything that would 
 work from a call to lein run or from Clooj or from Eclipse/CCW? 

 Thanks, 

  -Lee 



-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.

2013-05-27 Thread dgrnbrg
For Vim users, I ported the debug repl. This is a tool that allows you to 
create a REPL in the middle of the call stack, which allows you to suspend 
the evaluation of functions, lazy seqs, etc, and then inspect the locals 
and globals at that location. If you've already installed Fireplace, then 
you just need add the vim plugin and include redl in your project.clj, and 
use :Repl or :ReplHere to create a repl, and then use redl.core/break and 
redl.core/continue to use the debugger. You can find the vim component 
here: https://github.com/dgrnbrg/vim-redl and the Clojure component 
here: https://github.com/dgrnbrg/redl

Let me know if you need help setting it up!

On Monday, May 27, 2013 2:34:23 PM UTC-4, Oskar Kvist wrote:

 Stuart Halloway said in his video Clojure in the Field (
 http://www.infoq.com/presentations/Clojure-tips) from March 1, 2013 (I 
 think): I don't feel the absence of a debugger because I've learnt enough 
 that I don't ever need a debugger. I am very intrigued by that statement. 
 What does he (or you, if you are reading, Stuart) mean? For me, debugging 
 is the biggest thing that I don't know how to do well currently in Clojure 
 (I use Vim, and have not programmed in Clojure for a while), so I am really 
 interested in what he meant.

 And by the way: As I said, I have not been using Clojure for a few months, 
 but: What's the state of the art of debugging for Vim users? I've been 
 meaning to try out vim-fireplace and ritz and see if they work together 
 well, but have not gotten around to it yet. I would very much appreciate a 
 nudge in the right direction.


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: vim-redl -- advanced fuzzy omnicompletion and VimClojure-style repl with enhanced debugging features

2013-04-04 Thread dgrnbrg
You there are plug mappings for all the repl actions:

Plugclj_repl_enter. -- key for enter press
Plugclj_repl_eval. -- key to for evaluation in the middle of the repl 
(i.e. not at the end of the form)
Plugclj_repl_hat. -- equivalent to ^
Plugclj_repl_Ins. -- equivalent to I
Plugclj_repl_uphist. -- history up
Plugclj_repl_downhist. -- history down

You can look at the repl.vim file to see how to make new mappings. I create 
the default repl mappings only if you haven't provided custom ones.

On Thursday, April 4, 2013 12:40:38 PM UTC-4, Max Gonzih wrote:

 So I got it working and it's pretty cool. But is there any options to 
 remap default keys (for example I'm using -_ instead of $^)?

 Thanks


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




How to import classes from a runtime-defined ClassLoader?

2013-02-27 Thread dgrnbrg
I am trying to include some Groovy code at runtime, which is already on the 
JVM's classloader path. I have succeeded in setting the 
groovy.lang.GroovyClassLoader with Clojure's classloader as the Thread's 
contextClassLoader, but I'm having troubling getting (import ...) to work. 
I discovered so far that (import ...) prefers to use the 
clojure.lang.Compiler/LOADER if it's defined (and it is, in my project), so 
I tried the following:

(try
  (push-thread-bindings {clojure.lang.Compiler/LOADER 
(groovy.lang.GroovyClassLoader.)}
  ;GroovyCL defaults to use contextClassLoader as parent, which is the 
Clojure ClassLoader
  (import 'my_groovy_class)
  (finally (pop-thread-bindings)))

Note that I can successfully do (.. Thread currentThread 
getContextClassLoader (loadCLass my_groovy_class)) once I've set the 
contextClassLoader.

What is the way to get (import ...) working so that I can manipulate 
my_groovy_class without resorting to forName/createInstance?

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: `let` to automatically add metadata / fn names?

2013-02-11 Thread dgrnbrg
vary-meta slipped my mind! I've updated the gist to include it. The reason 
I check for IObj and IMeta is that I want symbols and other custom deftypes 
to recieve the metadata as well.

I thought about namespacing the let-names, but for my current purposes I 
don't need that extra data (although I can imagine when it would be useful, 
and a complete implementation should store the namespace, the line number, 
and maybe further info).

I am using this in my project Piplin, a DSL for programming FPGAs in 
Clojure. I'll be talking about Piplin and some of the embedding tricks I 
use at Clojure/West. This let' macro gives me a higher-fidelity way to 
translate Clojure source to Verilog source purely at runtime, which is a 
different approach from other Clojure cross-compilers.

On Sunday, February 10, 2013 7:40:51 PM UTC-5, vemv wrote:

 Glad to hear that Phil! You're entirely right - I didn't realise that 
 distributing jar to Java consumers doesn't imply AOT-compiling the 
 libraries at all.

 David, on your implementation - I may be missing something, but why not 
 just vary-meta each collection found in the bindings?

 Also, it might interest you performing the tagging tree-recursively (e.g. 
 in (let x [[][][]]) the four colls would get tagged), and with namespaced 
 names.

 More importantly, how are you using this? One thing I haven't thought 
 about yet is how to map the tags to stack traces.


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: `let` to automatically add metadata / fn names?

2013-02-10 Thread dgrnbrg
I've written an implementation of this 
here: https://gist.github.com/dgrnbrg/4751473

It does incur a 2 instance check penalty (the branches should be 100% 
predictable, and never hurt in practice). I'm not sure if I could use 
protocols to further reduce the cost of the check.

I've already put this into the util.clj in my project that needs this most, 
to good effect.

David

On Friday, February 8, 2013 12:18:54 PM UTC-5, vemv wrote:

 Given that: a) fns can have names for debugging purposes, and b) data 
 structures can have metadata, wouldn't it be a good idea to let let auto 
 attach (where possible) the names of the bindings to their corresponding 
 values?

 For example, the improved let I'm thinking of would translate this input:

 (ns my.namespace)

 (defn do-it
   (let [foo (fn [] (throw (Exception.)))
 bar {:hello (/ 0 0)}]))

 to:

 (ns my.namespace)

 (defn do-it
   (let [foo (fn foo [] (throw (Exception.)))
 bar ^{:origin :my.namespace/do-it$let$bar} {:hello (/ 0 0)}]))

 This could be used to increase the precision of the stack traces, or in 
 IDEs/editors for locating the exact source of an exception.

 Do you see such a mechanism being incorporated to clojure.core/let - 
 should I open a ticket?


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: `let` to automatically add metadata / fn names?

2013-02-08 Thread dgrnbrg
I would find this very useful in several projects I'm working on, where the 
library would be able to give better information on where the error is in 
the user's code if this metadata was available.

On Friday, February 8, 2013 12:18:54 PM UTC-5, vemv wrote:

 Given that: a) fns can have names for debugging purposes, and b) data 
 structures can have metadata, wouldn't it be a good idea to let let auto 
 attach (where possible) the names of the bindings to their corresponding 
 values?

 For example, the improved let I'm thinking of would translate this input:

 (ns my.namespace)

 (defn do-it
   (let [foo (fn [] (throw (Exception.)))
 bar {:hello (/ 0 0)}]))

 to:

 (ns my.namespace)

 (defn do-it
   (let [foo (fn foo [] (throw (Exception.)))
 bar ^{:origin :my.namespace/do-it$let$bar} {:hello (/ 0 0)}]))

 This could be used to increase the precision of the stack traces, or in 
 IDEs/editors for locating the exact source of an exception.

 Do you see such a mechanism being incorporated to clojure.core/let - 
 should I open a ticket?


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: SIGBUS : A fatal error has been detected by the Java Runtime Environment

2013-01-28 Thread dgrnbrg
I've encountered errors like this when running where .jar files for the 
project were being loaded from an NFS share. Do you have that in your 
environment? The solution is to load the .jars from a local directory 
instead.

On Monday, January 28, 2013 12:59:12 PM UTC-5, larry google groups wrote:


 I have a small clojure app (maybe 700 lines of code). I start it at the 
 terminal and it runs for 10 minutes or so. Then, sometimes, it produces 
 this error:


 # A fatal error has been detected by the Java Runtime Environment:
 #
 #  SIGBUS (0xa) at pc=0x00010e34815e, pid=45108, tid=22787
 #
 # JRE version: 7.0_10-b18
 # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode 
 bsd-amd64 compressed oops)
 # Problematic frame:
 # C  [libzip.dylib+0x315e]  newEntry+0x154
 #
 # Failed to write core dump. Core dumps have been disabled. To enable core 
 dumping, try ulimit -c unlimited before st\
 arting Java again
 #
 # An error report file with more information is saved as:
 # 
 /Users/lkrubner/projects/discovery-times-square/kiosks-clojure/target/hs_err_pid45108.log
 #
 # If you would like to submit a bug report, please visit:
 #   http://bugreport.sun.com/bugreport/crash.jsp
 # The crash happened outside the Java Virtual Machine in native code.
 # See problematic frame for where to report the bug.
 #
 Abort trap: 6


 Then it dies. 

 What does this mean?





-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What would you use a #[] data literal for?

2012-12-30 Thread dgrnbrg
You can also patch the LispReader in jvm Clojure without dropping to Java. 
Here's an example of that to add a #b reader 
literal: 
https://github.com/dgrnbrg/piplin/blob/master/src/piplin/types/bits.clj#L216

On Sunday, December 30, 2012 7:38:44 AM UTC-6, Ambrose Bonnaire-Sergeant 
wrote:

 Jozef,

 How do you achieve that?

 Thanks,
 Ambrose

 On Sun, Dec 30, 2012 at 7:45 PM, Jozef Wagner 
 jozef@gmail.comjavascript:
  wrote:

 I use it in Clojurescript for a custom tuple type. 

 For small number of items, deftypes are way faster to create and access 
 than PersistentVectors. I use tuple type e.g. for returning multiple values 
 from a function. Implementing #[] allowed me to have a compact syntax for 
 creating and destructuring such tuples.

 (defn foo [a b] 
   #[(+ a b) (- a b) (* a b)])

 (defn foo []
   (let [#[plus minus times] (foo 1 2)]
 (str bla bla plus blaah minus)))

 JW

 On Friday, December 28, 2012 11:15:52 PM UTC+1, vemv wrote:

 I was just wondering - given that we have the #() and #{} literals, why 
 not a #[] as well? Queues look like a good fit.

  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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 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

Re: Need ideas for carving project into namespaces

2012-12-13 Thread dgrnbrg
I've written a large application that uses this approach. You can see it 
applied with protocols and multimethods in types.clj and protocols.clj, and 
the remainder of the code in types/*.clj. I used this to manage over 10 
different extensions, and it's been simple enough to keep organized.

I have used a few techniques to tie together all the disparate files. I 
have an approach for vars/fn from other namespaces, even if they're 
dynamic, and organization/readability in the face of a large API.

You can find that 
here: https://github.com/dgrnbrg/piplin/tree/master/src/piplin

On Thursday, December 13, 2012 4:43:48 PM UTC-5, puzzler wrote:

 On Thu, Dec 13, 2012 at 1:31 PM, Timo Mihaljov 
 ti...@mihaljov.infojavascript:
  wrote:

 (ns example.patron
   The patron doesn't have an artistic vision (that's the artist's job),
 nor does it know how to talk to a graphics API (that's what the canvases
 are for). What it *does* know is how many triangles and squares we can
 afford, and where we want them drawn.
   (:require [example.artist :refer [create-masterpiece]
  example.canvas :refer [make-canvas]]))

 (defn commision-a-masterpiece []
   (create-masterpiece (make-canvas) 500 1000))


 I like this idea of using multimethods to send information from the 
 concrete implementations back to the constructor in the core.

 But how do the concrete implementations ever get loaded?

 For example, if you start an empty repl and send the example.patron file 
 to the repl, none of the concrete implementations will get loaded, so 
 make-canvas will fail.  Same thing if, for example, you made 
 commission-a-masterpiece into the main function and compiled the whole 
 thing into an executable jar.

 How do you get around this?


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

Re: ANN: Guzheng 1.2.5

2012-10-26 Thread dgrnbrg
Tassilo:
I've incorporated this fix and rereleased as [lein-guzheng 1.4.4] (which 
will automatically pull in the latest guzheng).

Ambrose:
Guzheng works by instrumenting all code just before it's eval'ed, using 
Zach Tellman's sleight library, which is essentially a way to do whole 
program macros. It uses functional programs and logic programs to rewrite 
most conditionals to include instrumentation about whether they were 
executed. When the JVM exits, a hook runs that reports all the un-taken 
branches to stdout. I've pasted some sample output below:

#lein guzheng \* -- test
in ns foo.core: arity [a x] is not covered in defn goodbye3 on line 21
in ns foo.core: false branch is not covered in if on line 31
in ns foo.core: :else is not covered in cond on line 50

The statements point out which branch on which line wasn't executed, to 
help you improve test coverage in areas of complex code that you're not 
sure is being testing sufficiently thoroughly. I use guzheng to gain 
confidence in complex fundamental libraries and algorithms that have many, 
many branches, to convince myself that I've sufficiently tested my code.

Thanks,
David

On Friday, October 26, 2012 4:53:42 AM UTC-4, Tassilo Horn wrote:

 David Greenberg dsg123...@gmail.com javascript: writes: 

 Hi David, 

  Guzheng is a library for doing branch coverage analysis on Clojure 
  projects at the command line. 

 Hey, that's pretty cool.  But it errors when being applied to my 
 project.  I've found the bug in guzheng and already sent you a pull 
 request. 

 Bye, 
 Tassilo 


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

Re: Using gen-class to generate methods with same names and arities but different type signatures

2012-08-03 Thread dgrnbrg
I ended up digging deep through gen-class, and I learned about an 
interesting, undocumented feature that solves this problem:

You can, in fact, overload methods of the same arity on type, and here's 
how:

Each method you define in gen-class tries to lookup a corresponding var in 
the impl-ns of the form {impl-ns}/{prefix}{method-name}

However, if the method is overloaded on type, gen-class first looks up a 
var of the form {impl-ns}/{prefix}{method-name}{typesig}, and only if that 
fails does it use the default var.

typesig is constructed in the following way:

(str (interleave (repeat \-) (map typesig-name types))

where types is the vector of types passed to the method declaration.

Finally, here's a way to define typesig-name (and I'm assuming all 
arguments are Classes)

(defn typesig-name [c]
  (cond (.isArray c) (str (typesig-name (.getComponentType c)) )
   (.isPrimitive c) (comment this should give int, float, 
double, long, etc)
   (.getSimpleName c)))

If you provide vars with those names, you can overload by arity.

To recap, these are the quirks:
1) If you don't overload a method, you must provide the implementation in 
the var of the same name.
2) If you do overload the arity, you can optionally provide the 
implementation in the specially named vars, but if they don't exist, 
they'll fall back to vars of the same name.
3) The overload vars have dash-separated type signatures included in their 
name, where primitives are written like in java, arrays end in , and 
you only include the simple name of the classes.

Whew...

p.s. unfortunately, clojure still boxes the arguments into these function 
no matter what. So this is a dispatch optimization, not a boxing 
optimization (or, in my case, allows me to generate the correct interop 
forms).


On Friday, August 3, 2012 10:11:06 AM UTC-4, Daniel Solano Gómez wrote:

 On Thu Aug  2 16:41 2012, David Greenberg wrote: 
  Hi Clojurians, 
  I'm finding myself far down the rabbit hole of gen-class. I am trying 
  to generate a class that has a bunch of static methods, and each of 
  those methods has many overloads of arities and types. Unfortunately, 
  there is no interface--this class gets called through reflection in a 
  legacy system. 
  
  The class's parameter types include primitives, primitive arrays, and 
 Objects. 
  
  I am doing something like: 
  
  (gen-class 
:name my.odd.Class 
:main false 
:methods [^{:static true} [-myfunc [[Lint; String] void] 
   ^{:static true} [-myfunc [[Ldouble; int] Object]]) 
  
  I found a post explaining that I could define method implementations 
  with overloads by doing -methodName-arg1type-arg2type-arg3type, but 
  when I try that I get an exception that the FileName is too long from 
  the clojure compiler. 
  
  I can easily generate a map from signatures to implementations, but I 
  need to generate the class with all the overloads. 
  
  Is there any way to do this? Should I resign myself to writing out a 
  .java file, and compiling that? 


 Hello, David, 

 Well, gen-class certainly supports creating static methods with type 
 hints and overloaded arities.  An example using gen-class as part of ns: 

 (ns gen-class-test.StaticTest 
   (:gen-class :methods [^:static [foo [ints int] String] 
 ^:static [foo [longs long] String] 
 ^:static [foo [chars char] String] 
 ^:static [foo [shorts short] String] 
 ^:static [foo [booleans boolean] String] 
 ^:static [foo [floats float] String] 
 ^:static [foo [doubles double] String] 
 ^:static [foo [[Ljava.lang.Object; Object] 
 String] 
 ^:static [foo [[Ljava.lang.String; String] 
 String] 
 ^:static [foo [[Ljava.lang.String; int] String] 
 ^:static [foo [boolean] String] 
 ^:static [foo [char] String] 
 ^:static [foo [short] String] 
 ^:static [foo [int] String] 
 ^:static [foo [long] String] 
 ^:static [foo [float] String] 
 ^:static [foo [double] String] 
 ^:static [foo [Object] String] 
 ^:static [foo [String] String]] 
   :main false)) 

 This will generate a class with the following signature: 

 public class gen_class_test.StaticTest extends java.lang.Object{ 
 public static {}; 
 public gen_class_test.StaticTest(); 
 public java.lang.Object clone(); 
 public int hashCode(); 
 public java.lang.String toString(); 
 public boolean equals(java.lang.Object); 
 public static java.lang.String foo(int[], int); 
 public static java.lang.String foo(long[], long); 
 public static java.lang.String foo(char[], char); 
 public static 

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread dgrnbrg
I don't think that the type hint will appear in the printed output. It is 
metadata, so it won't be shown by the printer. If you try (let [[_ _ [b] 
(macroexpand-1 '(aTest))] (meta b)) you should see {:tag long}.

On Wednesday, July 18, 2012 7:55:31 AM UTC-4, john wrote:

 Hello,
 how do I get primitive typ hints to appear in the output of a macro?
  
 like :
 (defmacro aTest []
   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))

 (macroexpand-1 '(aTest))
 yields :

 (aFun 7)
 (macroexpand-1 '(aTest))
 yields :
  
 (defn aFun [b] (clojure.core/meta b))
  
 but I wold like it to be :
 (defn aFun [^long b] (clojure.core/meta b))
  
 Many greetings
 John

  


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

Re: docstrings of if-let and when-let incorrect

2012-05-16 Thread dgrnbrg
I too assumed that if/when-let would support multiple bindings, short-
circuiting if one failed, when I started learning Clojure. It seems
that short-circuiting multiple bindings isn't surprising.

On May 16, 10:56 am, Jay Fields j...@jayfields.com wrote:
 I've also attempted to use if/when-let with multiple bindings in the past.
 I assumed that it would behave as 'AND' and that no bindings would be
 available in 'else'

 Cheers, Jay







 On Wed, May 16, 2012 at 10:29 AM, Dan Cross cro...@gmail.com wrote:
  On Wed, May 16, 2012 at 9:16 AM, Aaron Cohen aa...@assonance.org wrote:
   On Wed, May 16, 2012 at 9:10 AM, Walter Tetzner 
  robot.ninja.saus...@gmail.com wrote:
   To make the bindings work like let, where later bindings can see
  previous
   bindings, I think the most natural way to do it is to have the bindings
   behave like the maybe monad.
   [...]

   Saying something is obvious and then using the word monad a paragraph
  later
   is contradictory. ;)

  Hypothetically, this is obvious, unlike most monads.  Zing!

   What should happen on the else branch of the if-let; which bindings are
  in
   scope and what would be their values?

  None of the bindings should be in scope.

         - Dan C.

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


Re: IllegalStateException in ns macro

2012-05-07 Thread dgrnbrg
The :refer-clojure clause has fixed my problem; however, I have 22+
symbols that I need to exclude in every namespace. Is there a way that
I can ease this exclusion, as this code is a library that I'll be
including in numerous files (and I'd like to have a form to simplify
using it).

I am not sure if this is something that I could do with a custom
leiningen plugin that rewrites all the ns macros before evaluating the
file, or if I can do something else a bit less extreme.

Thanks!
David

On May 7, 10:28 am, Meikel Brandmeyer (kotarak) m...@kotka.de
wrote:
 Hi again,

 Am Montag, 7. Mai 2012 16:26:48 UTC+2 schrieb Meikel Brandmeyer (kotarak):

  (ns piplin.test.math
    (:refer-clojure :exclude [not=])
    (:use ...)
    (:import ...))

 You should do the same in piplin.math, btw.

 Kind regards
 Meikel

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


Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-24 Thread dgrnbrg
I've worked with Tamas, and the VimClojure compatibility support is
now merged into the BitBucket repos, and Tamas' updated version is
merged with my GitHub repo.

On Apr 23, 12:34 am, Dave Ray dave...@gmail.com wrote:
 Note that Tomas recently extracted paredit from slimv, so it has its
 own home now:https://bitbucket.org/kovisoft/paredit
 Also, there have been several important bug fixes applied to paredit
 in the last few months. It would be great if any improvements you've
 made could make it back into the official version.

 Dave







 On Sun, Apr 22, 2012 at 10:24 PM, dgrnbrg dsg123456...@gmail.com wrote:
  I am having trouble porting my simple VimClojure support with the
  version 0.9.6 of the script. The integration w/ slimv's REPL appears
  to have increased. I'm not sure what the best course of action is,
  since I don't really want to continue trying to merge the codebases,
  and instead just fix any bugs in my implementation. There aren't any
  other new features to gain, otherwise.

  On Apr 22, 7:47 pm, John Szakmeister j...@szakmeister.net wrote:
  On Sun, Apr 22, 2012 at 3:28 PM, Evan Mezeske emeze...@gmail.com wrote:
   Version 0.9.3 does indeed support balanced map literals.

   I believe that the bitbucket repository is the official home of slimv 
   (from
   which paredit.vim comes): https://bitbucket.org/kovisoft/slimv/ .

  Just an FYI, but there seems to be version 0.9.6 here:
     http://www.vim.org/scripts/script.php?script_id=3998

  -John

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


Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread dgrnbrg
I didn't know that support had been added to paredit mode! When I
googled for better Clojure support, I didn't see that one.

The differences between Kovac's Nov 2011 version and mine is only that
mine applies the mode to VimClojure REPL buffers. I haven't checked to
see whether he treats {} the same as () and [] (ensuring they're
balanced, and having them work with localleader-[OJ]).

Is there a Kovac's version on Github? I can only find it on BitBucket.
If you send me a link to one on GitHub, I'll open a pull request with
the VimClojure REPL support.

On Apr 20, 4:44 am, Evan Mezeske emeze...@gmail.com wrote:
 Could you elaborate on what the differences are between your version
 (Greenberg) of paredit-vim and the original one written by Tamas Kovacs
 that it appears to be based on?

 I'm a bit confused -- the latest Kovacs version that I've used is 0.9.3
 from November 2011.  The Greenberg version looks like it is based off a
 version that was forked off from Kovacs vesrion version 0.8.0 from April
 2011.

 Have any of the differences between 0.8.0-0.9.3 been merged into this
 branch?







 On Wednesday, April 18, 2012 9:41:05 PM UTC-7, dgrnbrg wrote:

  Paredit mode is a structural editor for Clojure code in Vim. It allows
  you to edit your code while keeping parenthesis matched, and providing
  shortcuts to manipulate (), {}, [], and  easily. Use :help paredit
  for details.

  I just implemented support for VimClojure repls and {} syntax. Please
  report any bugs to me. Don't forget to use Pathogen!

 https://github.com/dgrnbrg/paredit-vim

 https://github.com/tpope/vim-pathogen

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


Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread dgrnbrg
I am having trouble porting my simple VimClojure support with the
version 0.9.6 of the script. The integration w/ slimv's REPL appears
to have increased. I'm not sure what the best course of action is,
since I don't really want to continue trying to merge the codebases,
and instead just fix any bugs in my implementation. There aren't any
other new features to gain, otherwise.

On Apr 22, 7:47 pm, John Szakmeister j...@szakmeister.net wrote:
 On Sun, Apr 22, 2012 at 3:28 PM, Evan Mezeske emeze...@gmail.com wrote:
  Version 0.9.3 does indeed support balanced map literals.

  I believe that the bitbucket repository is the official home of slimv (from
  which paredit.vim comes): https://bitbucket.org/kovisoft/slimv/ .

 Just an FYI, but there seems to be version 0.9.6 here:
    http://www.vim.org/scripts/script.php?script_id=3998

 -John

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


Re: Persistent collections and garbage collection

2012-02-09 Thread dgrnbrg
It seems to me that a generational collector would have problems
collecting Clojure's garbage production pattern. Luckily, the oracle/
hotspot jvm has a continuous collecting compacting GC called G1. That
should mitigate oldspace collection latency spikes. Enable with -XX:
+UnlockExperimentalVMOptions -XX:+UseG1GC

On Feb 7, 11:16 am, pron ron.press...@gmail.com wrote:
 Hi. I have a question:
 I love Clojure's persistent collections, but don't they generate many
 long-lived objects (that go to the surving generations) that are hard to
 garbage-collect? After all, the discarded nodes after modification are
 not necessarily short lived. It seems like they would behave badly from the
 GC perspective. Am I wrong?

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