Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread Ben Mabey
On Thu Nov 21 07:14:16 2013, Stuart Sierra wrote: On Thursday, November 21, 2013 7:22:10 AM UTC-5, abp wrote: Why do you prefer declaring dependencies between components of a system explicitly instead of using prismatics Graph? 'Graph' by itself does not preserve the dependency relationships

Re: core.async and performance

2013-11-29 Thread Ben Mabey
On Fri Nov 29 14:13:16 2013, kandre wrote: Thanks for all the replies. I accidentally left out the close! When I contrived the example. I am using core.async for a discrete event simulation system. There are hundreds of go blocks all doing little but putting a sequence of events onto a

Re: core.async and performance

2013-11-29 Thread Ben Mabey
steps whereas the simpy version takes less than 1s for 10^6 iterations on my vm. Cheers Andreas On Saturday, 30 November 2013 09:22:22 UTC+10:30, Ben Mabey wrote: On Fri Nov 29 14:13:16 2013, kandre wrote: Thanks for all the replies. I accidentally left out

Re: core.async and performance

2013-11-29 Thread Ben Mabey
in favor of go blocks for coordination...) On Fri, Nov 29, 2013 at 10:13 PM, Ben Mabey b...@benmabey.com mailto:b...@benmabey.com wrote: On Fri Nov 29 17:04:59 2013, kandre wrote: Here is the gist: https://gist.github.com/anonymous/7713596 Please not that there's no ordering

Re: core.async and performance

2013-11-29 Thread Ben Mabey
On 11/29/13, 9:16 PM, Cedric Greevey wrote: On Fri, Nov 29, 2013 at 11:03 PM, Ben Mabey b...@benmabey.com mailto:b...@benmabey.com wrote: On 11/29/13, 8:33 PM, Cedric Greevey wrote: Have you checked for other sources of performance hits? Boxing, var lookups, and especially

Re: core.async and performance

2013-11-29 Thread Ben Mabey
On Fri Nov 29 22:30:45 2013, kandre wrote: Maybe I'll just use my simpy models for now and wait for clj-sim ;) Any chance of sharing? Cheers Andreas On Saturday, 30 November 2013 15:40:10 UTC+10:30, Ben Mabey wrote: On 11/29/13, 9:16 PM, Cedric Greevey wrote: On Fri, Nov 29, 2013

Re: Enforcing constructor types on defrecord

2013-11-30 Thread Ben Mabey
On Sat Nov 30 07:41:52 2013, Josh Kamau wrote: Hi there ; Is there a way of enforcing constructor types when using defrecord? Josh -- -- 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

Re: Enforcing constructor types on defrecord

2013-11-30 Thread Ben Mabey
On Sat Nov 30 08:03:18 2013, Ben Mabey wrote: On Sat Nov 30 07:41:52 2013, Josh Kamau wrote: Hi there ; Is there a way of enforcing constructor types when using defrecord? Josh -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Comparing core.async and Reactive Extensions

2013-12-17 Thread Ben Mabey
On 12/17/13, 6:33 AM, Timothy Baldridge wrote: I won't go so far as to tell you which is better as that often comes down to a matter of taste. However, I will explain the technical differences. In this case I'll use my (somewhat limited) knowledge of C# Rx. Scala/Java's Rx may be different.

Re: go kill infinite loop

2014-01-13 Thread Ben Mabey
On Mon Jan 13 18:11:10 2014, t x wrote: Consider the following code block: (defn make-stupid [] (go (loop [] (recur (def x (make-stupid)) ;; ... is there a way to kill this infinite go-loop ? No, you can not kill the loop with the go channel that is bound to x. You need to

Re: diagram of clojure interfaces and objects

2014-02-05 Thread Ben Mabey
On Wed Feb 5 13:16:01 2014, Andy Smith wrote: Hi, Does anyone know of a class diagram of all the java interfaces and classes that exist in clojure, including their inheritance relationships. Im trying to get a handle on all the many collection/sequence interfaces, but ideally I would like to

Re: Clojure performance question

2014-03-03 Thread Ben Mabey
On 3/2/14, 7:06 PM, Mikera wrote: Some perspectives (as someone who has been tuning this stuff a lot, from a core.matrix standpoint in particular) On Saturday, 1 March 2014 13:02:26 UTC+8, bob wrote: Hi, Can I ask a newbie question about clojure performance? What make clojure

Re: Om-powered HTML slide-decks

2014-03-09 Thread Ben Mabey
On 3/9/14, 3:45 AM, Malcolm Sparks wrote: There are some HTML-based tools out there (reveal.js, slidy, impress.js, deck.js ...) for building slide-based presentations for conference talks. But you usually have to write your slides in raw HTML. This feels cumbersome when you're used to

Re: core.async is very slow for some cases, what to do?

2014-03-11 Thread Ben Mabey
I've also ran into situations as well where the context switching of the thread pool is prohibitive. I swapped out the thread pool with a single threaded executor and saw a big speed improvement. The downside is that you can not specify what thread pool a go block should be ran on. This

Re: local mutable state

2014-03-21 Thread Ben Mabey
On 3/21/14, 5:44 AM, Andy Smith wrote: Im also interested as to why the mutable state approach would be less performant? In the single thread case the locks would be optimized out right? No locks are used when using atoms, only compare-and-swap (CAS) operations. While CAS operations are fast

Re: Concurrently updating two structures

2014-03-21 Thread Ben Mabey
For coordination of this type you could either a) use refs and the STM or b) put them in the same nested datastructure and put them both in an atom. The latter approach is what I would recommend and what people generally tend to do. If you go down this route you end up with the entire state

Re: core.async threadpool size

2014-03-27 Thread Ben Mabey
I asked Timothy Baldridge about this on IRC when the change was made that added 42 and this was the reply I got: we're trying to strike a balance there, we don't want people to do IO inside a go block, but if they have to we'd don't want it to totally stall out. Here is the full

Re: core.async threadpool size

2014-03-27 Thread Ben Mabey
executor? Luca Il giorno giovedì 27 marzo 2014 16:01:16 UTC+1, Ben Mabey ha scritto: I asked Timothy Baldridge about this on IRC when the change was made that added 42 and this was the reply I got: we're trying to strike a balance there, we don't want people to do IO inside

Re: Questions regarding Map vs Record and usage

2014-04-09 Thread Ben Mabey
On 4/9/14, 12:51 PM, Anthony Ortiz wrote: I see that there are several ways of instantiating a record : (-Book Lord of the Rings, Tolkien) (Book. Lord of the Rings, Tolkien) #user.Book{:title Lord of the Rings, :author Tolkien} You missed one: (map-Book {:title Lord of the Rings, :author

Re: Clojure Cheat Sheet

2009-10-19 Thread Ben Mabey
Gorsal wrote: All right, so this is probably way off topic, but what software was used to create the clojure cheat sheet? http://clojure.org/cheatsheet I really like the format and would like to make one for my own utilities so that I can actually remember what general utility functions i

Re: Coercing a map to a record

2010-05-22 Thread Ben Mabey
James Reeves wrote: Hi folks, I've been experimenting with the new type system in Clojure 1.2, but I've hit something of a problem. If I define a record: user= (defrecord Foo []) user.Foo Then I can coerce a map into a type Foo like so: user= (def m {:x 1, :y 2}) #'/user/m user= (Foo. {} m)

Re: Clojure Performance For Expensive Algorithms

2013-02-24 Thread Ben Mabey
On 2/24/13 1:34 PM, Marko Topolnik wrote: I'm no Haskell expert, but it doesn't take much Googling to give strong evidence that the answer is yes, you can get mutability in Haskell. Search through this Haskell program on the Benchmarks Game site for occurrences of the string

Re: Clojure Performance For Expensive Algorithms

2013-02-26 Thread Ben Mabey
:33 PM UTC+1, Ben Mabey wrote: Yeah, I wish the Benchmarks allowed for idiomatic submissions and finely tuned submissions. That would allow you to get some sort of an idea how performant the dominant idiom is. Along those lines this older post did an interesting analysis

Re: Clojure Performance For Expensive Algorithms

2013-02-27 Thread Ben Mabey
On 2/27/13 9:59 AM, Isaac Gouy wrote: On Wednesday, February 27, 2013 1:13:10 AM UTC-8, Marko Topolnik wrote: On Wednesday, February 27, 2013 5:19:20 AM UTC+1, Isaac Gouy wrote: If idiomatic Clojure was used... The problem, of course, is that: the code one-person

Re: Clojure/West 2013 videos?

2013-03-21 Thread Ben Mabey
On 3/21/13 10:08 AM, John Gabriele wrote: Are there any videos available of the talks recently given at Clojure/West? Is there a central location where these will most likely be found at some point? Alex can confirm this but my guess is that they will be released on infoq slowly over time.

Re: [ANN] Himilsbach 0.0.1 is released

2013-05-05 Thread Ben Mabey
On Sun May 5 18:31:59 2013, Mikera wrote: On Tuesday, 30 April 2013 04:12:14 UTC+8, Jan Stępień wrote: Dear Clojurians, I'm very happy to announce Himilsbach 0.0.1. Himilsbach is a tiny actor library for intra-process messaging inspired by Erlang. Find it at

Re: Not using dependency injection - how do I share services around?

2013-05-10 Thread Ben Mabey
Hi Colin, On 5/10/13 5:04 AM, Colin Yates wrote: 1) to use (defonce *data-source*...) so that every body who requires that ns gets the same instance? While this has been done I view this as an antipattern. The big problem with this approach is that you now can only have a single

Re: Parallel code execution in ClojureScript?

2013-05-10 Thread Ben Mabey
On 5/7/13 3:39 PM, Ghassan Ayesh wrote: Hi: In Javascript language, and while the language is inherently functional, Javascript's *implementation* until now, does not support parallel code execution against available CPU cores, unlike Erlang for example or Clojure on JVM, so I am thinking

Re: Understanding boxing

2013-05-13 Thread Ben Mabey
On Mon May 13 13:36:53 2013, Mark Engelberg wrote: What tools exist in Clojure for understanding whether a given variable is boxed or primitive? To get a better handle on boxing, I started playing around with things like: (def x 1) (def ^int x 1) (def x (int 1)) I want to know how Clojure is

status of clj-nstools or similar tools?

2013-05-16 Thread Ben Mabey
Hi all, I like the idea of clj-nstools[1] in certain settings but I have never tried it in a project. (I like how it doesn't do any var copying like defalias and similar solutions do.) Has anyone used it on past projects that would be willing to give some experience reports (maybe Konrad

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 Ben Mabey
On 5/28/13 10:37 AM, Cedric Greevey wrote: Huh. I just solved it. The debug exception handler has to do something a bit fancier, that's all: 1. Dig up the bytecode of the method executing the throw and copy it somewhere. 2. Unwind by one call. 3. Take the bytecode in 1, alter it to wrap the

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 Ben Mabey
On 5/28/13 12:19 PM, Lee Spector wrote: On May 28, 2013, at 2:16 PM, Ben Mabey wrote: You can disable locals clearing with a compiler flag. nrepl-ritz even has helper function that will compile the given form using that flag. If you want to disable locals clearing on a project wide basis

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 Ben Mabey
On 5/28/13 1:05 PM, Lee Spector wrote: On May 28, 2013, at 2:40 PM, Ben Mabey wrote: The flag is a system property: -Dclojure.compiler.disable-locals-clearing=true. So you can add that string to your project.clj's :jvm-opts if you are using lein. This will, of course, slow down your program

Re: [GSoC] core.matrix NDArray project feature requests

2013-05-28 Thread Ben Mabey
On Tue May 28 02:40:33 2013, Dmitry Groshev wrote: Sorry, I wasn't clear enough in my proposal. I've mentioned clojurecheck [1] in it and the possibility of extending it, because in my Erlang experience property-based testing is extremely helpful for things that operates on something pure in

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-29 Thread Ben Mabey
On Wed May 29 09:18:10 2013, Softaddicts wrote: The REPL is a better alternative than a debugger. No REPL available = increase need for a debugger. If you write creepy code in the REPL, you would do the same in a text editor and then end up debugging it in the debugger... with the old

Re: Making things go faster

2013-06-05 Thread Ben Mabey
On 6/4/13 10:16 PM, Kevin Downey wrote: midje makes each test a top level form, so test runs happen as a side effect of code loading, which means you cannot really run tests in a good way from the repl without doing some kind of ridiculous forced code reloading. I would definitely recommend

Re: Reworking :pre condition to add an error message

2011-07-11 Thread Ben Mabey
On 7/11/11 11:40 AM, Timothy Washington wrote: Note: This message was originally posted by ' Shantanu' on the */Re: Clojure for large programs/* thread. I took a look at Shantanu's macros, and I like the concept a lot. But I would prefer something baked into the :pre condition itself. The

Re: Additional delay after pcalls?

2011-07-27 Thread Ben Mabey
On 7/27/11 11:19 AM, Ken Wesson wrote: On Wed, Jul 27, 2011 at 11:44 AM, mc4924claudio.potenza...@gmail.com wrote: Hello everyone, I am a beginner with clojure and I am playing around with pcalls (I am using clojure 1.2.1). I see different behavior if I run some code from inside the REPL or

Re: Currently recommended CSV client, again ?

2011-10-04 Thread Ben Mabey
I needed a CSV recently and I wanted one that converted the rows to maps (using the headers) and supported converters. I found one[1] that did most of what I wanted and extended it a bit. The tests provide a good overview of the API:

adding metadata to java objects

2011-11-16 Thread Ben Mabey
Hi, I would like to be able to add metadata to arbitrary java objects that have already been instantiated. I know that you can use proxy to add metadata to objects that you create but in my case the object already exists (i.e. it is returned from another method call outside of my control).

Re: adding metadata to java objects

2011-11-17 Thread Ben Mabey
the original constructor never is called. The instantiated object is simply passed from one delegate to another with the different metadata associated on to it. -Ben On Nov 16, 2011, at 11:28 AM, Ben Mabey wrote: Hi, I would like to be able to add metadata to arbitrary java objects that have

Re: Proposal: libraries should have type hints

2011-11-22 Thread Ben Mabey
On 11/21/11 7:50 AM, Ralph wrote: I want to propose that Clojure libraries should be fully type-hinted -- that is, they should be compiled with the *warn-on-reflection* option turned on and type hints place wherever possible. I understand the argument against type-hinting end-user code until a

Re: Struct vs. Record: Now and Future

2011-01-27 Thread Ben Mabey
On 1/27/11 7:24 PM, Ken Wesson wrote: On Thu, Jan 27, 2011 at 6:24 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Records don't have serialization yet, do they? user= (defrecord Foo [n]) user.Foo user= ((supers Foo) java.io.Serializable) java.io.Serializable Looks like they do. I've

Re: Struct vs. Record: Now and Future

2011-01-27 Thread Ben Mabey
On 1/27/11 8:41 PM, Ben Mabey wrote: On 1/27/11 7:24 PM, Ken Wesson wrote: On Thu, Jan 27, 2011 at 6:24 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Records don't have serialization yet, do they? user= (defrecord Foo [n]) user.Foo user= ((supers Foo) java.io.Serializable

Re: Shebang support for cljr

2011-04-20 Thread Ben Mabey
Thanks for sharing Jark, I hadn't seen it. Cake[1] also has this functionality so you can use the following shebang line: |#!/usr/bin/env cake | Like Jark, Cake manages the persistent JVMs for you. I don't know enough about either project to know what the key differences between the two

Re: what is an xrel?

2012-07-20 Thread Ben Mabey
Hi David! My guess is as good as yours but I think rel is short for relation (as in a relation in relational algebra). The x might as well be a, b, or any other short variable name. In clojure-docs it looks like the examples for #'join use first-relation and second-relation instead of xrel

Re: community interest in machine learning (?)

2012-07-20 Thread Ben Mabey
On 7/20/12 10:34 AM, Joshua Bowles wrote: Check this out for weka: https://github.com/antoniogarrote/clj-ml FYI, that fork isn't maintained anymore. I've updated it quite a bit and fixed a lot of reflection issues that were making it unusable in production:

Re: Looking for an idiom regarding type hints

2012-07-21 Thread Ben Mabey
On 7/21/12 7:33 AM, ChrisR wrote: I am wondering if there is a simpler idiom to deal with functions on primitives that only differ by type hints (see example), this is the current idiom I am using which is starting to appear in my codebase, however I feel like whenever this much replication

Re: Any downside of record compared to map

2012-07-23 Thread Ben Mabey
On 7/22/12 5:42 PM, Warren Lynn wrote: I plan to change all my major data structures to records instead of plain maps. Since record has everything a map provides, I figure there won't be any harm. But is that really so? Would appreciate the opinions from people who know better. Another

Re: community interest in machine learning (?)

2012-07-28 Thread Ben Mabey
On 7/28/12 4:52 PM, Timothy Washington wrote: Hey Jim, Encog does look very interesting. Right now, I'm trying (and failing) to implement the sigmoid function. I'm using wikipedia's reference http://en.wikipedia.org/wiki/Sigmoid_function, and trying to use Incanter's (incanter/exp) function,

Re: What concurrency models to document?

2012-08-02 Thread Ben Mabey
On 8/2/12 10:04 AM, Brian Marick wrote: On Aug 2, 2012, at 8:50 AM, Meikel Brandmeyer (kotarak) wrote: You have to put quite a bit of thought in to get things right. Which raises the question: *is* concurrency actually a strong selling point for functional languages? Sane defaults are a

Re: Attractive examples of function-generating functions

2012-08-08 Thread Ben Mabey
On 8/8/12 10:48 AM, Brian Marick wrote: I'm looking for medium-scale examples of using function-generating functions. I'm doing it because examples like this: (def make-incrementer (fn [increment] (fn [x] (+ increment x ... or this: (def incish (partial map + [100 200

Re: Follow-up questions on Stuart's InfoQ interview

2012-08-17 Thread Ben Mabey
On 8/17/12 3:03 PM, Rich Morin wrote: I took a break from reading Programming Clojure, 2e to watch Stuart's InfoQ interview: Stuart Halloway on Datomic, Clojure, Reducershttp://www.infoq.com/interviews/halloway-datomic http://www.infoq.com/interviews/halloway-datomic I have a couple of

Re: A Performance Comparison of SBCL Clojure

2012-08-27 Thread Ben Mabey
Looking at clojure's benchmarks they seem to already be highly optimized (in terms of employing all the standard tricks). Does anyone have any idea if more could be done to lessen the gap between java and clojure[1]? Or are these benchmarks representative of the performance gap between

Re: A Performance Comparison of SBCL Clojure

2012-08-28 Thread Ben Mabey
PM, Ben Mabey wrote: Looking at clojure's benchmarks they seem to already be highly optimized (in terms of employing all the standard tricks). Does anyone have any idea if more could be done to lessen the gap between java and clojure[1]? Or are these benchmarks representative of the performance

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-12 Thread Ben Mabey
Thanks for the great example Gary! I've been meaning to try org-babel out for a while but never got around to it. I just tried your example and when I run org-babel-tangle the code blocks are not expanded into the source file, but rather the code block names are just inserted into the source

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-12 Thread Ben Mabey
On 9/12/12 9:29 PM, Ben Mabey wrote: Thanks for the great example Gary! I've been meaning to try org-babel out for a while but never got around to it. I just tried your example and when I run org-babel-tangle the code blocks are not expanded into the source file, but rather the code block

Re: clojure.lang.Keyword.hashCode is a hotspot in my app

2012-09-26 Thread Ben Mabey
On 9/25/12 11:37 PM, Ben Smith-Mannschott wrote: On Tue, Sep 25, 2012 at 1:53 AM, James Hess james.hes...@gmail.com wrote: Hi experienced clojure gurus, According to VisualVM 24% of my time is spent in clojure.lang.Keyword.hashCode. I'm sure I am doing something wrong (i.e. I'm not blaming

Re: ANN: a Clojure docs site, and github organization

2012-10-06 Thread Ben Mabey
On Oct 6, 2012, at 6:04 PM, Michael Klishin michael.s.klis...@gmail.com wrote: 2012/10/7 Softaddicts lprefonta...@softaddicts.ca The validity of a scanned signature or electronic keys is subject to interpretation and assessment on a per case basis especially in civil contracts by the

Re: pmap performance degradation after 30-40 min of work?

2012-10-13 Thread Ben Mabey
I switched from pmap to (r/fold n (r/monoid into vector) conj coll)) and the same thing happened again! after approximately 50 minutes cpu utilisation dropped from 4/4 to 1/4...I don't understand! Jim Are you holding on to the head of the collection? That is often the source of memory

Re: Midje popularity?

2012-10-17 Thread Ben Mabey
On 10/17/12 7:31 AM, Andreas Liljeqvist wrote: Hi. A couple of weeks ago I ported midje-mode over to nrepl. I did a post on the midje-group and made a pullrequest to the Midje-mode maintainer. Since I haven't got any response either on the mailinglist or the pullrequest I will ask here.

Re: Troubles working with nl.bitwalker.useragentutils

2012-10-24 Thread Ben Mabey
I'm completely lost here. Any tips? Maybe somebody has experience working with other UA parsing libraries? Hi Andrii, I have used the same library you are attempting to use in the past and it has worked well. My needs were simple and I found the bitwalker lib to be a great library for

Re: core.logic for constraint logic programming

2012-10-24 Thread Ben Mabey
On 10/24/12 2:56 PM, nathanmarz wrote: I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) 2. All topologies

Re: let in the middle of thread-first

2012-10-25 Thread Ben Mabey
On 10/25/12 6:24 PM, Jason Bennett wrote: Let's say I have a set of thread-first calls: (- url a b c d e) And let's say that I need to process and save the result of function b as a second parameter to function e (function b returns a file, and function e needs the

Re: Documenting clojure data structures

2012-10-31 Thread Ben Mabey
On 10/31/12 12:04 PM, gaz jones wrote: you could try using contracts to specify what keys are supposed to be in the map, or just use pre/post conditions built in to clojure? https://github.com/fogus/trammel FYI, it looks like trammel's ideas are being moved over to

Re: Documenting clojure data structures

2012-10-31 Thread Ben Mabey
On 10/31/12 2:15 PM, Paul deGrandis wrote: If your concern is passing around associative data, contracts and general membership functions are the two most common approaches. If you're dealing with some unknown thing, you can see what protocols it satisfies and what functions/operations those

Re: Clojure Recursion (loop-recur) Questions

2012-11-27 Thread Ben Mabey
On 11/27/12 9:17 PM, Curtis wrote: Thank you Andy - This was fabulously helpful - I really appreciate your explanation. Would you permit me to include your answer in a blog post about the above question? On Monday, November 19, 2012 6:25:30 PM UTC-8, Andy Fingerhut wrote: If you are

big atoms (was Re: STM - a request for war stories)

2012-12-13 Thread Ben Mabey
Datomic stores the entire database in an atom (not an STM ref), and updates it with a call to swap! It is literally no more complex than a trivial hackneyed book example. :-) A lot of my systems have evolved into something similar and I've wondered what the implications of this approach

Re: Convincing employer to go for Clojure

2013-01-09 Thread Ben Mabey
On 1/7/13 4:02 PM, David Jacobs wrote: What other tips do you have for convincing an employer that Clojure makes good business sense? (Of course I've already told them about domain-tailored abstractions, containing complexity, the ease of data manipulation with a functional language, etc.)

Re: Matrix Multiplication Woes

2012-01-18 Thread Ben Mabey
On 1/17/12 5:22 PM, blcooley wrote: On Jan 17, 5:43 pm, Sam Ritchiesritchi...@gmail.com wrote: Update -- I wrapped the JBLAS library and ended up with stellar performance, about 3x faster than numpy. https://gist.github.com/264a2756fc657140fdb8 You might not be interested at this point,

Re: How to add a new type of collection?

2012-01-24 Thread Ben Mabey
On 1/24/12 7:20 AM, Stuart Sierra wrote: The fundamental interfaces are all written in Java. ISeq, IPersistentCollection, and so on. You can implement then in deftype. Look at (ancestors (class [])) as a place to start. -S I believe the OP wanted to know if they could extend a java data

Adding primitive type hints to anonymous functions

2012-01-24 Thread Ben Mabey
Does the new primitive support added in 1.3 extend to anonymous functions? If so, I am doing something wrong because I can't get them to work: (definterface IPrimitiveTester (getType [^int x]) (getType [^long x]) (getType [^float x]) (getType [^double x]) (getType [^Object x]))

Re: Adding primitive type hints to anonymous functions

2012-01-25 Thread Ben Mabey
On 1/25/12 2:25 AM, Tassilo Horn wrote: Hi again, I think, I got it. I wrote a little helper function to print the metadata of a form: --8---cut here---start-8--- (use 'clojure.walk) (defn print-meta ([form level] (prewalk (fn [x]

No support for primitive type returns within protocols (1.3)?

2012-01-25 Thread Ben Mabey
Hi again, Is it possible to add primitive type hints to protocols (as the return type)? My attempt below failed: (definterface IPrimitiveTester (getType [^int x]) (getType [^long x]) (getType [^float x]) (getType [^double x]) (getType [^Object x])) (deftype PrimitiveTester []

Re: No support for primitive type returns within protocols (1.3)?

2012-01-25 Thread Ben Mabey
On 1/25/12 1:41 PM, David Nolen wrote: On Wed, Jan 25, 2012 at 3:34 PM, Ben Mabey b...@benmabey.com mailto:b...@benmabey.com wrote: Hi again, Is it possible to add primitive type hints to protocols (as the return type)? My attempt below failed: (definterface IPrimitiveTester

Re: How to add a new type of collection?

2012-01-27 Thread Ben Mabey
On 1/27/12 9:11 AM, Walter van der Laan wrote: Are you somehow required to use the Java library? Otherwise you could also use a Clojure map as a sparse matrix. This will be much easier to implement. Using a clojure map to store a sparse matrix is not a good solution if you plan on doing any

Re: Adding primitive type hints to anonymous functions

2012-01-27 Thread Ben Mabey
On 1/26/12 5:07 AM, Cedric Greevey wrote: On Thu, Jan 26, 2012 at 5:54 AM, Tassilo Horntass...@member.fsf.org wrote: Cedric Greeveycgree...@gmail.com writes: On Thu, Jan 26, 2012 at 2:28 AM, Tassilo Horntass...@member.fsf.org wrote: At least, it seems that (fn ^double [^double x] (+ x

Re: seeking a lazy way to interleave a constant

2012-04-09 Thread Ben Mabey
On 4/9/12 8:31 PM, Andrew wrote: Given a lazy sequence of numbers is there a way to interleave a constant and get another lazy sequence? Say the first sequence is 1 2 3 4 ... I'd like the second sequence to be 1 0 2 0 3 0 4 0 Thanks in advance! Yep, and it is even called interleave.

Re: seeking a lazy way to interleave a constant

2012-04-09 Thread Ben Mabey
On 4/9/12 9:10 PM, Cedric Greevey wrote: On Mon, Apr 9, 2012 at 10:31 PM, Andrewache...@gmail.com wrote: Given a lazy sequence of numbers is there a way to interleave a constant and get another lazy sequence? Say the first sequence is 1 2 3 4 ... I'd like the second sequence to be 1 0 2 0 3 0

Re: clojure jython interop

2012-05-25 Thread Ben Mabey
On 5/25/12 9:08 AM, Brent Millare wrote: Ok well installing is easy java -jar jython_installer-2.5.2.jar # to get python repl java -jar jython # to run script java -jar jython ./python.py I haven't looked into calling python functions (running in jython) from clojure though because

Re: ClojureScript instead of CoffeeScript for complete web app development?

2012-06-28 Thread Ben Mabey
On 6/24/12 10:31 PM, Christian M. wrote: I think the only problem (if it is a problem at all), which won't be solved soon is ClojureScript's performance resulting from creating a lot of implicit objects in very high level computations. Something like (filter (map (reduce ... ... (map ...

lazy-seq realization/retention within futures

2010-08-08 Thread Ben Mabey
Hi all, I've run into an issue with a lazy-seq either being prematurely realized or having the head unwittingly retained. Reading chapter 5 in The Joy of Clojure I realize that I am breaking one of the rules (page 150 in my MEAP version): avoid binding your lazy sequences locally. That said,

Re: Game development in Clojure

2010-08-20 Thread Ben Mabey
On 8/20/10 12:21 PM, Alan wrote: Thanks, I'll look into it. I know minimax ought to be easy to do but it's a bit of a weak spot of mine - I can never seem to get it right, and the poorish debug support in clojure, even with slime/swank, doesn't make it easier. I'm reasonably confident

Re: Clojure Database experience reports wanted

2010-10-03 Thread Ben Mabey
On 10/2/10 12:01 PM, Mark Engelberg wrote: I've been using clojure with mongodb for a while now. I found that using a nosql database system was very freeing and pleasurable, compared to the python/sqlite combination I'd used before. However, I'm starting to bump up against some limitations:

Re: Hotspot JIT optimisations

2013-06-16 Thread Ben Mabey
On Sun Jun 16 16:51:41 2013, Colin Fleming wrote: Hi all, This is slightly tangential to the current discussion on unnecessary type checks - does anyone have any good links to information about the JIT optimisations performed by Hotspot? One question I've been interested in recently is how well

Re: ClojureScript concurrency?

2013-07-12 Thread Ben Mabey
On Fri Jul 12 16:56:17 2013, Michał Marczyk wrote: At the risk of sounding pedantic, concurrency is not the same as parallelism. Multiple threads can be scheduled on a single core (and that's plenty useful). So, with the async stuff you mention, JavaScript already supports concurrency.

communicating quits to timeouts AND parent loop in core.async

2013-07-17 Thread Ben Mabey
Hi all, In a number of places where I'm trying core.async I have run across the pattern of having a loop inside a go block with some timeouts in the loop body. Contrived example: (go (while true (println Hello World!) (! (timeout 1)) (println I'm done

Re: communicating quits to timeouts AND parent loop in core.async

2013-07-17 Thread Ben Mabey
at 2:47 PM, Ben Mabey b...@benmabey.com mailto:b...@benmabey.com wrote: Hi all, In a number of places where I'm trying core.async I have run across the pattern of having a loop inside a go block with some timeouts in the loop body. Contrived example: (go (while

Re: communicating quits to timeouts AND parent loop in core.async

2013-07-17 Thread Ben Mabey
[[v c]] (alts! [(timeout 1) stop])] (if (= c stop) :done (do (println I'm done sleeping, going to recur now...) (recur))) On Wed, Jul 17, 2013 at 2:47 PM, Ben Mabey b...@benmabey.com javascript: wrote: Hi all

Re: preference and implications of using as- vs let

2013-08-19 Thread Ben Mabey
On 8/19/13 8:58 AM, Jay Fields wrote: In the past, I've written code like the following (defn foo [x y] (let [x-squared (* x x)] (if (pos? y) (+ x-squared y) (- x-squared y However, the introduction of as- has led me to write the following, at times (defn foo [x y]

Re: profiler?

2013-08-27 Thread Ben Mabey
On 8/27/13 8:06 AM, Jay Fields wrote: What are you all using these days? I've been using YourKit and I'm fairly happy with it. Just making sure I'm not missing out on some new hotness. Cheers, Jay YourKit plus VisualVM in some cases (I'm not as familiar w/YourKit and I really like the

Re: Rxjava + Clojure Users

2013-08-27 Thread Ben Mabey
On 8/27/13 10:03 AM, Dave Ray wrote: Hi. I'm writing to see if there's anyone out there using RxJava [1] from Clojure and to get their opinion on it's current, built-in support for non-Java languages. Just to recap, the current implementation knows about clojure.lang.IFn allowing functions

Re: A macro for writing defn-like macros?

2013-09-03 Thread Ben Mabey
On 9/3/13 10:01 AM, Mark wrote: I find the vast majority of the time I'm tempted to write a macro (yeah, yeah, I know the first rule of macro club), is to defn-like things. Writing a defn-like macro to handle all the stuff defn does is pretty tough so I end up writing a barebones thing that

Re: Clojure in Salt Lake City

2013-09-22 Thread Ben Mabey
On Sun Sep 22 21:24:24 2013, Jason Kapp wrote: Is there anyone out there that is using Clojure(Script) in Salt Lake City that would like to meetup? Hi Jason, I'm currently based in SLC and have been using clojure since 2010 (at work that is). We've had a couple of false starts of doing a

Re: Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-26 Thread Ben Mabey
On 9/25/13 8:33 PM, zcaudate wrote: I've put up a video of a new documentation plugin for leiningen Project Page: https://github.com/zcaudate/lein-midje-doc Youtube Video: http://www.youtube.com/watch?v=8FjvhDPIUWEfeature=youtu.be Sample Generated Documentation:

Re: core.async repl :reload-all issue?

2013-09-27 Thread Ben Mabey
Hi Russell, This doesn't look like a core.async specific problem, but rather the more general problem that protocols and records are not reload safe. What I believe is happening is the TimeoutQueueEntry type is being recompiled when you do reload all but old instances with the older

Re: core.async repl :reload-all issue?

2013-09-27 Thread Ben Mabey
to Stuart's workflow. In my (more) real app I am trying to follow his workflow protocol and it was reloading fine but now is not maybe i need to read the link again, Thanks On Fri, Sep 27, 2013 at 2:06 PM, Ben Mabey b...@benmabey.com mailto:b...@benmabey.com wrote: Hi Russell

Re: type checking clojure.set with core.typed

2013-09-30 Thread Ben Mabey
On 9/30/13 5:16 PM, Stuart Halloway wrote: I tried the following experiment with type checking clojure.set: (ns exploring.core-typed (:use clojure.core.typed clojure.repl) (:require [clojure.set :as set])) (ann ^:no-check clojure.set/difference [(Set Any) (Set Any) - (Set Any)])

Re: type checking clojure.set with core.typed

2013-09-30 Thread Ben Mabey
tasks to do something similar for CI. Any CircleCI guys are on the list want to give us a real experience report? On 9/30/13 5:26 PM, Stuart Halloway wrote: Any experience reports? My experience so far: Type Checker: Found 1 error $ echo $? 0 On Mon, Sep 30, 2013 at 7:20 PM, Ben Mabey b

Re: Dependency management

2013-10-17 Thread Ben Mabey
On 10/17/13 9:38 AM, Andrei Serdeliuc wrote: Hi, I was wondering how people handle dependencies that aren't on clojars. We have a couple of clojure libs which are hosted on an internal github enterprise. So far I've been using lein's checkouts feature, but this seems fairly difficult when

  1   2   >