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
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
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
+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
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
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
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.
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,
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
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
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
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
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
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
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
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* 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
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
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
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:
>
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
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
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
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
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 -
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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
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
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)
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
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
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
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
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
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 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
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
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
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.
>
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
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
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
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
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
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
>
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
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
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
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
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
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
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
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
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
> 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
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
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
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
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
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
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
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
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
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
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-
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
;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
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
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
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 - 100 of 182 matches
Mail list logo