Re: com.stuartsierra/component & ring/compojure example

2014-10-07 Thread gaz jones
Here is a toy app that downloads nzbs from usenet: https://github.com/gar3thjon3s/leacher It's not documented, but it works. The component stuff is hooked up here: https://github.com/gar3thjon3s/leacher/blob/master/src/clj/leacher/main.clj#L53 On 7 October 2014 12:33, JPatrick Davenport wrot

Re: How did you learn Clojure?

2014-03-26 Thread gaz jones
A technique I use whenever I need to learn a new language is to write the same application I already have in another language. I generally choose downloading nzbs from usenet as it can involve a number of interesting programming techniques, at least enough to give you a pretty good idea of how a l

Re: Contributors needed for Rouge (Clojure on Ruby)

2014-01-04 Thread gaz jones
Why not just use Ruby or (my preference) Python? Both are great for quick CLI apps / scripts. Best tool for the job, and all that? On Sat, Jan 4, 2014 at 8:43 AM, gvim wrote: > I have recently moved most of my work to Clojure and Clojurescript but > neither of these implementations seem suitabl

Re: is there a tutorial about working at the REPL?

2013-12-29 Thread gaz jones
There are at least some keyboard shortcuts you should be familiar with for loading / compiling namespaces. Look a the "Using the REPL" section of this: http://clojure-doc.org/articles/tutorials/emacs.html On Sat, Dec 28, 2013 at 7:38 PM, larry google groups < lawrencecloj...@gmail.com> wrote: >

Re: T-shirts?

2013-11-25 Thread gaz jones
This shirt appears to be complecting fashion, programming, AND advertising. On Mon, Nov 25, 2013 at 11:17 AM, Laurent PETIT wrote: > Hey Bruce, > > 2013/11/25 Bruce Durling : > > Yay! Thanks Rich! > > > > Good picture of you. Have you been working out before taking those > > shots in the t-shirt

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-11-20 Thread gaz jones
Hey guns, Yeah sounds good, I don't have admin access to add you as a developer so will ask on the clojure-dev mailing list to see who can do it and cc you on that. Cheers, Gaz On Wed, Nov 20, 2013 at 6:40 PM, guns wrote: > On Wed 20 Nov 2013 at 06:32:49PM -0600, guns wrote: > > The formattin

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread gaz jones
Whoops, sorry looks like my intended light-hearted sarcasm based on one of the email signatures in the thread got mis-interpreted. Hard to express in an email, perhaps a cheeky :P after would have let you know I wasn't being particularly serious! No offense intended, or taken :) On Tue, Nov 19,

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread gaz jones
"Because there is no patch for human stupidity"? On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield wrote: > On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh wrote: > > Additionally I have > > copied some useful functions like parsing dbspec to URI or a map of > > protocol->cases > > and the rest are

Re: [Job spam] Write Clojure in your pajamas, for decent money in a pleasant company, remote pairing all the time

2013-11-18 Thread gaz jones
*your :) On Mon, Nov 18, 2013 at 9:46 PM, gaz jones wrote: > If you're account had a picture like his, YES. > > > On Mon, Nov 18, 2013 at 5:45 PM, Tony Tam wrote: > >> Hi, >> >> I'm always curious about remarks like this: >> >> >&

Re: [Job spam] Write Clojure in your pajamas, for decent money in a pleasant company, remote pairing all the time

2013-11-18 Thread gaz jones
If you're account had a picture like his, YES. On Mon, Nov 18, 2013 at 5:45 PM, Tony Tam wrote: > Hi, > > I'm always curious about remarks like this: > > > A link to your Github profile counts for much more than a stellar resume. >> Doesn't have to be in Clojure. >> > > If I sent you a like to

Re: Do web apps need Clojure?

2013-11-14 Thread gaz jones
There is no reason not to consider using a combination of both technologies. I have found Clojure is excellent for writing http services (for example sending/receiving JSON), but is a bit weak in comparison to say the combination of ruby and haml for building UIs quickly. On Thu, Nov 14, 2013 at

Re: How to go about 'proving' why dynamically typed languages are better

2013-10-07 Thread gaz jones
Martin Odersky gave a keynote at Strangeloop this year called "The Trouble With Types" (https://thestrangeloop.com/sessions/the-trouble-with-types) which made me never want to use a type system again (probably the exact opposite of his intention). The video should be coming out on infoq at some poi

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-08-25 Thread gaz jones
Hey, i am the current maintainer of tools.cli - i have very little time to make any changes to it at the moment (kids :) ). I'm not sure what the process is for adding you as a developer or transferring ownership etc but if I'm happy to do so as I have no further plans for working on it. Thanks, G

Re: Wrapping LevelDB with ring/compojure app

2013-07-19 Thread gaz jones
Instead of using the var #'web/app in run-jetty, use a function that takes your main-db as an argument and returns the routes for your app. You can use the compojure.core/routes to build your app routes rather than using a global var. On Fri, Jul 19, 2013 at 3:42 AM, Tarik Ansari wrote: > Hello

Re: run-jetty not working in a virtualbox vm?

2013-07-12 Thread gaz jones
Just to check - you have set ":join? false" so the thread will not block until the server ends - are you doing this intentionally and blocking the thread elsewhere? On Fri, Jul 12, 2013 at 8:45 PM, Daniel Higginbotham wrote: > I'm trying to start a jetty server on a virtualbox vm (ubuntu 12.04

Re: parsing xml with zip, xml and clojure.data.zip

2013-06-05 Thread gaz jones
This may help: http://clojure-doc.org/articles/tutorials/parsing_xml_with_zippers.html On Wed, Jun 5, 2013 at 9:54 AM, Ryan Moore wrote: > Hi, I've read http://nakkaya.com/2009/12/07/zipping-xml-with-clojure/ and > http://stackoverflow.com/questions/1194044/clojure-xml-parsing/9595315#comment2

Re: optional first map argument

2013-06-03 Thread gaz jones
You could look at the impl: https://github.com/weavejester/hiccup/blob/master/src/hiccup/def.clj On Mon, Jun 3, 2013 at 12:22 PM, Alice wrote: > I often need to do this when writing hiccup helper functions: > > (defn my-widget > [& args] > (let [attrs(if (map? (first args)) (first args

Re: Beginners question - emacs & compiling tests

2013-05-31 Thread gaz jones
The 'parse-args' function needs to be inside of the 'core.clj' file, not the 'core_test.clj' file - is that the case? (The reason it is failing is the first usage of 'parse-args' is before it has been defined). On Fri, May 31, 2013 at 1:31 AM, Adam Getchell wrote: > > > On Tuesday, March 19, 201

Re: Local database recommendation?

2013-05-27 Thread gaz jones
Sqlite is worth a look. Never used it with the JVM, but I assume there is a JDBC driver for it. On Mon, May 27, 2013 at 1:01 AM, Zack Maril wrote: > Use postgres. If it makes sense later on, then try a nosql solution. Until > then, postgres will probably do 95% of what you want out of the box.

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread gaz jones
I think I would use a macro: (defn with-bloomy-fn [bloomy body] (try (body) (finally (shut-down bloomy (defmacro with-bloomy [bloomy & body] `(with-bloomy-fn ~bloomy (fn [] ~@body))) (deftest my-test (with-bloomy (create-a-bloomy) (...)) FYI code is untested, typing str

Re: Clojure Login form error: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom

2013-05-02 Thread gaz jones
>> Does the projects look like the work of someone that is an utter moron ... your response certainly is. On Thu, May 2, 2013 at 10:28 AM, Jay Fields wrote: > On Thursday, May 2, 2013 10:19:51 AM UTC-4, David Toomey wrote: > >> >> [snipped] > > > If you want help in the future, I'd recommend s

Re: Do functions never get inlined by jvm?

2013-04-25 Thread gaz jones
There seems to be some rule that given sufficient time and enough participants, all threads deteriorate into an argument about the current state of clojure documentation and a huge post from Tim Daly regarding literate programming in 3...2...1... On Thu, Apr 25, 2013 at 2:23 PM, Gary Trakhman wro

Re: Clojure/West 2013 videos?

2013-03-28 Thread gaz jones
I'm starting to miss Ken Wesson. On Mon, Mar 25, 2013 at 4:08 PM, Gary Trakhman wrote: > I've volunteered on the pycon AV team, in 2009, it's 1000x more work than > what you described further up in the thread, a minimum wage worker holding > something steady. It requires a lot of coordination,

Re: Find union of nodes with data.zip

2012-11-05 Thread gaz jones
you're right, my bad. should have read it more carefully :) On Mon, Nov 5, 2012 at 2:32 PM, Stefan Kamphausen wrote: > Hi, > > if I am doing this right, then your supposed approach does not work. From > looking at the code of seq-test (to which the alternative form using just a > vector in xml->

Re: Find union of nodes with data.zip

2012-11-05 Thread gaz jones
Looking at the source of clojure.data.zip, it looks like something like: (xml-> x :a (seq-test [(tag= :b1) (tag= :b3)]) :c) (untested) might work? http://clojure.github.com/data.zip/ On Mon, Nov 5, 2012 at 10:38 AM, Stefan Kamphausen wrote: > Hi, > > AFAIK the currently supposed way of parsin

Re: Documenting clojure data structures

2012-10-31 Thread gaz jones
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 On Wed, Oct 31, 2012 at 1:01 PM, Jason Bennett wrote: > Over the last month, I've been learning clojure for my new job, and taki

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread gaz jones
As of Clojure 1.3 you need to mark things you with to re-bind explicitly as dynamic: (defn ^:dynamic twice [x] ...) On Tue, Oct 30, 2012 at 7:42 PM, Satoru Logic wrote: > Hi, all. > > I am reading Clojure in Action. > > In the "scope" section of Chapter3, there are examples like this: > > def

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-25 Thread gaz jones
Look in who-is-logged-in.core for errors On Thu, Oct 25, 2012 at 1:36 PM, larry google groups wrote: > who-is-logged-in.core -- 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 post

ANN expectations-mode 0.0.3

2012-10-24 Thread gaz jones
Hi, expectations-mode is an Emacs mode for running tests written using the expectations library: https://github.com/jaycfields/expectations. I have just released expectations-mode 0.0.3 which now runs under nrepl (no longer supports swank-clojure). It is in marmalade: http://marmalade-repo.org/pac

Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-11 Thread gaz jones
Alright, I'll convert the appropriate ones and send you a pull request when I'm done. I'm happy to pick up writing a tools.cli tutorial too when I get some spare time. Thanks for kickstarting the effort, it's shaping up to be a great resource. -- You received this message because you are subscrib

Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-11 Thread gaz jones
I have 3 blog posts I wrote to help some colleagues get up to speed with clojure / emacs: http://blog.gaz-jones.com/2012/02/01/setting_up_emacs_for_clojure_development.html http://blog.gaz-jones.com/2012/02/02/clojure_development_cycle.html http://blog.gaz-jones.com/2012/02/03/clojure_command_line

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-10 Thread gaz jones
the old API will be > rewritten in terms of the new one for compatibility). > > Sean > > > On Tue, Oct 9, 2012 at 2:44 PM, gaz jones wrote: >> >> Can you not simply: >> >> (jdbc/with-connection db2 >> (jdbc/with-query-results results >>

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread gaz jones
Can you not simply: (jdbc/with-connection db2 (jdbc/with-query-results results query {:result-type :forward-only :fetch-size 1000} (jdbc/with-connection db1 ;; read and write? ))) ? On Tue, Oct 9, 2012 at 2:53 PM, Brian Craft wrote: > > On Tuesday, Oc

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

2012-10-07 Thread gaz jones
While on this topic, is it possible for someone with admin privileges to disable the "Issues" tabs in the contrib projects? There is a consistent drip of people sending pull requests or opening bugs which have to be redirected to JIRA. All of the contrib projects now point to JIRA in the README for

Re: Handling exceptions (subject renamed)

2012-10-05 Thread gaz jones
http://clojure.github.com/clojure/clojure.stacktrace-api.html On Fri, Oct 5, 2012 at 12:06 PM, Matt wrote: > Hi, > > Sorry to anyone who read the original post. > Apparently I had malformed the try block encompassing the create-table in a > very non-clojure-ish way. > So my problem wasn't with cl

Re: Noir.response and custom java object

2012-10-04 Thread gaz jones
It seems to be using cheshire under the covers, did you add an encoder for your class? e.g: (add-encoder java.awt.Color (fn [c jsonGenerator] (.writeString jsonGenerator (str c On Thu, Oct 4, 2012 at 12:04 PM, arekanderu wrote: > Hello, > > I am not sure if i am supposed to ask a

Re: Clojure web framework

2012-10-03 Thread gaz jones
You do not need noir to create a simple json api, just use compojure. I find the Cheshire json library to also be useful: https://github.com/dakrone/cheshire. Authentication and authorization libs were pretty much up to you until https://github.com/cemerick/friend was released fairly recently, so y

Re: Transforming an ugly nested loop into clojure code

2012-10-01 Thread gaz jones
You appear to be running over the map purely for side-effects, therefore off the top of my head something like: (defn my-func [data] (doseq [area data warehouse (:warehouses area) container (:containers warehouse) box (:boxes container)] (if-not (empty? (:item

Re: how do I evaluate this lazy sequence?

2012-09-27 Thread gaz jones
Couple of initial things, Clojure has immutable data structures so when you call for example 'assoc' it will return you a new map with the new values assoc'd. It will not mutate the original, so: (let [foo {}] (assoc foo :a 1) (assoc foo :b 2) foo) Will return {}. You need to do something l

Re: JSON serialization with unknown types

2012-09-26 Thread gaz jones
you might find this useful: https://github.com/dakrone/cheshire you can pretty much swap it in for data.json IIRC and it has nice support for custom encodings, amongst other things. On Wed, Sep 26, 2012 at 12:39 PM, Robert Beaupre wrote: > Hi there, > I am wondering what the best/recommended wa

Re: Lazy sequences to replace looping?

2012-09-12 Thread gaz jones
You may find this useful: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ loop-recur might be the best way to do it. On Tue, Sep 11, 2012 at 11:16 PM, Geo wrote: > Hello, > > I am just getting started with Clojure and I had a question. I have to > following code: > > (get-r

Re: Question: Looking at Noir code - hey, are those singletons?

2012-09-12 Thread gaz jones
I find myself having to make similar choices quite often in my own Clojure code - do I create perhaps a map of things that represent some kind of 'state' and pass that around to each function that needs it, or do I do what has been done above and create some vars in a ns where most (all?) the funct

Re: Routing HTTP/ JSON in clojure

2012-09-04 Thread gaz jones
We do all of the things you mention (minus the replay, but that would be trivial) in Clojure where I work, and it is remarkably easy. We use: * ring + compojure and an embedded jetty server to create lightweight webservers * the Cheshire JSON encoding/decoding library for all JSON purposes (https:

Re: clojure.org/getting_started: not up to date

2012-09-03 Thread gaz jones
I've been playing with Go a lot recently, and I have found the documentation / new user experience very good: http://golang.org/ On Mon, Sep 3, 2012 at 2:19 PM, Denis Labaye wrote: > > > On Mon, Sep 3, 2012 at 5:40 PM, Softaddicts > wrote: >> >> Btwy, using leiningen's repl hides all these i

Re: Origin of tools.cli optional

2012-08-24 Thread gaz jones
The library was originally based on Clargon (a library I wrote) which had the interface you are describing (optional and required functions). Various changes were made after getting feedback on the clojure-dev mailing list, which you can read about here if you're interested: https://groups.google.

Re: A succinct & reasonably fast sudoku solver in core.logic

2012-07-31 Thread gaz jones
Wow, that's pretty nice. On Tue, Jul 31, 2012 at 8:07 AM, David Nolen wrote: > Ever since I read Norvig's cool Python solution, > http://norvig.com/sudoku.html, I've been wanting to see if this could be > done in core.logic without sacrificing generality. Now that we have cKanren > extensions in

Re: is their a Clojure framework for handling form validation?

2012-07-23 Thread gaz jones
https://github.com/mikejones/mississippi again, not specific to web forms. works on clojure maps and is extensible. On Sun, Jul 22, 2012 at 6:46 PM, larry google groups wrote: > Since 2000 I've been doing web development, first with PHP and then with > Ruby On Rails. In the world of PHP, there a

Re: ANN: ClojureScript Synonyms

2012-04-23 Thread gaz jones
cheers! :D On Mon, Apr 23, 2012 at 4:20 PM, David Nolen wrote: > I've added links to Himera in the ClojureScript GitHub README > > On Mon, Apr 23, 2012 at 5:18 PM, gaz jones wrote: >> >> this page is amazing: >> >> http://himera.herokuapp.com/synonym

Re: ANN: ClojureScript Synonyms

2012-04-23 Thread gaz jones
this page is amazing: http://himera.herokuapp.com/synonym.html this should be part of the standard docs for clojurescript - or am i just blind and cannot find it? it would have saved me so much time *sob* On Mon, Apr 23, 2012 at 3:45 PM, David Nolen wrote: > http://himera.herokuapp.com/synonym.

ANN expectations-mode 0.0.2

2012-04-21 Thread gaz jones
Hey, I use the expectations testing framework a fair amount at work, so created an emacs minor mode for running the tests ala clojure-test-mode. It is based on clojure-test-mode so has many of the same keybindings: https://github.com/gar3thjon3s/expectations-mode/tree/0.0.2 I had to update expec

Re: Newbie question about rebinding local variables

2012-04-19 Thread gaz jones
to answer your question directly, you would need to do something like this to make it work the way your example is set up: (defn new-game [] (let [board (atom (into [] (repeat 9 nil)))] (fn [n & [i]] (cond (= n :x) (swap! board assoc i 'x) (= n :o) (swap! board assoc i 'o

ANN: Mississippi 1.0.0 - validating maps

2012-04-07 Thread gaz jones
Hey, Both myself and my brother do a fair amount of validating maps of data in our day jobs (EXCITE!) so we put together a library a while ago to help out. We just got round to releasing 1.0.0 recently so thought I would announce it here in case anyone else is interested: https://github.com/mikej

Re: Polymorphic namespaces?

2012-03-28 Thread gaz jones
I would ask why you would want to do dependency injection? If it is to swap out functions for testing, just use 'with-redefs'. I have personally found it (DI) completely unnecessary... On Wed, Mar 28, 2012 at 1:13 PM, Chris McBride wrote: > I was wondering how dependency injection is done in Cloj

Re: Creating map from string

2012-03-18 Thread gaz jones
argh i come back to paste in my answer and you beat me to it :( i was gonna say: (let [s ""@key1 this is a value @another-key and another value @test1 and other value""] (reduce (fn [m [_ k v]] (assoc m k (string/trim v))) {} (re-seq #"(@[\w-]+)([^@]*)" s))) much the same... On Sun, Mar 18

Re: Bret Victor - Inventing on Principle

2012-02-24 Thread gaz jones
IF IT WASNT FOR THOSE MEDDLING KIDS!! On Fri, Feb 24, 2012 at 1:12 PM, Cedric Greevey wrote: > On Fri, Feb 24, 2012 at 2:06 PM, gaz jones wrote: >> Are you Ken Wesson with a new account? > > Who? > > Wait. Surely you don't think that it's not possible for more than

Re: Bret Victor - Inventing on Principle

2012-02-24 Thread gaz jones
Are you Ken Wesson with a new account? On Fri, Feb 24, 2012 at 1:00 PM, Cedric Greevey wrote: > On Fri, Feb 24, 2012 at 1:29 PM, Damien Lepage wrote: >> Hi Everyone, >> >> You may have seen this already, if not I believe it's worth investing 1h of >> your life: >> http://vimeo.com/36579366 >> >>

Re: Emacs: Optimize Imports?

2012-01-01 Thread gaz jones
I believe this might be what close to what you are looking for: https://github.com/technomancy/slamhound On Sun, Jan 1, 2012 at 1:03 PM, Daniel Glauser wrote: > Hello folks, > > Does anyone know a way with Emacs/Leiningen/Slime/Swank to ask the > system to optimize the imports?  I'm looking for

Re: How to "print" to stdout from the repl without a nil at the end?

2011-12-30 Thread gaz jones
> Yes - I do get the result of the print function in the repl (i.e. nil), and > I'm trying to see how I can somehow prevent that nil from printing to stdout. Yeah, the point I was making is that you are always going to see that 'nil' printed at the repl because it always evaluates and prints the

Re: How to "print" to stdout from the repl without a nil at the end?

2011-12-30 Thread gaz jones
are you sure you're not just seeing the result of the function call in the repl? for example this: (ns filter.core (:require [clojure.string :as string]) (:gen-class)) (defn -main [& args] (loop [] (when-let [line (read-line)] (println (string/upper-case line)) (recur

Re: Implementing a clojure-only periodic timer...

2011-12-01 Thread gaz jones
Hey Bill, I would have thought you would have to have a pretty good reason for not using an executor for this? (let [executor (Executors/newSingleThreadScheduledExecutor)] (.scheduleAtFixedRate executor your-func 0 3 TimeUnit/SECONDS)) On Thu, Dec 1, 2011 at 11:17 AM, Bill Caputo wrote: > Hi A

Re: The Clojure way to solve this problem?

2011-11-30 Thread gaz jones
what about just re-defing the function inside the tests to the instrumented version? something like: (ns one.http) (defn get [] ...) (ns one.http-instrumented) (defn get [] ...) (ns one.test.blah) (with-redefs [one.http/get one.http-instrumented/get] ...) guess you could put the redefs into

Re: A few questions on how to do things in more idiomatic ways

2011-11-21 Thread gaz jones
off top of my head i would probably do something like: 1. (-> some-var (assoc :foo "bar") other-operation and-another) (see threading macros) 2. (update-in some-map [:entry] #(or % (get-new-value))) in particular, im not sure if there is a more idiomatic way On Mon,

Re: get all record instances

2011-11-05 Thread gaz jones
could you not just use a map? (def sources {:bbc "bbc.co.uk" :google "google.com" ...}) On Sat, Nov 5, 2011 at 6:14 AM, Mark Derricutt wrote: > Would something like: > (def ^:dynamic *SOURCES* (ref [])) > (defrecord Source [name url]) > (defmacro defsource [name url] >   `(dosync (alter *SOURCE

ANN tools.cli 0.2.1

2011-11-03 Thread gaz jones
Changes in 0.2.1 (should make it to maven central soon): * :required option no longer supported, caused issues when trying to provide your own --help and you have other parameters that are "required". You must now validate your own required parameters, eg: (let [[options args banner] (cli [] ["-

Re: Please announce release & breaking API changes of libraries hosted at github.com/clojure on this mailing list

2011-11-01 Thread gaz jones
Just to clarify.. no I'm not. On Tue, Nov 1, 2011 at 2:52 PM, gaz jones wrote: > Hey dude, as I mentioned in the git link you pointed at there... > apologies for any confusion. The intent was always to make an > announcement WRT the breaking changes. I think you just caught me in &

Re: Please announce release & breaking API changes of libraries hosted at github.com/clojure on this mailing list

2011-11-01 Thread gaz jones
Hey dude, as I mentioned in the git link you pointed at there... apologies for any confusion. The intent was always to make an announcement WRT the breaking changes. I think you just caught me in the middle of the "merging the changes into master and getting a release cut" process. I am not making

update to clojure.tools.cli

2011-11-01 Thread gaz jones
Hi, I have made some changes to tools.cli to fix an annoying bug arround boolean flags and the inability to collect 'trailing arguments'. Whilst gathering opinions on these changes, a few other suggestions were made such as removing all magic functions and System/exit calls. The update is therefor

Re: {ANN} clojure-control 0.2.1 released.

2011-10-31 Thread gaz jones
thanks for sharing, this looks extremely useful. On Mon, Oct 31, 2011 at 11:43 AM, dennis wrote: > Clojure-control is a clojure DSL for system admin and deployment with > many remote machines via ssh/rsync.It is on github: > https://github.com/killme2008/clojure-control > > 0.2.1 has been release

Re: trouble setting up emacs

2011-10-24 Thread gaz jones
some kind soul gave me this on the mailing list a while ago, works for me: ;; fix the PATH variable (defun set-exec-path-from-shell-PATH () (let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'"))) (setenv "PATH" path-from-shell) (setq exec-path (split-string path-fr

Re: Rounding the edges of an Emacs beginner

2011-09-15 Thread gaz jones
M-{ and M-} in emacs go forward/backwards a paragraph. when in code, this often translates well to moving around between fragments/functions etc. you also have C-v and M-v for forward/backward a page and then C-l for centering on the current line. i use all of those a lot... On Thu, Sep 15, 2011 a

Re: Please optimize this with macro (grep and context result grabing)

2011-08-26 Thread gaz jones
do you know about the re-groups function, or are you just doing this for an exercise? On Fri, Aug 26, 2011 at 6:57 PM, Michael Jaaka wrote: > Hi! > > I have got > > (def *g) > (def *g1) > (def *g2) > (def *g3) > (def *g4) > (def *g5) > (def *g6) > > (defmacro grep[ pat in & body ] >        `(do (

Re: clojure.java.jdbc: mapping BigDecimal to double

2011-08-23 Thread gaz jones
the oracle jdbc adapter returns a whole host of strange datatypes. for instance, it returns bigdecimals for numbers you have mapped to be numbers (with a precision, without a scale) in the table. it also returns its own custom time classes. these generally have a toJdbc() method to convert them to

Re: clojure.contrib.command-line

2011-07-29 Thread gaz jones
> Well, README and tests are very good. > I withdrew into REPL and overlooked them stupidly. I'm very sorry. > no worries, glad they help. > BTW some functions seems not to be public API though they are public. > Why they are not separated by defn- or specific namespace like > clojure.tools.cli.i

Re: clojure.contrib.command-line

2011-07-29 Thread gaz jones
it lives on github: http://github.com/clojure/tools.cli like all the new contrib libs, to use it in a project you need to add it to your dependencies: :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/tools.cli "0.1.0"]] On Fri, Jul 29, 2011 at 7:56 AM, octopusgrabb

Re: clojure.contrib.command-line

2011-07-28 Thread gaz jones
are there any scenarios in particular you feel need more documentation? im happy to add more if it is lacking. hopefully the README on the project page and tests provide a pretty good idea of what options are available: https://github.com/clojure/tools.cli https://github.com/clojure/tools.cli/blob

Re: Digest for clojure@googlegroups.com - 14 Messages in 9 Topics

2011-07-28 Thread gaz jones
;s it. > > I think most JVM users know or can quickly figure out how to take jars and > put them in their project's classpath. It's simple to do with all IDEs (or > without one) and there is no need to learn or install additional software or > edit configuration files. Starter s

Re: Libraries and build management hell

2011-07-28 Thread gaz jones
i would agree with all that if i were writing plain java (a lib dir for dependencies and a couple of shell scripts for building etc), but leiningen makes it so easy for clojure that its more work _not_ to use it... at least that has been my experience. On Thu, Jul 28, 2011 at 4:23 PM, Michal B wr

Re: The Last Programming Language

2011-07-19 Thread gaz jones
this made me lol :D a big will smith fan??? not that i know you at all other than reading your posts here, but i really didnt see that coming... On Tue, Jul 19, 2011 at 9:11 AM, Ken Wesson wrote: > An hour of Will Smith blasting aliens "flies by". An hour of a talking > head is better presented a

Re: ClassCastException on 'clojure.data.json/print-json'

2011-06-28 Thread gaz jones
are you trying to turn something into a json string? if so, the json-str function is probably what you are looking for: user> (json/json-str {:a "b"}) "{\"a\":\"b\"}" by the way, the nil in your previous email is not being suffixed to the string, its simply the return of the function getting writ

Re: Mocking framework

2011-06-28 Thread gaz jones
jay fields has a good blog post on this: http://blog.jayfields.com/2010/09/clojure-mocking.html On Tue, Jun 28, 2011 at 2:52 AM, Ola Ellnestam wrote: > Hi Erik, > > Take a closer look at Midje, especially > https://github.com/marick/Midje/wiki/Metaconstants > > I'm not an subject matter expert b

Re: Radically simplified Emacs and SLIME setup

2011-06-23 Thread gaz jones
2011 at 11:20 AM, gaz jones > wrote: >> >> this is really great, thanks for putting this together. >> >> i have a (possibly daft) question -- is there a neat way to >> kill/restart the underlying process. i have looked for a *ahem* >> clojure-jack-off functio

Re: Radically simplified Emacs and SLIME setup

2011-06-23 Thread gaz jones
this is really great, thanks for putting this together. i have a (possibly daft) question -- is there a neat way to kill/restart the underlying process. i have looked for a *ahem* clojure-jack-off function or equivalent but couldnt find one in the source. i am just killing it from the terminal at

Re: A stupid jvm question

2011-06-17 Thread gaz jones
this page explains a bunch of ways of calling jruby from java: https://github.com/jruby/jruby/wiki/RedBridge think i would have to have pretty good reason before doing this (like wanting to use jruby as a user scripting language in a clojure app maybe)... On Fri, Jun 17, 2011 at 11:08 AM, Phil H

Re: Wisdom sought for functional iterative processing

2011-06-13 Thread gaz jones
if i was writing the java i would probably do a "tell dont ask" refactoring so that the operations had an applyTo method: List items = initialItems (); for (Op op : operations) { op.applyTo(items); } not sure what your op data structure is, but i would image you could translate that to the clo

Re: Compojure: How to process GET query string

2011-05-18 Thread gaz jones
query string params appear in the params of the request: (GET "/math" {params :params} [] (get params :a) ;; 1 (get params :b) ;; 2 ... etc they will be keywords as above if you are using the wrap-keyword-params handler, otherwise strings. the syntax you are using above is for pulling valu

Re: Reading clojure code of larger domain specific projects

2011-05-09 Thread gaz jones
compojure is often put forward as an example of good idiomatic clojure code: https://github.com/weavejester/compojure On Mon, May 9, 2011 at 10:55 AM, Meikel Brandmeyer wrote: > Hi, > > Am 09.05.2011 um 17:36 schrieb Jonathan Fischer Friberg: > >> I'm interested! >> >> The clojure source code is

Re: Any best practices for clojure + java mixed language projects?

2011-05-01 Thread gaz jones
you can set the source path in leiningen to be whatever you like. the sample file is quite useful for finding these things out: https://github.com/technomancy/leiningen/blob/master/sample.project.clj they key is :source-path. there is also a :java-source-path. cant say i have ever used that, but

Re: Enhancement for contrib.command-line

2011-04-29 Thread gaz jones
i wrote a command line arg library after wanting a bit more than the one in contrib gave me: https://github.com/gar3thjon3s/clargon i think you could do what you want using it... On Fri, Apr 29, 2011 at 12:26 PM, Sean Corfield wrote: > Just an FYI. As part of the 1.3.0 release, the contrib libr

Re: (just) emacs mode

2011-04-27 Thread gaz jones
i highly recommend taking a look at Phil Hagelberg's emacs-starter-kit : https://github.com/technomancy/emacs-starter-kit.git it helped me a LOT when getting started with emacs in general, and emacs and clojure together. i also put together a couple of blog posts on my experience of using it whic

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread gaz jones
this looks awesome, tried it out on a project i have but sadly got the exception below. i'll try and figure it out later when i have more time to see if its something specific to my project, but thought i would let you know in case it is something obvious (it failed from both slime and lein) Excep

Re: Executing Future

2011-04-25 Thread gaz jones
the easiest way (i find) to test if something occurring on another thread has completed is using a latch: (deftest mohanr (let [latch (CountDownLatch. 1) service (Executors/newFixedThreadPool 10)] (doseq [x (range 1) :let [f (.submit service (

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

2011-04-14 Thread gaz jones
coincidentally, me and my brother wrote this while on the train to rubyconf last year: https://github.com/mikejones/mississippi havent put any docs or anything on there (its only a couple of functions), but is essentially a validation function that take a map (the thing to validate) and another m

Re: Tranforming an ACL file: Comparing Clojure with Ruby

2011-03-03 Thread gaz jones
i was gonna suggest this: (let [users (->> (split (slurp "acl") #"\n") (map #(split % #"\|")) (map (fn [[a u p]] [a (split u #",") p])) (filter (fn [[a _ _]] (= "avail" a))) (mapcat (fn [[_ users path]]

Re: Sorting of function definitions in namespaces

2011-02-11 Thread gaz jones
>> Well... It is Robert C. Martin's opinion. >Who? 'uncle' bob martin: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 Also, it's pretty easy to just reverse the level of abstraction ordering from bottom-to-top is it not? I usually jump to the bottom of the file to

Re: Why won't leiningen install for me?

2011-01-24 Thread gaz jones
i would totally recommend uninstalling macports, and moving over to homebrew which is far better (https://github.com/mxcl/homebrew). On Mon, Jan 24, 2011 at 8:44 PM, Alex Osborne wrote: > Hi Larry, > > As a quick temporary workaround you could just set your PATH environment > variable so that it

Re: Why won't leiningen install for me?

2011-01-22 Thread gaz jones
are you sure you dont have curl installed by macports or something? /usr/bin/curl on mac os x works fine with https for me... someone at work had this problem and they had (unknowingly) installed curl through macports... On Sat, Jan 22, 2011 at 1:28 PM, Bizics wrote: > Hi Larry, > I had problems

Re: Problem with lazy-seq and heap space overflow

2011-01-20 Thread gaz jones
interesting... the changes i suggested cause it to get the first 3 values in around 300ms on my machine and dont blow the heap O_o On Thu, Jan 20, 2011 at 8:38 PM, Ken Wesson wrote: > My suspicion is that > > (lazy-seq ... (map rest seqs)) > > in closing over seqs causes the heads of the seqs to

Re: Problem with lazy-seq and heap space overflow

2011-01-20 Thread gaz jones
try this: (defn equal-values [seqs] "Given a list of ascending sequences, returns a lazy sequence containing only values that exist in all of the sequences." (lazy-seq (if (empty? (first seqs)) [] (let [first-values (map first seqs)] (if (apply = first-values) (cons (fir

Re: Clojure regexs

2011-01-13 Thread gaz jones
lol oh noes! i should really stop doing this while watching 30rock... On Thu, Jan 13, 2011 at 9:38 PM, Ken Wesson wrote: > On Thu, Jan 13, 2011 at 10:22 PM, gaz jones wrote: >> bah! good catch. >> (let [[_ year month day]] (re-find date-regex line)) >> >> fixed! &

Re: Clojure regexs

2011-01-13 Thread gaz jones
bah! good catch. (let [[_ year month day]] (re-find date-regex line)) fixed! On Thu, Jan 13, 2011 at 9:03 PM, Ken Wesson wrote: > On Thu, Jan 13, 2011 at 9:54 PM, Alex Baranosky > wrote: >> I see.  So I may have to use some kind of clunky syntax instead of a nice >> $1, $2, $3 syntax.  I can ha

  1   2   >