Re: What is Clojure NOT good for?

2009-03-09 Thread Jay Fields
I've lived through this discussion for the past 3 years while writing web applications using Ruby and Rails. Here's what I've learned: - Using a language that the average stupid programmer can't understand virtually guarantees that you'll increase your success chances, since you and your team-mate

Re: Static type guy trying to convert

2009-03-11 Thread Jay Fields
On Tue, Mar 10, 2009 at 11:44 PM, e wrote: > > > My interest right now in following clojure is to learn ALL the arguments, > including his. > The problems with Jon's criticisms is that they are the same fear, uncertainty and doubt ideas that are repeated time and time again by static language ze

Re: roll call of production use?

2009-11-24 Thread Jay Fields
DRW (http://drw.com) uses Clojure for several production applications. Cheers, Jay On 23 Nov, 17:00, Raoul Duke wrote: > hi, > > i'd be interested to hear who has successfully used clojure in > production. i know of some, as some folks have been vocal; any other > interesting-but-so-far-silent u

Re: a default value for get-in?

2010-05-17 Thread Jay Fields
+1. I'd also like to see a default value in select-keys. On Mon, May 17, 2010 at 3:34 PM, braver wrote: > If get-in is to be consistent with get, it better allow to specify a > default value: > > (get-in nested-structure [k1 k2 ... kN] :default something) > > -- would it make sense to add that

Re: Simlpe style question

2010-05-19 Thread Jay Fields
Stefan, I'm not sure what the output should look like, so it's hard for me to create a tested version. However, I came up with the following code that is similar to what you've written. (defn move2ascii [i] (let [x (/ i 100) y (mod i 100)] (letfn [(row [i] (-> i (/ 8) (+ 1))) (col [i] (-> i

Re: Using Java's 'this' keyword

2010-05-23 Thread Jay Fields
I believe the error message is because there is no apply() method that takes no arguments, and (.. node getLoad apply this ) is trying to do this (in java): node.getLoad().apply().this() I think you want (.. node getLoad (apply this)) Cheers, Jay On May 23, 2010, at 4:39 PM, Timothy Washing

[job opening] DRW (http://drw.com) is looking for a Sr. Software Engineer - Clojure/JRuby

2013-06-07 Thread Jay Fields
DRW (http://drw.com) is looking for a Sr. Software Engineer - Clojure/JRuby more info: http://drw.submit4jobs.com/index.cfm?fuseaction=83084.viewjobdetail&CID=83084&JID=149069 My experience working for DRW: http://blog.jayfields.com/2013/04/year-five.html Drop me a line if you want more info.

Re: feeding leiningen a local JAR file

2013-06-08 Thread Jay Fields
David Chelimsky recently released: https://github.com/dchelimsky/lein-expand-resource-paths On Friday, June 7, 2013 10:37:46 PM UTC-4, David Williams wrote: > > Try here > > > http://nakkaya.com/2010/03/16/adding-custom-libraries-into-local-leiningen-repository/ > > > > On Wednesday, November 21,

Re: Best IDE

2013-06-08 Thread Jay Fields
I was actually thinking pretty much the same thing. About a year ago I'd never used emacs and now I've contributed to emacs-live*, expectations-mode**, etc, etc. I also have my own emacs lisp open source*** that I use for all kinds of tweaking. My favorite recent addition - I can run my app fro

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-09 Thread Jay Fields
I'd like to mention that expectations* has 0 open pull requests, 0 open issues, and is very actively maintained**. Steven, I don't want to discourage you from creating your own testing framework, I think everyone should, it's a very educational experience. I just wanted to be clear that no one

Re: Refactoring tools

2013-06-09 Thread Jay Fields
nrepl has macroexpansion, so you can already have 1/2 of what you want - better than nothing. On Friday, March 22, 2013 9:42:10 PM UTC-4, Alex Baranosky wrote: > > I'd really like to see a way to factor to code that uses ->/->> and back > again. > > On Fri, Mar 22, 2013 at 12:01 PM, Laurent PETI

Re: Refactoring tools

2013-06-09 Thread Jay Fields
I've written the 2nd one in emacs lisp, the first one would be even easier. If you're using emacs, you should give it a shot, it was a great learning experience for me. On Friday, March 22, 2013 10:54:36 PM UTC-4, Russell Mull wrote: > > I find myself doing that a lot by hand, a tool to help wou

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-09 Thread Jay Fields
On Sunday, June 9, 2013 8:50:46 PM UTC-4, Steven Degutis wrote: > But that's what I meant, that he's proposing we start with his lib and add > extensibility in the places we want it. So my response to that still > applies. That's not at all what I said, proposed, alluded to, or anything of the

Re: Best IDE

2013-06-10 Thread Jay Fields
2013/6/8 Jay Fields > > My favorite recent addition - I can run my app from within emacs, allowing >> me to change my app with a simple C-x C-e and see my changes immediately in >> the running app (no restart, refresh or reload necessary). > > > Would you mind to

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Jay Fields
On Tuesday, June 11, 2013 12:39:59 AM UTC-4, Steven Degutis wrote: > It's pretty frustrating that I, a regular old Clojure user who likes > writing tests, can't mix and match tools from existing testing libraries. > Seriously, there's 4 major ones (clojure.test, speclj, midje, expectations) > a

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Jay Fields
On Tuesday, June 11, 2013 11:11:23 AM UTC-4, Steven Degutis wrote: > Jay, > > [elided] > That's the issue I'm trying to solve. Maybe that's not what everyone sees > in this. But this is the big win I see in it. > I think that's a good goal, I think you should stick to that, instead of continui

expectations documentation

2013-06-11 Thread Jay Fields
expectations* has always had a decent amount of documentation; however, it's traditionally been in the form of blog entries. I spent a bit of time and converted those entries into the following site: http://jayfields.com/expectations/index.html If you've never looked at expectations and you'd lik

Re: expectations documentation

2013-06-11 Thread Jay Fields
No worries. It's been on my todo list for awhile, and confusion about features motivated the actual effort. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new me

Re: expectations documentation

2013-06-11 Thread Jay Fields
o all the > documentation. The bottom two > also overlap the "isn't github fun" links. > > Haven't seen expectations before. Looks really nice. > > Phil > > From: clo...@googlegroups.com > [clo...@googl

Re: expectations documentation

2013-06-12 Thread Jay Fields
On Tuesday, June 11, 2013 2:39:33 PM UTC-4, Jay Fields wrote: > expectations* has always had a decent amount of documentation; however, > it's traditionally been in the form of blog entries. > > I spent a bit of time and converted those entries into the following site: >

Re: Clojure in production

2013-06-13 Thread Jay Fields
On Monday, June 10, 2013 5:47:25 PM UTC-4, Plinio Balduino wrote: > Hi there > > I'm writing a talk about Clojure in the real world and I would like to > know, if possible, which companies are using Clojure for production or > to make internal tools. > I've previously written about adopting C

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Jay Fields
I use update-vals from https://github.com/jaycfields/jry fairly often. As long as you don't mind doing the pred check in the fn you pass to update-vals, it should do the trick. Cheers, Jay On Fri, Jul 5, 2013 at 5:14 PM, Jim - FooBar(); wrote: > You'll never really 'replace' any values so why n

Re: test run startup time

2013-07-10 Thread Jay Fields
There are significantly more productive ways to work, but they'll require you to know your environment well. I work in emacs with 2 repls running - 1 for running my app and 1 for running my tests. I use emacs-live[1], the unplugged-pack[2], & expectations[3] for my tests. In emacs 'switch projects

Re: Multiple REPLs in Emacs? (was: test run startup time

2013-07-11 Thread Jay Fields
On Thu, Jul 11, 2013 at 5:53 PM, Sean Corfield wrote: > On Wed, Jul 10, 2013 at 10:53 AM, Jay Fields wrote: > > I work in emacs with 2 repls running - 1 for running my app and 1 for > > running my tests. > > What is the magic to get this working and how does Emacs / nrepl.el

Re: Comma separated String values from vector

2013-07-16 Thread Jay Fields
this seems to do what you want: (clojure.string/join ", " (map pr-str my-strings)) On Tue, Jul 16, 2013 at 10:17 AM, Cedric Greevey wrote: > (apply str "\"" (interpose "\", \"" my-strings) "\"") might work... > > > On Tue, Jul 16, 2013 at 9:53 AM, wrote: > >> Hi All, >> >> I'm new to Clojure -

Re: Domain-specific language design books

2013-07-19 Thread Jay Fields
this is a great book: http://www.amazon.com/Domain-Specific-Languages-Addison-Wesley-Signature-Series/dp/0321712943 don't let the language selection deter you. the patterns are abstract and can easily be applied to Clojure. On Thu, Jul 18, 2013 at 4:30 PM, JvJ wrote: > Does anyone know of any

Re: Proposed change to let-> syntax

2013-07-19 Thread Jay Fields
I'm already using as-> in prod. I think the ship has sailed on convincing Rich not to include them. On Fri, Jul 19, 2013 at 5:39 AM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > I use some-> and cond-> pretty heavily... I know I'm just one dude, but I > am grateful they're in core so

Re: [ANN] verily, non-magic testing lib

2013-07-24 Thread Jay Fields
I've never spoken to Steven in anything that wasn't a public email to this list, so it wasn't me. I'm not sure who the self-proclaimed project guardians are, but I just wanted to make sure no one thought I was trying to "protect" https://github.com/jaycfields/expectations in anyway. I don't actual

Re: map from list of maps

2013-07-25 Thread Jay Fields
I use this: https://github.com/jaycfields/jry/blob/master/src/clojure/jry/set.clj#L3-L4 On Thu, Jul 25, 2013 at 5:55 PM, Brian Craft wrote: > Ah, interesting. Only works for keys that are functions. > > > On Thursday, July 25, 2013 2:48:10 PM UTC-7, Gary Trakhman wrote: > >> user> (into {} (ma

Re: Does this abstraction have any existing name?

2013-07-26 Thread Jay Fields
I defined update-vals in jry: https://github.com/jaycfields/jry/blob/master/src/clojure/jry.clj#L74-L75 It doesn't traverse nested maps, but I haven't ever needed that ability either. 1) I've never seen a name for that. 2) not in core. I'm sure it's been written 50 times in various helper libs. 3

Re: Does this abstraction have any existing name?

2013-07-26 Thread Jay Fields
ul 26, 2013 at 2:06 PM, Jay Fields wrote: > I defined update-vals in jry: > https://github.com/jaycfields/jry/blob/master/src/clojure/jry.clj#L74-L75 > > It doesn't traverse nested maps, but I haven't ever needed that ability > either. > > 1) I've never see

should contains? throw an exception on sorted maps?

2013-08-03 Thread Jay Fields
This: (contains? (sorted-map 1 2 3 4) :a) Results in this: ClassCastException java.lang.Long cannot be cast to clojure.lang.Keyword clojure.lang.Keyword.compareTo (Keyword.java:102) -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Wrong documentation of contains?

2013-08-07 Thread Jay Fields
contains? is possibly poorly named, contains-key? would probably have avoided this entire issue. That said, I'd like to see contains? return false for things where it doesn't make sense, longs, keywords, etc. For a list, it seems like converting the list to a vectoc (via vec) would be a reasonable

Re: Wrong documentation of contains?

2013-08-07 Thread Jay Fields
updating at an index. On Wed, Aug 7, 2013 at 9:45 AM, Jay Fields wrote: > that's kind of my point, you wouldn't use contains? with a list 99.99% of > the time (you probably want some), so if the perf is terrible while you're > figuring out that you want some, it doesn

Re: Do you like the Clojure syntax?

2013-08-12 Thread Jay Fields
I'll repeat something I've said publicly several times (sorry if you've previously heard it) - My first exposure to Clojure was a Stu Halloway blog post: http://thinkrelevance.com/blog/tags/java-next. At the time I was writing mostly Ruby & some Java. I remember finding Clojure syntax repulsive. D

function creation, partial or #()

2013-08-13 Thread Jay Fields
Say you have a simple function: (defn do-work [f] (f)) When you want to call do-work you need a function, let's pretend we want to use this function: (defn say-hello [n] (println "hello" n)) Which of the following solutions do you prefer? (do-work (partial say-hello "bob")) (do-work #(say-hello

Re: vec to map with consolidated vals

2013-08-17 Thread Jay Fields
Of your proposed solutions, this one (defn to-consolidated-map [parts] (->> parts (map (partial apply hash-map)) (apply merge-with +)) Is the one I thought of first and also find very readable. On Saturday, August 17, 2013, David Chelimsky wrote: > Sorry - pressed send before refreshing an

Re: function creation, partial or #()

2013-08-17 Thread Jay Fields
Thanks everyone. Seems like there's pretty solid agreement on which solution is preferred. Cheers, Jay On Saturday, August 17, 2013, David Chelimsky wrote: > On Fri, Aug 16, 2013 at 9:49 PM, Gregg Reynolds > > > wrote: > >> On Tue, Aug 13, 2013 at 1:50 PM, John D. Hume >> > 'duelin.mark...@gm

Re: function creation, partial or #()

2013-08-17 Thread Jay Fields
Sean, it sounds like you want (swap! some-a update-in [:k1 :k2] (fnil conj []) id) But that's based on some pretty limited context. On Friday, August 16, 2013, Sean Corfield wrote: > On Fri, Aug 16, 2013 at 4:32 PM, Timothy Baldridge > > > wrote: > > I'm just going to throw this out there, but

preference and implications of using as-> vs let

2013-08-19 Thread Jay Fields
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] (as-> (* x x) x-squared (if (pos? y)

Re: preference and implications of using as-> vs let

2013-08-19 Thread Jay Fields
On Mon, Aug 19, 2013 at 6:41 PM, Anand Prakash wrote: > What is the major benefit of as-> > > => (-> 4 (#(* % %)) (+ 12) ) > > 28 > > => (-> 4 (as-> y (* y y)) (+ 12)) > > 28 Solving the contrived example doesn't really help answer the original question of preference and tradeoffs. As to the bene

Re: Place of function?

2013-08-26 Thread Jay Fields
you're probably looking for fn? On Mon, Aug 26, 2013 at 9:11 AM, Christian Sperandio wrote: > Hi, > > Does anyone know why the functions like: map?, number?, vector?, … belongs to > the clojure.core but not function? ? > > Christian > > -- > -- > You received this message because you are subscr

profiler?

2013-08-27 Thread Jay Fields
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 -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: Sorting a collection on multiple fields

2013-08-31 Thread Jay Fields
I would solve it like this- (defn multi-compare [[c & cs] [x & xs] [y & ys]] (if (= x y) (multi-compare cs xs ys) (c x y))) (defn multi-comparator [comparators] (fn [xs ys] (if (= (count xs) (count ys) (count comparators)) (multi-compare comparators xs ys)

Re: Sorting a collection on multiple fields

2013-09-11 Thread Jay Fields
25} {:name "amanda" :age 19} > {:name "zack" :age 20} {:name "zack" :age 21}] > (sort-by (juxt :name :age) (compare-many [compare >]))) > > > On Saturday, 31 August 2013 17:28:45 UTC+2, Jay Fields wrote: >> >> I would solve it like

Re: reference types (var, atom, ref, agent) and add-watch: deterministic order of notification

2013-09-13 Thread Jay Fields
Watch behavior varies a bit by ref type, I believe. You'll probably want to look into the details of the specific ref type you're using. for atoms and refs, I believe the watch is done on the thread that's updating the ref. Since retries can occur you can't really count on ordering. You could crea

Re: Lessons Learned from Adopting Clojure

2014-02-04 Thread Jay Fields
On Tuesday, February 4, 2014 8:17:44 AM UTC-5, Magomimmo wrote: > thanks for the report. I only have few doubts about REPL making TDD to > shame. > In this blog entry - http://blog.jayfields.com/2014/01/repl-driven-development.html - I demonstrate (very briefly, by design) my workflow. I als

Re: Lessons Learned from Adopting Clojure

2014-02-04 Thread Jay Fields
your demo I can't determine whether the (+ 2 2) expression is > evaluated and the results pasted inline or whether you have manually pasted > them? > > I see you are using emacs, can you detail how you have configured emacs? > > > On Tuesday, 4 February 2014 16:33:44 UTC, Ja

Re: Lessons Learned from Adopting Clojure

2014-02-05 Thread Jay Fields
On Wed, Feb 5, 2014 at 4:35 PM, James Trunk wrote: > As a TDD practitioner and Expectations user, I've been following this thread > with great interest! > > @Jay: Will your change in thinking have any impact on Expectations? I don't anticipate making any changes to expectations, but it's likely t

Re: Lessons Learned from Adopting Clojure

2014-02-06 Thread Jay Fields
On Wed, Feb 5, 2014 at 10:40 PM, Sean Corfield wrote: > FWIW, I find the language of Expectations to be much better suited to > describing the desired behaviors of a system I want to build than the > assertion-based language of clojure.test - so for me it's about > test-before, not test-after. Th

expectations 2.0 has been released

2014-03-11 Thread Jay Fields
expectations is a minimilist's unit testing framework website: http://jayfields.com/expectations/ github: https://github.com/jaycfields/expectations changelog: https://github.com/jaycfields/expectations/blob/master/CHANGELOG.md some large changes that will hopefully result in even more concise a

Re: expectations 2.0 has been released

2014-03-12 Thread Jay Fields
On Wednesday, March 12, 2014 2:53:09 PM UTC-4, Sean Corfield wrote: > > Since `given` was a relatively simple macro, we added it to > worldsingles.util.test and switched all our test namespaces to refer given > from there instead, and then upgraded to Expectations 2.0.6. Seems to have > gone smo

Re: expectations 2.0 has been released

2014-03-13 Thread Jay Fields
gnal 1 error > (expect AssertionError (from-each [a ["1" "2"]] (assert (string? a ;; > shows both errors > > Ciao > > ...Jochen > > Am Mittwoch, 12. März 2014 02:28:37 UTC+1 schrieb Jay Fields: > >> expectations is a minimilist's uni

Re: expectations 2.0 has been released

2014-03-16 Thread Jay Fields
Jochen (and anyone else affected by this): Sorry, took me a few days, but I've released 2.0.7, which fixes all the bugs reported above. Cheers, Jay On Thu, Mar 13, 2014 at 6:54 AM, Jay Fields wrote: > Thanks for all the examples, I'll look today at getting these fixed up. >

Re: blog article on RSpec like TDD with a rapid feedback cycle in Clojure

2013-10-20 Thread Jay Fields
expectations has the same thing as well: https://github.com/jakemcc/lein-autoexpect I think midje, speclj, and expectations all have emacs modes as well - which completely eliminate the JVM start up issue. On Sun, Oct 20, 2013 at 4:36 PM, Waldemar wrote: > I suspected as much. > Thanks for the l

Re: maintainability, DSLs, declarative APIs, etc.

2013-11-15 Thread Jay Fields
I've worked extensively in Java, Ruby, and Clojure, so I have plenty of experience with having and not having meta-programming and macros. In my opinion meta-programming and macros are not black art, they are simply part of the language. If someone chooses to do something that isn't easy to underst

Re: maintainability, DSLs, declarative APIs, etc.

2013-11-15 Thread Jay Fields
On Fri, Nov 15, 2013 at 3:30 PM, Brian Craft wrote: > I've heard people doing contract work in ruby swearing when > they encounter another DSL: it kills their productivity. > those same people wouldn't have Ruby contracting work if it weren't for metaprogramming... -- -- You received this mess

Re: Breaking out of doseq

2013-11-27 Thread Jay Fields
I'm not sure doseq is what you want.. I'd probably just use loop recur. On Wed, Nov 27, 2013 at 9:43 AM, Jonathon McKitrick wrote: > To clarify what I'm trying to do, I have a map of regexes, and after > iterating them, when one matches (the order of the regexes is significant) I > want exactly o

Re: Best way to loop a map of maps

2013-12-03 Thread Jay Fields
I was going to type in the example with multiple bindings, but this will probably be more helpful: http://blog.jayfields.com/2013/05/clojure-combining-calls-to-doseq-and-let.html On Tue, Dec 3, 2013 at 6:05 PM, Ryan wrote: > Hi all, > > I am trying to figure out a better way to loop the following

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

2013-12-29 Thread Jay Fields
make the app work with 'lein run' and it'll work in the repl as well. On Sun, Dec 29, 2013 at 4:30 PM, larry google groups wrote: >> If it can't find the file, `clojure.java.io/resource` returns nil; and >> (slurp >> nil) throws an IllegalArgumentException, which doesn't seem to be the >> error >

Re: What's your testing flow with the current clj tools?

2014-01-25 Thread Jay Fields
I use emacs & expectations[1] These days I do more repl-driven-development than test-driven-development, so the tests tend to come after solving the problem at hand. At that point I run all the tests via "lein expectations"[2] to get an idea of what's broken. Now that I know what test namespaces c

Re: What's your testing flow with the current clj tools?

2014-01-25 Thread Jay Fields
sorry, I forgot to mention you can you also expectations/run-all-tests (with or without a regex) if you're the kind of developer who likes to live in the repl. On Sat, Jan 25, 2014 at 8:19 AM, Jay Fields wrote: > I use emacs & expectations[1] > > These days I do more repl-drive

Lessons Learned from Adopting Clojure

2014-02-04 Thread Jay Fields
tl; dr: I'm presenting "Lessons Learned from Adopting Clojure" in Chicago on Feb 11th: http://www.eventbrite.com/e/goto-night-with-jay-fields-tickets-10366768283?aff=eorgf Five years ago DRW Trading was primarily a Java shop, and I was primarily developing in Ruby. Needless to s

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-18 Thread Jay Fields
I'm not sure I've ever sent an email where the entire content should be "+1", but this is the one where it felt most compelling. Please split the list. Sent from my iPhone On Jan 18, 2013, at 4:25 PM, Phil Hagelberg wrote: > > Irakli Gozalishvili writes: > >> - I do understand that most of the

Re: is intellij idea a good ide for clojure development?

2013-01-28 Thread Jay Fields
I used IntelliJ for clojure dev for almost 3 years. About six months ago I finally took the time to learn emacs, and I strongly regret not doing it much earlier. There are too many reasons to list, but it all comes down to a simple question for me: do you want the ability to easily automate tasks t

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Jay Fields
On Tue, Jan 29, 2013 at 9:28 AM, Feng Shen wrote: > I have programming Clojure for almost 2 years, for a living. > This is probably an important part of what answer the OP is looking for. When I was doing Clojure for about 10% of my job IntelliJ was fine. Now that it's 90% of my job, I wouldn't b

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Jay Fields
nce. Sure, responses inline- > 2013/1/28 Jay Fields : >> There are too many reasons to list, but it all comes down to a >> simple question for me: do you want the ability to easily automate tasks >> that you often repeat? > > Is this really the core of your concerns? A

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Jay Fields
Rich, almost all keystrokes have names you can use from M-x - if you prefer that to keystrokes. On Tue, Jan 29, 2013 at 11:59 AM, Rich Morin wrote: > On Jan 29, 2013, at 08:50, Dennis Haupt wrote: >> i don't know emacs, so i would like to know as well what the killer features >> are that make you

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Jay Fields
k of swank-clojure and i read somewhere that i should use nRepl or > something like that. > > regards. > Josh. > > > On Tue, Jan 29, 2013 at 9:17 PM, Jay Fields wrote: >> >> Rich, almost all keystrokes have names you can use from M-x - if you >> prefer that to

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Jay Fields
> Am 29.01.2013 23:05, schrieb Phil Hagelberg: >> >> Jay Fields writes: >> >>> On Tue, Jan 29, 2013 at 11:45 AM, Laurent PETIT >>> wrote: >>>> Hello Jay, >>>> >>>> I'd like to learn a little bit more from what make

Re: Migrate from IDEs to emacs or vim (already experienced with it) ?

2013-02-02 Thread Jay Fields
If you knew neither, I'm convinced emacs would be the right answer. You'll have more peers to using both that can help you work through problems. You can edit the environment using a language that is similar to clojure... There are many small reasons like that. But, you're desire to stay in vim (w

Re: Sending Clojure Objects over TCP

2013-02-06 Thread Jay Fields
http://code.google.com/p/jetlang/wiki/Remoting On Wed, Feb 6, 2013 at 8:16 PM, JvJ wrote: > Does anyone know if there's a simplified networking library that allows > this? > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this

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

2013-05-02 Thread Jay Fields
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 spending less time demanding answers and more time reading responses and code. I've never looked at the 4clojure source, didn't even know it was on github. I've never us

Re: .class files constantly going stale?

2012-02-15 Thread Jay Fields
I think this issue is related to using defrecord or defrecord & defprotocol or defrecord, defprotocol, & extend-protocol I've never bothered to look into the simplest case at which it fails. I have a namespace that has my defrecord, and another namespace that defines the protocol and uses extend

Re: .class files constantly going stale?

2012-02-15 Thread Jay Fields
again, I haven't felt much pain, so I'm not sure what I'm saying is entirely true, but... In the scenario I describe I have to :import the class created by defrecord to reference it as part of extend-protocol For example in foo/recs.clj (ns foo.recs) (defrecord ARecord [a b]) in foo/prots.cl

Re: .class files constantly going stale?

2012-02-15 Thread Jay Fields
form(s) can be loaded; this will generate the classes at runtime, > and avoid any ahead-of-time compilation. > > In general, AOT is rarely necessary, and almost always a hinderance. > > - Chas > > On Feb 15, 2012, at 11:13 AM, Jay Fields wrote: > > again, I haven't fe

Re: Newbie to Clojure..

2012-02-18 Thread Jay Fields
Clojure is not going to help you deliver a website in fewer iterations in the short term. You should learn Clojure to become a better developer for the rest of your career. Here's the simplest reason to learn Clojure: A language that doesnt affect the way you think about programming, is not wor

Re: Bret Victor - Inventing on Principle

2012-02-24 Thread Jay Fields
On Fri, Feb 24, 2012 at 2: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 one > person to prefer text to video as a way of disseminating verbal

Re: Clojurescript One and Websockets

2012-03-02 Thread Jay Fields
clojure + web sockets, not using aleph: http://blog.jayfields.com/2011/02/clojure-web-socket-introduction.html On Mar 1, 2012, at 10:51 PM, Brian Rowe wrote: > Hi, > > I'm thinking about using clojurescript one a starting point for a web game. > I would like to use websockets as the primary c

Re: Clojurescript One and Websockets

2012-03-19 Thread Jay Fields
2 at 7:23 PM, Brian Rowe wrote: > Hey Jay, > > Are there any plans to make a ring adapter for webbit? > > > On Friday, March 2, 2012 6:40:27 AM UTC-5, Jay Fields wrote: >> >> clojure + web sockets, not using >> aleph: http://blog.jayfields.com/2011/02/clojure-web-

Re: removing a hash-map from a set using hash-map's field.

2012-03-23 Thread Jay Fields
Disclaimer, I'm only looking at how I would want to write it. You may need to do something else if you have specific performance requirements. clojure.set is probably your friend. user=> (def xrel #{{:id 1, :foo "bar"} {:id 2, :foo "car"} {:id 3, :foo "dog"}}) #'user/xrel user=> (use 'clojure.set

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-27 Thread Jay Fields
I recently ran into some code** that was in Java, and ran in single digit microseconds (not millis). I converted it to clojure, and got it running at about the same speed... though it did take me a day to figure out all the tweaks. It can be done, if you're willing to invest the time and learn the

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-29 Thread Jay Fields
10:17 PM, endbegin wrote: > On Tuesday, March 27, 2012 2:51:41 PM UTC-4, Jay Fields wrote: > I recently ran into some code** that was in Java, and ran in single > digit microseconds (not millis). I converted it to clojure, and got it > running at about the same speed... though it did

Re: partition-distinct

2012-03-30 Thread Jay Fields
Here's a version with reduce. It returns your elements as sets, but you could easily (map seq ,,,) if you really need lists. user=> (reduce (fn [r e] (if ((last r) e) (conj r #{e}) (update-in r [(dec (count r))] conj e))) [#{}] [1 2 2 3 4 4 1 6]) [#{1 2} #{2 3 4} #{1 4 6}] Cheers, Jay On M

(constantly)

2012-04-02 Thread Jay Fields
I often tend to define the following in my apps (def no-op (fn [& _])) The other day I noticed constantly (http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/constantly), which is basically the same thing - except I would have to say (constantly nil). What do you all think about

Re: Nested refs & conflicting transactions

2012-04-07 Thread Jay Fields
I did something similar at one point with a trading system. The map was something like {ticker {resting-orders [] pending-orders []}. The pending and resting orders were changing often, but we weren't changing what tickers we were trading very often. The entire map was a ref, and the resting and pe

Re: Saving Java objects/Clojure forms to text file

2012-04-16 Thread Jay Fields
I would serialize to json and save the dates in millis. That's been working for me for quite awhile. Cheers, Jay On Mon, Apr 16, 2012 at 10:29 AM, Adam Markham wrote: > I want to save a list of Clojure maps to a text file. The problem is I > have a :date key which contains a java.util.Date objec

Re: How do you use defmulti to create a function with a variable number of args?

2012-04-16 Thread Jay Fields
note, I didn't test any of these, but they should work (possibly with a tweak or 2) There's quite a few ways to do this, here's one. (defmulti add-item (fn [& args] (condp count args 0 :none 1 (class (first args)) :default)) (defmethod add-item :none (add-item nil nil)) (defmethod add-item Intege

Re: How do you use defmulti to create a function with a variable number of args?

2012-04-16 Thread Jay Fields
I might be wrong, but I think that would cause (add-item 1 {:prop "here"}) to call the wrong defmethod (should call 4th, calls 2nd) On Mon, Apr 16, 2012 at 12:47 PM, Ambrose Bonnaire-Sergeant wrote: > This should do the trick: > > (defmulti add-item (fn [i & other] (class i)) > > Thanks, > Ambros

Re: question about partial

2012-04-16 Thread Jay Fields
reading material: http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/ When you say (-> 3 (partial f 2)) that evaluates to (partial 3 f 2) - which is obviously not what you want. Likewise, (-> 3 fp) expands to (fp 3), which works fine, as you noticed. The important thing to remember

Re: question about partial

2012-04-16 Thread Jay Fields
Sorry, I meant to link this post: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/ On Mon, Apr 16, 2012 at 12:58 PM, Jay Fields wrote: > reading material: > http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/ > > When you say (-> 3 (partial f 2)) that evaluate

Re: A pr-str alternative that quotes lists?

2012-04-16 Thread Jay Fields
If you go down that path, I think vec (http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/vec) is worth looking at. I've always understood that vec turns lists into vectors, but leaves vectors alone... which looks like what you are doing. On Mon, Apr 16, 2012 at 1:02 PM, kurthar

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jay Fields
same outcome for me. On Thu, Apr 19, 2012 at 9:24 AM, Ambrose Bonnaire-Sergeant wrote: > Did I do something wrong? > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install > jonase/eastwood 0.0.1 > > ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version > Lein

Re: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread Jay Fields
I would have written the fn like this, if I was following what you've been doing: (def m {:planet {:country {:state {:city {:borough 4}) (let [mm (update-in m [:planet :country :state :city :borough ] (fnil inc -1))] (get-in mm [:planet :country :state :city :borough ])) However, when I ru

Re: Pulling constants out of interfaces

2012-04-30 Thread Jay Fields
That's correct. You'll want to make sure you (:import Foo$Bar) also. more info: http://blog.jayfields.com/2011/01/clojure-using-java-inner-classes.html Cheers, Jay On Mon, Apr 30, 2012 at 11:44 AM, Tassilo Horn wrote: > nick rothwell writes: > > > I'm faced with the following in some legacy co

Re: Pulling constants out of interfaces

2012-04-30 Thread Jay Fields
oups.google.com/group/clojure/browse_thread/thread/5af5d892f2e84212/0c5dc6b6a1578f07?#0c5dc6b6a1578f07 > > and http://clojure.org/reader > > So: is the behaviour discussed intentional? If so, should $ be made > explicitly valid in symbols? > > Phil > > On 30 April 2012 16

Re: Pulling constants out of interfaces

2012-04-30 Thread Jay Fields
;valid" to be used, and the docs don't state that using $ is "invalid". The docs make a guarantee on specific characters, what you do with that information is completely up to "consenting adults" On Mon, Apr 30, 2012 at 12:45 PM, Laurent PETIT wrote: > 2012/4/30 Ben

Re: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Jay Fields
I'd recommend The Joy of Clojure. You'll probably be able to skip some early chapters, but overall I feel like its the right book for someone with a decent working knowledge of lisp. Sent from my iPad On May 7, 2012, at 12:37 AM, HelmutKian wrote: > Hey there, > > I'm a fairly experienced C

Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread Jay Fields
James, For learning, I'd recommend 4clojure.com and compare your solutions with solutions submitted by other people. Also, if you have the cash, you could pay clojure/core to pair with you. Unfortunately, I've never heard of anyone doing that kind of thing as a mutually beneficial situation - (you

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

2012-05-16 Thread Jay Fields
I've also attempted to use if/when-let with multiple bindings in the past. I assumed that it would behave as 'AND' and that no bindings would be available in 'else' Cheers, Jay On Wed, May 16, 2012 at 10:29 AM, Dan Cross wrote: > On Wed, May 16, 2012 at 9:16 AM, Aaron Cohen wrote: > > On Wed,

  1   2   >