Re: Generate static methods at runtime?

2013-03-16 Thread James Reeves
Out of curiosity, why would you want to? On 16 March 2013 23:49, vemv wrote: > All class-generating Clojure constructs that one can use at runtime such > as proxy, reify, or defrecord, seem to generate instance methods only. > > gen-class can emit static methods, but one cannot leverage its > f

Re: Exception propagation design in Clojure web APIs.

2013-03-19 Thread James Reeves
I'd argue that using exceptions for control flow is something of an anti-pattern, even in Java. In this case a better mechanism might be to use polymorphism. For instance: (defprotocol Validatable (validation-errors [x] "Return the validation errors for x.")) (defn valid? [x] (empty? (valida

Re: Exception propagation design in Clojure web APIs.

2013-03-20 Thread James Reeves
On 20 March 2013 08:36, Marko Topolnik wrote: > If you responsibly keep to the "good parts", exceptions could be the way > to go. Validation is one example where I love them because it happens all > around, but validation failures are all handled uniformly. > If validation happens "all around",

Re: Exception propagation design in Clojure web APIs.

2013-03-20 Thread James Reeves
On 20 March 2013 16:41, Marko Topolnik wrote: > On Wednesday, March 20, 2013 4:34:32 PM UTC+1, James Reeves wrote: > >> >> If validation happens "all around", that implies there is no one function >> that can test whether a value of data is valid for a given d

Re: [ANN] Amazonica: Clojure client for the entire AWS api

2013-03-25 Thread James Reeves
It looks very interesting, but I'm afraid I really don't like "defcredential" macro. The Clojure API should really have *less* mutability than the Java API, not more :) - James On 25 March 2013 21:51, Michael Cohen wrote: > Curious to hear opinions on this: > > https://github.com/mcohen01/amaz

Re: Using a Java game engine in my project

2013-04-29 Thread James Reeves
I've been messing around with jME3 as well, and at some point I might release a library for it. One of the problems with jME3 is that its deployment mechanism hasn't quite caught up with the current century. I'm planning on packaging it up eventually, but in the meantime here's the ugly, dirty, te

Re: A JMonkeyEngine3 wrapper?

2013-05-01 Thread James Reeves
On 1 May 2013 21:08, Alex Fowler wrote: > So, inspired by the latest talks with locals, I propose starting a > collective initiative on creating a full-scale wrapper for JME3. > > Actually, I am starting to write my Clojure project with JME3 and I feel > like in a desperate need for a clojuric wr

Re: A JMonkeyEngine3 wrapper?

2013-05-02 Thread James Reeves
On 2 May 2013 12:09, Alex Fowler wrote: > Hmm, interesting, but games usually involve much state and changes to keep > up their worlds alive.. how do you abstract over this? I work out what changes are required to the scene by comparing the current data structure with the previous one, then cha

Re: Struggling with encapsulation

2013-05-09 Thread James Reeves
On 9 May 2013 17:07, Colin Yates wrote: > The part I am struggling with is how to create a Woobly without exposing > its internals. > To what end? What's the benefit? If you take a look at some internal data structures Clojure uses, like zippers or protocols, you'll notice that they're just map

Re: Struggling with encapsulation

2013-05-09 Thread James Reeves
On 9 May 2013 18:03, Colin Yates wrote: > I am nervous as well about "expose internals but trust people to do the > right thing" because in this case, if I was a consumer and saw that queue, > particularly given the emphasis about data being the contract etc. then why > would I think *not* to use

Re: Struggling with encapsulation

2013-05-10 Thread James Reeves
On 10 May 2013 11:32, Colin Yates wrote: > And please don't think I am making the 'code should stop bad programmers > doing the wrong thing' argument, I'm not (been there, lost). I just know > that if I released a scheduler library and the main construct was a map > containing a LBQ (or in fact

Re: Interface to integrate transactions with Clojure transactions

2010-06-10 Thread James Reeves
On 10 June 2010 11:26, Michael Jaaka wrote: > Is there any way to integrate database transaction with Clojure > transaction? > It would be nice if operations done in memory and on database would be > commited atomicly with the end of transaction scope in Clojure. > Such interface had to be also aw

Re: Interface to integrate transactions with Clojure transactions

2010-06-10 Thread James Reeves
On 10 June 2010 22:40, Michael Jaaka wrote: > Not good, since if database commit fail it is too late for dosync to > rollback. > In fact database commit should somehow cooparate with dosync commit > which is just a case of distributed transaction. You're right. In which case, I don't believe ther

Re: ANN: Conjure 0.6 Released

2010-06-11 Thread James Reeves
On 11 June 2010 14:46, Matt wrote: > I just released Conjure version 0.6. You can download it at: > http://github.com/macourtney/Conjure/downloads > > Conjure is a full stack web framework (like Ruby on Rails) written in > Clojure. The goal of Conjure is to let users write simple database > backed

Re: ANN: Conjure 0.6 Released

2010-06-12 Thread James Reeves
On 11 June 2010 22:52, Matt wrote: > I have thought about much of what you posted. My replies are below. > > 1. I have looked at stronger integration of ring and Conjure, but the > latest version of Ring was a big change from the previous version and > I wanted to get a new version of Conjure out.

Re: Using PRXML lib

2010-06-12 Thread James Reeves
You can also change the binding of *out* to point directly to your file writer. - James On 12 June 2010 20:43, Emeka wrote: > Thanks, it worked :( > > On Sat, Jun 12, 2010 at 8:23 PM, Moritz Ulrich > wrote: >> >> You can use (with-out-str &body) to capture the output or prxml to a >> string and

Re: ANN: Conjure 0.6 Released

2010-06-13 Thread James Reeves
On 13 June 2010 14:20, Matt wrote: > Yesterday morning, I took one more look at Leiningen for Conjure. > After a few false starts and build hacking, I had exactly the same > idea for a Conjure plugin for Leiningen. I've started breaking Conjure > into two jars, conjure.jar which will be all the ba

Re: Non-tail recursion (Clojure way to hierarchies)

2010-06-15 Thread James Reeves
On 13 June 2010 11:35, Oleg wrote: > Currently i'm just calling function, but there is a danger of > StackOverflow. I can't use recur, because it's not last statement. As > i can understand recur is good to build long sequences, but in my case > i'm building hierarchy. If you're only recursing to

Re: Requesting Feedback on new Relational Mapping lib for Clojure

2010-06-15 Thread James Reeves
On 14 June 2010 17:14, Brenton wrote: > The current version is what I would consider to be a working prototype > and I would love to get feedback from the community before I do much > more work on this. I've been thinking about a similar problem. Most database mappers have three components: 1.

Re: Non-tail recursion (Clojure way to hierarchies)

2010-06-15 Thread James Reeves
On 15 June 2010 22:56, Quzanti wrote: > Thanks Mike. > > So does is the only kind of recursion optimisation tail recursion? > > Can you only eliminate stack calls in tail calls? No, you can also eliminate stack calls using lazy-seq or trampolines. If you provide some example code of what you are

Re: Complex type in clojure

2010-06-15 Thread James Reeves
On 15 June 2010 23:26, Carson wrote: > Sorry I may have missed the reason for this earlier:  What's the > reason for allowing both 'i' and 'j' to indicate the imaginary part? > Is the intention to also later have 'k' to support quaternions?  Just > curious.  Thanks. "j" is used by electrical engi

State of Clojure web development

2010-06-23 Thread James Reeves
Hello there! Chas Emerick's recent "State of Clojure" survey [http://bit.ly/dtdAwb] indicated that a significant proportion of Clojure users are beginning to use Clojure for web development. A recent Hacker News posting [http://bit.ly/91Bu5J] seems to corroborate these results, with several Clojur

Re: State of Clojure web development

2010-06-25 Thread James Reeves
I'd first like to thank everyone who has replied so far. Your feedback has been invaluable. I'm going to try and address some of the issues people have raised. If I've missed any big ones, feel free to shout louder :) @Joost Could you send me an email with the i18n patches you had to make to Comp

Re: State of Clojure web development

2010-06-26 Thread James Reeves
On 26 June 2010 03:36, MarkSwanson wrote: > I still like timestamps even with per-user logging. Sorry, I guess wasn't entirely clear. The maps would still contain timestamps. My point is that we should get away from the idea thinking of logs as unstructured text strings. For example, a typical

Idiomatic Clojure namespace names

2010-07-07 Thread James Reeves
I've kinda asked this question before, but I framed in the context of a suggestion, and the discussion got bogged down with no real answer. So this time, let me keep it simple: if I have a small Clojure library, "foo", which only has one namespace, what is the idiomatic name for that namespace?

Re: Idiomatic Clojure namespace names

2010-07-07 Thread James Reeves
On 7 July 2010 17:24, Laurent PETIT wrote: > Of course, if your library has an especially cryptic name (as we have > with counterclockwise: ccw), then having also directly foo may also > not interfere with other's namespaces. That's the path we took for > counterclockwise, and our top-level namesp

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread James Reeves
On 7 July 2010 19:04, David Nolen wrote: > So something like this: > (defn hello-world [request] >   (future >    (Thread/sleep 1) >    (respond! request >              {:status 200 >               :headers {"Content-Type" "text/html"} >               :body "Hello world!"}))) > Is non-blocking and

Re: ANN: Aleph, an asynchronous web server

2010-07-09 Thread James Reeves
On 9 July 2010 14:09, David Nolen wrote: > I'm curious how you ran that test. With ab running 10 clients for 1 second I > see ~4000-5000 req/s using Compojure 0.4.0. With aleph I see ~8000-9000 > req/s. I also had a quick chat with Zach Tellman and it sounds like he > hasn't done much in the way o

Re: Idiomatic Clojure namespace names

2010-07-09 Thread James Reeves
On 8 July 2010 16:56, Chas Emerick wrote: > Clojars is a disaster as an authoritative software artifact repository IMO, > and nothing about how it's being used should be taken as a template for > anything else. Ruby and Rubygems has been using single-segment namespaces for years, with no major pr

Re: Idiomatic Clojure namespace names

2010-07-10 Thread James Reeves
On 9 July 2010 17:46, Paul Moore wrote: > Is there any benefit to using a name like foo.core (or foo.api) rather > than simply foo (beyond sytlistic considerations, that is)? Clojure compiles "foo" to a package-less class called "foo". "foo.ciore" is compiled to a class called "core" in the packa

Re: ClojureDocs.org

2010-07-10 Thread James Reeves
On 9 July 2010 21:06, Tom Faulhaber wrote: > Quick thought: You probably don't want to include private vars. Seconded. It's a little confusing seeing private vars and macros in the API docs! Other than that, this looks excellent. I'm signing up as I write this. - James -- You received this me

Re: ClojureDocs.org

2010-07-10 Thread James Reeves
On 10 July 2010 15:06, Stuart Halloway wrote: > (6) Because docstrings are designed for consumption at a REPL, they may in > some cases presume a fixed font. Worth considering for display on the site. What about giving function documentation the same "wiki" behaviour that the examples have? Star

Re: alter atom while iterating

2010-07-11 Thread James Reeves
On 11 July 2010 12:38, Jeffrey Schwab wrote: > Is it safe to alter an atom while iterating that atom's value?  It seems to > work as I would expect, but am I just getting lucky (and are there > concurrency issues)? > > user=> (let [a (atom #{1 2 3 4 5})] >         (doseq [x @a] (prn @a) (swap! a d

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread James Reeves
On 15 July 2010 16:24, Brisance wrote: > Thanks for the response. > > To get an idea of what I mean,  visit http://www.wolframalpha.com/''. > Then enter something ridiculous (to me, at least) like 10! > > The answer is almost instantaneous. Wolfram Alpha is merely approximating the result to

Re: A functional, efficient, convolution function. Is imperitive-style the answer?

2010-07-17 Thread James Reeves
On 16 July 2010 20:57, Isaac Hodes wrote: > I am trying to create a lazy/functional/efficient/Clojuresque function > to carry out convolution on two lists/vectors of (ideally BigDecimals > but that may be inefficient) doubles. Perhaps something like this? (defn convolve [ns ms] (loop [nums (fo

Re: A functional, efficient, convolution function. Is imperitive-style the answer?

2010-07-17 Thread James Reeves
On 17 July 2010 18:41, David Cabana wrote: > I tried to run Jame's code, but the compiler (1.2 beta) squawked at me: > Unable to resolve symbol: indexed in this context >  [Thrown class java.lang.Exception] > > What do I need to pull in to pick up the "indexed" function? Sorry, I should have ment

Re: chinese character in hiccup

2010-08-12 Thread James Reeves
On 12 August 2010 14:33, limux wrote: > The solution in http://tiny.cc/3cmrx is useful, thanks. > That what cause the issue should be compojure. That thread's time is > 6, June. > and compjure haven't fixed it. The solution you mention is some middleware that sets the content-type charset header

Re: chinese character in hiccup

2010-08-13 Thread James Reeves
2010/8/13 limux : > Then, if Ring doesn't care of the charset also, there is no one, suck > as jetty, ring, compojure would take care of the charset except > myself. There are many peopole come from all kinds of country or > region who use ring, jetty and compojure. Let themselves set the right > c

Re: Where is (re? x)

2010-08-23 Thread James Reeves
Why use def? You could just place re? after the definition of defn, and write it: (defn re? "Return true if x is a regular expression" {:added "1.3"} [x] (instance? java.util.regex.Pattern x)) - James On 23 August 2010 16:17, Jeff Rose wrote: > It looks like regular expressions are the

Re: misunderstanding collection

2010-08-25 Thread James Reeves
I think you're getting confused. (map reduce + %) won't work, because the signature of the map function is (map func & colls). In other words, the second argument is expected to be a collection, but you've put in +, which is a function. When dealing with nested collections, you may want to work f

Re: Typical usage of Compojure

2010-09-05 Thread James Reeves
On 4 September 2010 16:44, HB wrote: > If Compojure is micro web framework like Sinatra, does this means it > is not suitable for large web applications? The "micro" refers to how much the framework does for you, rather than the size of the application. The advantage of a framework like Ruby on

Re: Typical usage of Compojure

2010-09-07 Thread James Reeves
On 5 September 2010 20:53, HB wrote: > It is public idea in Ruby community that Sinatra is best used for > rapid prototyping and creating API for web application. This opinion tends to come from developers used to larger web frameworks like Ruby on Rails. I don't agree with this. RoR makes certai

Re: testing local functions?

2010-09-10 Thread James Reeves
On 10 September 2010 12:24, alux wrote: > I always thought it to be good style to make helper functions only as > visible as needed, e.g. by using letfn. > > But when I want to test my code, I just dont see a way to access these > local functions for tests. I don't believe you can. You could make

Re: What is ring/jetty doing with my *out*?

2010-09-10 Thread James Reeves
On 10 September 2010 15:39, Colin Steele wrote: > It seems that when using ring/jetty, *out* is getting eaten or thrown > away.  I'm a n00b to clojure and the java world in general, but it > seems odd that (prn something) should silently fail?  I'm guessing > that I'm missing some configuration so

Re: Compojure

2010-09-13 Thread James Reeves
On 13 September 2010 13:54, Bahman Movaqar wrote: > It works.  Strange gotcha. Ring uses handler functions rather than Java servlets to represent web applications. A Ring adapter takes a handler and a map of options, and starts an inline webserver. The ring.util.servlet library provides a way o

Re: ANN: funkyweb 0.1.0 - The clojure webframework with route inference

2010-10-06 Thread James Reeves
2010/10/6 Cédric Pineau : > One thing : I'm new to clojure and gathering information about the whole > ecosystem, including web frameworks, but find it hard to figure what to > choose. It would help to have clues of funkyweb's "positioning" regarding > other frameworks such as compojure, compojure-

Re: ANN: Clojure Toolbox (Early Beta)

2011-03-15 Thread James Reeves
On 15 March 2011 18:26, Mibu wrote: > Great site! Clean, simple, and very useful. Thanks :) > There's a missing 'n' at the end of the link to ring-basic-authentication. Fixed. > The "Beta" label doesn't mean what it used to mean. Today, it's unflattering > and unnecessary to have it on display

Re: Clojure Editor

2011-03-17 Thread James Reeves
On 17 March 2011 12:05, Lee Spector wrote: > FWIW the feature I describe (syntax-aware auto-indenting) is common in the > Lisp world, not only in emacs but also (to name just a few that are fresh in > my memory) in MCL, DrScheme and LispWorks. It's also common in many other languages. Most IDEs

Re: About a networked REPL...

2011-03-20 Thread James Reeves
On 21 March 2011 00:18, Chas Emerick wrote: > In any case, my objective with nREPL was to get something working well that > had what I thought were the right semantics for the use cases I was concerned > with (i.e. point-to-point Clojure tooling backends).  Lifting those semantics > onto other

Re: About a networked REPL...

2011-03-21 Thread James Reeves
On 21 March 2011 11:29, Chas Emerick wrote: > The notion of "passing around Clojure data structures" does get watered down > because of the non-sexpr-nature of e.g. *out* and *err*, and it's all > message-oriented so as to support asynchronous evaluation from the same > client, but that's prett

Re: About a networked REPL...

2011-03-21 Thread James Reeves
On 21 March 2011 13:10, Meikel Brandmeyer wrote: > Then we need a clear definition of the clojure syntax. Otherwise you > cannot build clients without read-string. True. I guess bencoded data structures, or JSON inside a netstring would perhaps be more cross-platform solutions. - James -- You

Re: About a networked REPL...

2011-03-21 Thread James Reeves
On 21 March 2011 13:14, Chas Emerick wrote: > I think we're in violent agreement.  Here's a sample nREPL exchange from > https://github.com/clojure/tools.nrepl: Ah, I did look through that REPL exchange, but I misunderstood the syntax the first time I read it. I now realise that the integer at t

Re: I understand metadata now!

2011-03-25 Thread James Reeves
On 25 March 2011 10:41, msappler wrote: > Never used metadata until now. > > I had an insight yesterday that I want to share with you: > > http://resatori.com/metadata-insight In my view, it depends whether your :id key is a surrogate key or a natural key. Object metadata should not affect objec

Re: Namespace and file structuring

2011-03-25 Thread James Reeves
On 25 March 2011 01:05, Terje Dahl wrote: > In Java, the language forces you to have more or less one class pr > class-file, and you are encouraged to group class-files in packages. > So, is it as simple as saying that that namespaces are analogous to > class-files, and clj-files are analogous to

Re: Namespace and file structuring

2011-03-28 Thread James Reeves
On 28 March 2011 03:01, Terje Dahl wrote: > So, would you say that namespaces are in fact a lot like Python > packages - one pr file - and with the same flexibility of Python's > import-statements: Basically, yes. It's possible to put different namespaces in the same file, but then the `require`

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-06 Thread James Reeves
On 6 April 2011 13:27, Joost wrote: > The idea is to have a simple collection of these kinds of functions > outside of possibly unwanted frameworks. I'm using them myself for > doing validation with clj-decline, but it should at least be useful > for most code that has to deal with free-form text

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-07 Thread James Reeves
On 7 April 2011 06:48, Joost wrote: > I think your choice of currying makes more sense, at least in the > context of validations, so it might be a good idea to switch pretzel > over to that scheme. Would it make sense for clj-decline? The Valip predicates are designed with HTML form validation i

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-08 Thread James Reeves
On 7 April 2011 20:03, Joost wrote: > Yup. I'm mostly in the same boat. That's why all the predicates I've > produced for now are in the pretzel.strings namespace. I expect to end > up with few non-string predicates, but those will have to go into > pretzel.numbers or whatever make sense. What ab

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-08 Thread James Reeves
On 8 April 2011 08:43, Joost wrote: >> What about predicates that operate on numbers encoded as strings? e.g. >> "1" or "4.2". > > IMO, they should be in the strings package. The strings namespace could get rather large then, considering that strings are how most raw data is represented. > Sure,

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-09 Thread James Reeves
On 8 April 2011 23:21, Ken Wesson wrote: > Better yet: maybe we're looking at this backwards. Maybe what we want > isn't a predicate for *passed* validation, but a predicate for > *failed* validation: > > (defn s-blank? [x] >  (if (empty? (.trim x)) "must not be blank")) That particular example t

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-09 Thread James Reeves
On 9 April 2011 10:07, Ken Wesson wrote: >> That particular example ties a predicate to a particular error >> message. Error messages should be independent of predicates, otherwise >> they can't be localized or changed to fit a specific situation. > > It can always be an integer or a keyword (or a

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-10 Thread James Reeves
On 10 April 2011 09:49, Ken Wesson wrote: > (def age-invalid-en >  {:low "age must be at least 1" >   :high "nobody is THAT old!" >   :blank "age is required" >   :non-integer "age must be a whole number"}) > > (def qty-invalid-en >  {:low "quantity must be at least 1" >   :high "maximum 10 per cu

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-10 Thread James Reeves
On 10 April 2011 12:33, Ken Wesson wrote: > I thought you were the one who wanted the strings moved out to a data > structure that could be swapped with localized versions? :) Not really. I just want the error messages to be independent of the predicates. In essence, I'm looking for a solution w

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-11 Thread James Reeves
On 10 April 2011 22:24, Ken Wesson wrote: > On Sun, Apr 10, 2011 at 1:37 PM, James Reeves wrote: >> By adding error messages to predicates, we tightly couple the >> validation error with the predicate, which in general is considered >> bad. However, this might be a valid co

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-11 Thread James Reeves
On 11 April 2011 08:31, Ken Wesson wrote: >> So your not-int-in-range? function is a compound function, made up of >> four simple functions. > > So? This whole discussion arose because some of them have > preconditions, like at-least 1 not making sense for blank or > non-integer input. Yes, but r

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-11 Thread James Reeves
On 11 April 2011 09:43, Ken Wesson wrote: > On Mon, Apr 11, 2011 at 4:12 AM, James Reeves wrote: >> Yes, but remember that I said I was looking for non-compound >> solutions. In my view, simple functions are more idiomatic Clojure. > > Mine were built up starting from

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-11 Thread James Reeves
On 11 April 2011 21:26, Ken Wesson wrote: > On Mon, Apr 11, 2011 at 1:09 PM, James Reeves wrote: >> If you already have a, b, and c, then compounding them into one >> function, only to then use a map to split them up again doesn't seem a >> good solution. > > The

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-11 Thread James Reeves
On 12 April 2011 01:41, Ken Wesson wrote: > On Mon, Apr 11, 2011 at 7:09 PM, James Reeves wrote: >> You wouldn't necessarily need to explicitly verify each precondition, >> but it might be the case that the same string is parsed multiple >> times. However, I'm

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-12 Thread James Reeves
On 12 April 2011 04:31, Ken Wesson wrote: > There's a difference between the program parsing the same *object* > multiple times, and the program's own source code containing > duplication! But there isn't any duplication: (defn present? [x] (not (string/blank? x))) (defn- parse-int [x] (try

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-12 Thread James Reeves
On 12 April 2011 12:02, Ken Wesson wrote: > Don't be ridiculous. If you're putting that (chain ...) sexp of yours > in every separate place where a field is checked for being an integer > in a range, then that's duplication. And if you extract it into a > function that just takes the endpoints as

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-12 Thread James Reeves
On 12 April 2011 12:16, Joost wrote: > An input string of "foobar" is obviously not a number between 10 and > 20, so whatever predicate you use to test for that should just return > false. That not everybody here agrees on that indicates to me that > people are trying to shove too much functionali

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-12 Thread James Reeves
On 12 April 2011 22:04, Joost wrote: > For now, I think of the pretzel library as the lowest useful level of > abstraction for input tests. And for low level abstractions, I prefer > to place a higher value on correctness, extensibility, consistency and > possibly even performance (in roughly that

Re: Future of clojure.contrib.core/-?> macro

2011-04-18 Thread James Reeves
On 18 April 2011 16:47, Laurent PETIT wrote: > So the question is: do a sufficiently important number of other people > use and want them as well  ? If so, I may ask to the clojure-dev ml if > and how and/or where we could move this macro so that it is still > visible and `usable`. I use it, and

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
1.1.0 seems to have regressed. I've added slamhound as a dependency: (defproject foobar "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.1"]] :dev-dependencies [[slamhound "1.1.0"]]) Then added a function to "src/foobar/core.clj": (ns foobar

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
On 26 April 2011 22:16, Phil Hagelberg wrote: > > On Apr 26, 12:58 pm, James Reeves wrote: > > When I start a REPL and try to slamhound it, it instead throws an exception: > > > > user=> (require 'slam.hound) > > nil > > user=&g

Re: How to determine a function name at runtime

2011-04-26 Thread James Reeves
On 27 April 2011 00:05, clj123123 wrote: > I have a function: > > (defn abc [] (println "blah")) > > (defn blah2 [f] (println f)) > > (blah2 abc) > > I need to print out the name of the function passed to blah2. Then you want something like: (defn blah2 [f] (println (:name (meta f - James

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
On 26 April 2011 23:49, Phil Hagelberg wrote: > On Apr 26, 2:56 pm, James Reeves wrote: >> On 26 April 2011 22:16, Phil Hagelberg wrote: >> > However, there was an unrelated bug causing issues when uncompilable >> > namespaces were on the classpath. I'll have

Re: How to determine a function name at runtime

2011-04-26 Thread James Reeves
On 27 April 2011 01:09, Ken Wesson wrote: > It has some limitations, though. Specifically, it won't work with > local functions, even named ones: Yes, good point! A more foolproof way might be to use a macro, but then macros have their own disadvantages. It depends on what clj123123 wants to us

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-10 Thread James Reeves
On 10 May 2011 07:24, Shree Mulay wrote: > For the life of me, I can't get sessions to work, immaterial of which > tutorial I try and get going???  Is there any tutorial out there that > explicitly explains everything for a newb like me? After several > round, I did successfully get form params to

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-11 Thread James Reeves
On 12 May 2011 00:04, Shree Mulay wrote: > From this code, I can't figure out where you "instantiate" the session > var, store to it, and read back from it? I know there's not > instantiation in clojure(???). I hope your able to get what I'm having > trouble figuring out. The session is read from

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-12 Thread James Reeves
On 12 May 2011 04:49, Shree Mulay wrote: > But for WHATEVER reason, the sessions are NOT getting stored? Have you added the session middleware? e.g. (def app (-> main-routes wrap-params wrap-session)) Or more succinctly: (def app (handler/site main-routes)) - James -- You re

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-12 Thread James Reeves
On 12 May 2011 20:37, Shree Mulay wrote: >  ;(wrap-reload '(SocialNetworkCore.core))  ;;remove wrap-reload > > it started behaving. Is the "wrap-reload" functionality not compatible > with Ring Sessions??? Have I implemented it the wrong way? I'm not sure. There exist better alternatives to the `

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-12 Thread James Reeves
On 13 May 2011 00:23, Shree Mulay wrote: > I didn't know there was? What I understood of wrap-reload is that I > didn't have to restart "lein ring server" at the command line > everytime I made a change to my core.clj file??? > > How do I set up lein-ring to give me the same functionality? lein-r

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-14 Thread James Reeves
On 14 May 2011 20:49, Shree Mulay wrote: > One final thought I had is I've noticed if I reload a page, the > session information is lost. How do we get around this? You could use defonce to define an atom to back the session storage. e.g. (require 'ring.middleware.session.memory) (defonce m

Idiomatic use of records vs. maps

2011-05-29 Thread James Reeves
The documentation on records seems to indicate that they be used in place of structs, but is there any advantage to using a record if no protocols are assigned to it? For example, I've defined a TcpServer record as part of a library I'm developing: (defrecord TcpServer [port host

Re: Idiomatic use of records vs. maps

2011-05-30 Thread James Reeves
On 30 May 2011 02:02, Ken Wesson wrote: > I don't think either is non-idiomatic, but I'd probably just use the > map. It's shorter and simpler code, more widely interoperable with > other Clojure facilities, and the member access speedup using a record > is unlikely to matter much in code that is

Re: Libraries and build management hell

2011-07-29 Thread James Reeves
On 29 July 2011 08:01, Michal B wrote: > Leiningen definitely alleviates the hairiness of library management. But I > wish people won't settle for a lein like solution for simple projects. As > much as it helps, it is still an unnecessary burden and an obstacle to > adoption, in my opinion and exp

Re: Slow static file handing with lein ring server

2011-08-01 Thread James Reeves
On 1 August 2011 08:24, sailormoo...@gmail.com wrote: > I don't know why, but it seems to have a one second delay getting each > static file even in local host testing. > > :dependencies [[org.clojure/clojure "1.2.1"] >                 [org.clojure/clojure-contrib "1.2.0"] >                 [compo

ANN: evaljs 0.1.0

2012-03-04 Thread James Reeves
I've just released a library for evaluating Javascript within Clojure. It's effectively a Clojure-friendly interface over Mozilla's Rhino Javascript interpreter. https://github.com/weavejester/evaljs I wrote it so I'd have an easy way of wrapping Javascript libraries like LESS (http://lesscss.org

Re: [ANN] kibit, A static code analyzer

2012-03-04 Thread James Reeves
On 4 March 2012 19:23, Jonas wrote: > Kibit[1] is a simple code analysis tool (and leiningen plugin) which > someone hopefully will find interesting or useful. The purpose of the > tool is to tell its users that "Hey, There's already a function for > that!". That sounds really cool. I did spot a

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-10 Thread James Reeves
On 8 March 2012 16:23, Leon Talbot wrote: > What I met by readable, is the capacity of reading someone's code. I develop Ruby professionally, and write Clojure in my spare time. Off hand, I can think of several Ruby libraries I'd consider to have unreadable code, but no Clojure equivalents immed

Need opinions on arglists with optional arguments

2012-03-10 Thread James Reeves
In the Hiccup library, some functions take an optional map of attributes as their first argument. So I could write: (text-field :name) (text-field :name "Bob") (text-field {:class "foo"} :name) (text-field {:class "foo"} :name "Bob") The question is how best to represent this in the argl

Re: How Do I Install New Version Of Clojure?

2012-04-15 Thread James Reeves
On 15 April 2012 15:35, Anto wrote: > Thanks for your reply! Will look into it! You'll likely want to use Clojure via Leiningen, rather than use the raw jar: https://github.com/technomancy/leiningen - James -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread James Reeves
On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant wrote: > I've been doing some thinking about the treatment of nil in a > statically typed version of Clojure. Statically typed in what way? Java's type system doesn't seem particularly suited to a functional programming language like Clojure. - J

Re: Treatment of nil/null in a statically typed Clojure

2012-04-21 Thread James Reeves
On 20 April 2012 01:43, Alan Malloy wrote: > On Apr 19, 4:06 pm, James Reeves wrote: >> On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant >> >> wrote: >> > I've been doing some thinking about the treatment of nil in a >> > statically typed version of

Re: Defining custom tags using hiccup ?

2012-05-12 Thread James Reeves
On 12 May 2012 17:12, Murtaza Husain wrote: > Instead of that if it allowed an extensible compiler with the same macro > defelem, I could call - > > [:link-to {:url "http://google.com"} "Hi this is google"] > > Will that not be more clojurey :) That seems more complicated, IMO. Why require an cus

Re: (#({:a %}) :b)

2012-06-03 Thread James Reeves
On 4 June 2012 03:00, Bill Caputo wrote: > Someone with more knowledge than me can probably explain better, but my > understanding is that the the reader macro shorthand for anonymous functions > and the map literal syntax can't both be used together (i.e. it's not a bug, > but a reader limitation

Re: why String is not a collection (of Character)

2012-06-07 Thread James Reeves
On 7 June 2012 07:03, Andy Coolware wrote: > So my questions is as in subject. I did a bit of research but could not find > a good answer. Because otherwise Clojure wouldn't be compatible with Java APIs. It would also probably be slower than using the native String class. - James -- You receiv

Re: POST not working with compojure 1.1.0 and ring-jetty-adapter 1.1.0

2012-07-07 Thread James Reeves
On 7 July 2012 23:24, ArturoH wrote: > I'm not sure that I am having a version problem but this very simple example > does not work for me. I get the POST form but when I subit the POST back I > do not see the variable content just a simple "The message was ::". I run it > with "lein run". Any hel

ANN: Ragtime 0.3.0

2012-09-04 Thread James Reeves
I've recently released Ragtime 0.3.0, a library for managing migrations. I've been working on it on-and-off for a while, and it's now ready for more general use. Ragtime abstracts migrations in the same way that Ring abstracts web applications. Ragtime doesn't specify how migrations are generated

<    4   5   6   7   8   9   10   >