There is a good talk by Chris Houser, "Condition Systems in an Exceptional
Language" [1] where he systematically goes through many of the aspects on
handling exceptions in batch processing (like the problem Josh describes).
An interesting way to build a conditional error handler is outlined
It would be great if an editor highlighted a (possibly qualified) keyword
that was used only in that particular place (given all code loaded). This
wouldn't be bullet-proof, but would have highlighted mistakes like
:encypted (but could still confuse :encrypted? with :encrypted, and
whatnot).
You can hardcode the nrepl-server port with :repl-options {:port 4001} as
seen at [1].
When thinking about it, maybe you could script tmux or similar to show all
running terminals at once, like shown in [2].
[1]
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L354
[2]
It is correct that vectors aren't a suitable choice for datastructures that
need random-access-removal. The problem is that you seem to need both
fast index lookup and be able to access elements after removed elements
quickly even when there are holes in the backing array.
There are some
It is sad that Zach and Kyle thinks they spent time in vain.
Clojure is less about code and more about holistic considerations and
intentions than most other software projects. Jira (and mail chains such as
this) are probably the worst possible hammers on communicating intentions
and more
Hotline Combi 450 Mobile Telephone
Den 19 jul 2015 02:56 skrev Fluid Dynamics a2093...@trbvm.com:
On Saturday, July 18, 2015 at 8:22:35 PM UTC-4, Linus Ericsson wrote:
In cases like these I would strongly suggest Zach, Kyle and the Clojure
Core-team to strive to communicate by phone
My God
Use the :tx-data as a $-database!
The only pitfall is that the second position, the attribute, and all other
references (reference type) is just a reference to the attribute entity (a
long).
Let's say you find :db/txInstant to be 53, and :community/category to be
112 the query would look like
I really cant see how the testers could NOT be able to use a repl to do
some exploratory testing.
Clojure's strength is really that you can align the code very closely to
the domain, although this modelling is (as always) challenging.
And the application logic does not have to be tested through
Jason,
the summary is good, but I'm missing the more efficient data structure
array-map that probably wastes less space than the hash-map for the same
size of object. [1]
Also Zach Tellman has made some effort with clj-tuple which however use
indexes, not keys. [2]
[1]
You are right!
If, say, a file write, fails the data would reside only in your memory refs.
One way to make sure the two thing are always in sync is to be able to
rollback the in-memory state (and replaying all subsequent actions) by
holding on to the old version until the agent could be derefed
There are primitive vectors. Extraordinary clever.
http://clojuredocs.org/clojure.core/vector-of
/Linus
Den 16 okt 2014 00:02 skrev Jony Hudson jonyepsi...@gmail.com:
Thanks, that's really useful!
Jony
On Wednesday, 15 October 2014 20:53:40 UTC+1, Jony Hudson wrote:
Hi all,
another
Andy, I would go for quantity over quality here. There's really a lot of
libraries but only some applications (where I think LightTable is one of
the most polished applications).
Don't miss the quite good catalogue http://www.clojure-toolbox.com/
some things are a bit outdated, but it doesn't
You can set system properties with System/setProperty.
See more here:
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
/Linus
Den 26 sep 2014 15:58 skrev paracomunicacionesinforma...@gmail.com:
hi,
I've got a traditional java class invoked from the command line:
If you turn on verbose gc for the JVM you could at least rule out GC pauses.
Hmm, exactly how do you route the requests through the apache server? It
almost sounds like your applikation is restarted every now and then, iirc
Apache only servers a limited amount of requests per server thread.
If
The volatile construct seems very useful in some particular cases! I have
been missing ugly-mutable variables for things such as certain types of
heaps/queues or write-intensive, slightly probabilistic stuff where one
missed write doesn't matter that much.
For people who don't have a Java
For instance you can use schejulure [1] or at-at [2] and make sure the
scheduled function calls put an item (event) on the channel and then made
the scheduler do the pausing work.
All the listeners attached to the channel will receive the events at the
time the scheduler releases them, and you
Pedestal pedestal-service handles requests asynchronously by extending the
ring standard with Interceptors, sort of a state machine queue version the
wrapped handlers of ring.
/Linus
Den 3 sep 2014 10:35 skrev Laurens Van Houtven _...@lvh.io:
Hi James,
Thanks for your response! Replies
(Rich Hickey is the only one who could answer finally but...)
I think this information is old and outdated, streams didn't really make it
into clojure.
The things that survived was the *sequence* abstraction (which is used
almost everywhere), later the *reducers* (facilitating javas fork-join
Well, for better or worse we don't like conflicts that much. This has
benefits when it comes to some kinds of problem solving (the way to
consensus in Swedish companies is worth at least a chapter in a big book
about antrophology). This shyness for open conflicts can lead to stagnation.
This
According to this [1] post one can reachything in Glibc with JNA. I have
never tried.
/Linus
[1] http://unix.stackexchange.com/questions/1681/invoke-syscalls-from-java
On Wednesday, August 20, 2014, Chai Tadada chai.tad...@gmail.com wrote:
Hello,
Is it possible to call the setrlimit syscall
You could likely use System/identityHashCode to count the similarity of
objects all the objects.
I created a small function that only honors the clojure-visible
structure, and exposes every item in a tree structure (apart from the
arrays in PersistentVectors and some PersistentMaps)
(defn
Check out pedestals interceptors, they handle both error and
pause/resume-request functionality. Seems you could have great use of it.
Pedestal-service is the repo.
pedestal.io
/Linus
On Monday, July 21, 2014, Leon Grapenthin grapenthinl...@gmail.com wrote:
The predicate parameter introduces
You should try Clojure Programming (Halloway, Bedra). I felt enlightened
after reading the first edition, the second edition is also very good!
http://pragprog.com/book/shcloj2/programming-clojure
/Linus
On Thursday, July 10, 2014, Stephen Feyrer stephen.fey...@gmail.com wrote:
Hi Sam, Lee.
gitolite? I think we used it on one of my jobs.
https://github.com/sitaramc/gitolite
/Linus
On Monday, June 30, 2014, Di Xu xudi...@gmail.com wrote:
gitlab[1]?
[1] https://about.gitlab.com/
2014-06-30 18:34 GMT+08:00 Adrian Mowat adrian.mo...@gmail.com
You probably want map-indexed
http://clojuredocs.org/clojure_core/1.2.0/clojure.core/map-indexed
/L
2014-06-27 17:10 GMT+02:00 Leonardo Borges leonardoborges...@gmail.com:
Try using map :
(map str '(my-list-of-crap) (iterate inc 0))
--
You received this message because you are
See points 2, 3 and 8 at http://clojure.org/refs
It is just a way to obtain the change lock of the ref in the dosync
transaction, without rewriting it. The alternative would be to
explicitly modify it to the same value as it was before, which is
potentially wasteful.
One possible case where this
On Saturday, June 21, 2014, Di Xu xudi...@gmail.com wrote:
Suppose at my REPL I do...
(defn direct-report-oneplustwo [] (println (str Direct one plus two is
((fn [n] (+ 1 n)) 2) .)))
...then I presume that the compiler has compiled my
direct-report-oneplustwo function, and that this has
I would say it's not so much about programming paradigm rather than system
calls. It all boils down to how often you would want to read the data.
If it's not more than some times per second, and it's not super important
with timing, you could probably put a reading function in a
A more commonly used feature are bindings, which are sort of pluggable
(or rather overridable) dynamic vars.
http://stackoverflow.com/questions/1523240/let-vs-binding-in-clojure
In short you declare a variable as dynamic and then use some binding around
the function-call.
Sort of a reusable
It says Criterium ran four batches of 60 samples in each (it tries to make
the jvm då garbage collection etc between each such batch).
In total, 240 samples (ie timed test runs).
The statistics are better looked up at wikipedia, but lower quartile here
means the 2.5% of the 240 samples (0.025 *
Yes, by using externs:
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
A bit dated, but I think this is still the way to go!
/Linus
2014-06-08 6:36 GMT+02:00 Gabrien phuthuycuoimayhut...@gmail.com:
Is there any way to use nodejs modules (the browserifiable ones)
(I think your stepwise problem is better to be solved without agents, see
below.)
I realized that the *rng* actually is conflated, it keeps both the state
for the random number generator AND the algorithm used for the random
number generation. This is usually not a problem, since the state-size
Either :use with [seesaw.chooser :only [choose-file]] like
(ns ...
(:gen-class)
(:use [seesaw.chooser :only [choose-file]])
or the beefed up refer functionality:
http://clojuredocs.org/clojure_core/clojure.core/refer
which can have :only, :exclude and :rename to avoid collisions, which
I do agree that the name data.generators is not where to look for a
controllable random source. A more specific name for these functions should
be considered.
The java.util.Random has been an issue for me in stress-testing random read
and writes to a huge memory-area by several threads. If I was
Data.generative already has this function and many more, I realized.
/Linus
On Wednesday, June 4, 2014, Mars0i marsh...@logical.net wrote:
On Wednesday, June 4, 2014 2:55:20 AM UTC-5, Gunnar Völkel wrote:
Once you notice that you usually need a fast solution.
Yes!
The easiest
Sorry, of course i meant the clojure.data.generators library
https://github.com/clojure/data.generators
esp. the *rnd* that can be bound around many of the functions in the
library.
/Linus
On Wednesday, June 4, 2014, Linus Ericsson oscarlinuserics...@gmail.com
wrote:
Data.generative already
Maybe reduce-fsm could be useful?
https://github.com/cdorrat/reduce-fsm
It creates a simple state finite state machine that can be applied on any
sequence.
/Linus
2014-06-03 11:04 GMT+02:00 Ulrich Küttler kuett...@gmail.com:
Hi,
what is the preferred way to find sub-seqs in a seq? I am
This looks really promising.
One question: when one builds modern-cljs, is there any extra configuration
needed for getting the clojurescript compiler up and running? I get a
java.lang.String cannot be cast to clojure.lang.Associative when doing $
lein buildcljs once, which I don't really know
or to increase a counter while reducing it, a function like inc+ returning
{:sum sum :count count} and then take the sum/counter, which is the mean.
The problem is possible to state as a clean map-reduce problem with only
one traversing of the data. It's also possible to remove items form the
2012/3/14 David Nolen dnolen.li...@gmail.com
On Wed, Mar 14, 2012 at 4:09 PM, Daniel Gagnon redalas...@gmail.comwrote:
On Wed, Mar 14, 2012 at 3:00 PM, David Nolen dnolen.li...@gmail.comwrote:
Thanks to Edmund Jackson we have a new primer for core.logic:
Mindblowing! I can imagine many applications for datomic, it looks like a
very powerful abstraction which is overcoming many of the problems I've
been encountering when I've built applications. Thanks, Rich!
Chris Grangers awesome experimental UI for developing javascript games is
covered in
The rationale for Clojurescript is available here:
https://github.com/clojure/clojurescript/wiki/Rationale
I would say it's a way to wrap the large possibilities of javascript in a
saner and quite well known environment for Clojurians. The way to use the
Google Closure libs+compiler is very
2012/2/23 Cedric Greevey cgree...@gmail.com
On Thu, Feb 23, 2012 at 2:41 PM, kovas boguta kovas.bog...@gmail.com
wrote:
In general the way repl's handle state is pretty busted.
Ever create a piece of data and then later wonder, how the heck did I
make this?
One simple thing would be if
Wrong type of parens!
This works for me:
(ns test (:import [java.io File]))
it's a bit of a gotcha, though.
/Linus
On 2/18/12 10:29 PM, ClusterCat wrote:
Hello,
I have two newbie questions:
First
-
(ns test (:import (java.io File)))
I can use File like this
(let [file (File.
Nazar,
I don't know what you mean by Intelligent but please checkout WebNoir
[1] for a quick way of building web applications in Clojure.
If you are into rich web applications (ie clever client side)
ClojureScriptOne [2] also might be an option for you.
To just get started with the language
A treasure!
I will from now on start to jot down whatever I do also.
/Linus
2012/2/16 Sean Neilan s...@seanneilan.com
Of course, I won't be able to write the entire Recipe Book by myself. I
will contribute all the recipes I have discovered with test cases.
On Thu, Feb 16, 2012 at 11:40 AM,
Hi! Long way!
To start with I would head for using webnoir+korma for starters. I think
its a better lighted up road for people to start with (eventually you could
dump the jvm after a while and run everything in node.js or something but
for now thats a risky road for someone new to the language
Regarding don't want to learn Java. I understand fully, but can I suggest
downloading a major java-IDE and make some small and simple java-katas in
it?
I would suggest IntelliJ IDEAs Community Edition (there are other, ofc) and
then going through some examples from the surprisingly well written
I want to generate rules with constant and/or functions producing parts of
the rules:
(defn rulemaker []
(str SCOPE global-constant ; (some-global-function) ;))
which could be called with
(with-super-closure model-in-file-reference
(rulemaker))
Is there a way to make some temporary
2012/1/9 Nicolas Garcin nicolas.etienne.gar...@gmail.com
Hello,
I'm new to functional programming and Clojure and I'm trying to
translate a simple java program into Clojure. My program must build
from 2 input lists (stored in a vector) 2 output lists (also stored in
a vector) which have
How about a memory mapped file? Not lazy at all, but could be quick, given
that you have enough memory.
http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/MappedByteBuffer.html
There can be times where a database is too low performant or clumsy for
quick searching in a large utf-8 file, but
Hi Joshua!
I've been using Anki for repeating unsorted Clojure-stuff in about a year.
It's good for knowing all the instructions and source code, but the key to
success is always to solve more or less complicated problems
(4clojure.orgetc). On the practical side I have a lot left to learn,
also
Hi!
I have been in the wondrous world of XML-parsing last week and I've found a
missing mechanism in clojure.xml - the escaping the predefined entities:
Example:
(use 'clojure.xml)
(def xmlelem (parse (new org.xml.sax.InputSource (new java.io.StringReader
tag greet=\Clojureamp;co\/ ;;
Yes, it does. I had problems with some midje-facts crashing the rendering
in marginalia, but was able to just give the files as consecutive arguments
as a work around.
lein marg src/app/core.clj src/app/another/file.clj
wildcards works fine as well.
This problem with midje-facts being
Hi Marek!
I would def a protocol CustomArithmetics and include the the nescessary
methods for arithmetics, and then a deftype for each custom arithmetics. It
would be possible to extend the protocol for Longs and Integers as well, if
needed.
If you would like to use the normal operator-names +,-
2011/12/21 Marek Kubica ma...@xivilization.net
Hi,
Thanks for your mail, glad to get ideas so fast :)
On Wed, 21 Dec 2011 09:51:04 +0100
Linus Ericsson oscarlinuserics...@gmail.com wrote:
I would def a protocol CustomArithmetics and include the the
nescessary methods for arithmetics
Wov!
There have been some great and very educational blog posts on how to
improve the memoization functionality for various use-cases but this makes
it even more effort free to use the techniques.
This is brilliant! Thank you!
/Linus
2011/12/14 Fogus mefo...@gmail.com
core.memoize v0.5.1
))]
(println (apply str id
Note that I had to make a couple of fixes to the above XML to make it
right.
I hope that's useful!
Tom
On Dec 12, 7:06 am, Linus Ericsson oscarlinuserics...@gmail.com
wrote:
Hello!
What's the clever way to read the E-tags thisone and andthis in the
XML-file
Hello!
What's the clever way to read the E-tags thisone and andthis in the
XML-file below given I don't know their id on beforehand?
a
bbla bla/b
bbla bla/b
c id=wanted
d id=1
e id=notthisone//d
d id=2
e id=thisone/
e id=andthis//d
d id=3
e
Swank is not built in by default. Have you added a :dev-dependencies
[[swank-clojure 1.4.0-SNAPSHOT]] map entry to project.clj and runned lein
deps and the lein swank?
(1.4.0-SNAPSHOT worked for me a few days ago, maybe 1.4.0 is out sooner or
later)
/Linus
2011/12/9 Richard Tiger Melville
2011/12/5 Stuart Sierra the.stuart.sie...@gmail.com
(side note: what is different between Long/MAX_VALUE and the
function call (Long/MAX_VALUE)?
None. Both are syntax sugar for (. Long MAX_VALUE)
It seems like unchecked-multiply doesn't like vars, but thats surprising.
What am I
David and Stu to the rescue. Of course that's the way to do it.
Thank you both,
/Linus
2011/12/5 David Nolen dnolen.li...@gmail.com
You can't store primitives in vars. But you can cast their contents to
primitives with (long ...) (int ...) etc
David
On Mon, Dec 5, 2011 at 12:16 PM, Linus
Thats a great feature as well! It is very good not to clutter the code with
magic constants, but to be able to name them in a sane way.
Thank you all again,
/Linus
Den 5 dec 2011 18:38 skrev David Powell djpow...@djpowell.net:
On Mon, Dec 5, 2011 at 5:29 PM, Linus Ericsson
oscarlinuserics
I try to do multiplication where overflowing is expected and the result
should be handled modulo ie the multiplication results in a truncated
long.
user (unchecked-multiply (Long/MAX_VALUE) (Long/MAX_VALUE))
1 ;;is ok and expected
also
classificator.fnvhash (unchecked-multiply Long/MAX_VALUE
I don't know what data the vectors depict, but if they are like floating
point numbers and you want to do distances etc (like geodata), and need
high performance on various strange matchings you should consider something
like R-trees
http://en.wikipedia.org/wiki/R-tree
(or check if there is some
In Clojure in Action (still in MEAP i think) there's a chapter about
using (Erlang/OTP-based) RabbitMQ message queue server for making
Clojure scalable in a Hadoopish map-reduce-way.
Avout seems to solve many of the problems that easily could occur in
such an approach by not needing a centralized
There's an approach using agents described here:
http://travis-whitton.blogspot.com/2009/07/network-sweeping-with-clojure.html
It's a bit old, so somethings in the example could be a bit outdated, but
the idea may help you forward,
/Linus
2011/11/22 AndyK andy.kri...@gmail.com
I have been
(map #(vec (take (inc %) a1)) (range (count a1)))
does it the lovely map.
/Linus
2011/11/9 Shoeb Bhinderwala shoeb.bhinderw...@gmail.com
Is there a more elegant/idomatic way to achieve the following result:
user= a1
[a b c d]
user= (map-indexed (fn [n x] (vec (take (inc n) x))) (take
No one can be told what the matrix is.
Well, the best way to understand the macros is to try it out yourself. John
Lawrence Aspden published some really helpful tutorials om macros, and a
kata - try it! Links in the end.
There are some other code examples around, also look in the source-code of
Range is lazy.
First you define a range, which is just a promise that the variable will
be rendering a seq with 10M when asked for the elements.
When you count the sequence you realize it and it takes up much space. When
you let go if it it's of course GCed.
The problem is that you hold on to
Would it be possible to store the original defn s-expression source code in
metadata added to the java byte-code function? It would be highly
inefficient (and most of the time meaningless) for autogenerated functions,
but quite a small overhead for the few locs a developer spits out during a
You get Selenium running by using the clj-webdriver [1], thanks to Semperos
for that one!
[1] https://github.com/semperos/clj-webdriver
/Linus
2011/8/11 Filip de Waard f...@vix.io
On Thu, Aug 11, 2011 at 4:03 AM, Timothy Washington twash...@gmail.comwrote:
Good on you. I've been looking to
Maybe
(map #(.addItem tree (.toString (first %))) planets)
where #(.addItem tree (.toString (first %))) should be replaced with the
correct java interop for inserting into the tree, and the % becomes one and
one of the items in the planets vector (that is regarded as a sequence) the
argument.
I find this behaviour a little surprising:
--foo/core.clj:
(ns foo.core
(:require [foo.bar :as test]))
(def ark (test/a-var test/another-var))
--foo/bar.clj:
(ns foo.bar)
(def a-var {:animal dog})
(def another-var {animal: cat})
REPL:
in the repl I get:
foo.core (map class ark)
=
This tutorial covers the subject pretty well, I assume you've already read
it.
http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html
according to it you should use
Next, include the necessary Ring middleware:
(:use ring.middleware.file)
(:use
Why not?
The only thing I found very practical (even though it does not yet work 100%
(like autoloading the open code in the repl) for me) is the possibility to
fire of longer commands and function definitions (or the like) in Slime (or
vi-equivalent).
The repl is a great way to debug your
I recognize that one. The repl haven't loaded the file your editing.
My (temporary) solution is to do a (load-file the file your editing)
after each edit that I want to debug, but that's a bit boring. I guess there
is some kind of reload feature somewhere...
/Linus
2010/9/27 psfblair
Persistant variable handling is one of the things which I have spent much
time on as a beginner and former SQL-illiterate (Among getting the swank to
finally work (it's a dream!)). I have however got into databases quite a bit
among the way - but it was not my main goal and it has taken some time
I have problems loading somnium.congomongo.
My Leiningen project.clj looks like this:
(defproject system1 0.1.0
:description System1
:dependencies [
[org.clojure/clojure 1.2.0-master-SNAPSHOT]
[org.clojure/clojure-contrib 1.2.0-SNAPSHOT]
I'm overwhelmed by the answers, thank you all! Now back to the REPL.
/Linus
2010/4/5 Per Vognsen per.vogn...@gmail.com
On Mon, Apr 5, 2010 at 11:33 AM, Lee Spector lspec...@hampshire.edu
wrote:
Ah -- maybe that foiled my timings too. I didn't expect it to be fast --
just clear (at least
Hello Clojure!
Is there any straight-forward way to randomly reorder a list?
ie:
(randomize-list (list 1 2 3 4))
- (3 2 1 4)
Regards,
Linus Ericsson
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure
81 matches
Mail list logo