Inside the ns form they are the same. Outside the ns form, only (require
'[a.b]) works (with quoting, as Kelker said).
Jonathan
On Fri, Dec 6, 2013 at 10:24 AM, Kelker Ryan theinter...@yandex.com wrote:
I believe one is a directive and the other is a function.
:require doesn't need the
Function composition similar to that has been explored a lot in the haskell
world. See:
http://www.haskell.org/haskellwiki/Arrow
I also made a small library to implement some of the operators:
https://github.com/odyssomay/clj-arrow
I think the reason arrows are so interesting in haskell is
Isn't it possible to solve this with a simple macro?
(case-dialect
:clojure (... clojure code ...)
:clojurescript (... clojurescript code ...))
Then, in jvm clojure, it could be implemented as:
(defmacro case-dialect [ {:keys [clojure]}] clojure)
and in clojurescript:
(defmacro
of things you would want to conditionally compile on for
Clojure/JVM.
Andy
On Thu, Mar 7, 2013 at 5:44 AM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
Isn't it possible to solve this with a simple macro?
(case-dialect
:clojure (... clojure code ...)
:clojurescript
My experience:
1. Download lein.bat
2. Run it
Jonathan
On Sat, Mar 9, 2013 at 10:23 AM, BJG145 benmagicf...@gmail.com wrote:
Perhaps this general anti-Windows attitude is what Windows-based newcomers
to Clojure find off-putting...
On Saturday, March 9, 2013 3:55:59 AM UTC, James Ashley
I would say using :require :as is in almost all cases better.
However, I think :use is preferred if almost everything done
in the current namespace depends on the used namespace.
Though, no more than one namespace should ever be imported
with :use in the same namespace.
In your case I think it's
- and - are for some reason really hard to grasp for
many when starting out - me included.
On Mon, Mar 11, 2013 at 11:58 AM, edw...@kenworthy.info wrote:
So I understand that:
(- foo bar wibble)
is equivalent to
(wibble (bar (foo)))
Correct, but that misses the point. Thinking about -
We recommend all users to upgrade to
1.7.0https://clojars.org/com.novemberain/validateur/versions/1.7.0
.
I'm guessing it should be 1.4.0?
Jonathan
On Tue, Mar 12, 2013 at 8:58 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
Validateur is a functional validations library inspired by
I think you can simply use 'Fred' instead of 'Fred.class'.
Since, in the repl:
(class Integer)
;= java.lang.Class
I.e. just by using the name, we get a Class object, which should correspond
to .class in java.
In other words, you should be able to run:
(let [f (Factory/createInstance)
Found some info here:
http://stackoverflow.com/questions/3727662/how-can-you-search-google-programmatically-java-api
Jonathan
On Fri, Mar 22, 2013 at 8:32 AM, Cedric Greevey cgree...@gmail.com wrote:
Change your code to it spoofs a common browser user-agent, change your
DHCP-assigned IP
The problem is probably too much nested laziness.
Try:
(reduce (fn [a b] (doall (map + [1 1] a))) [1 1] (range 1500))
Related:
https://groups.google.com/d/msg/clojure/-d8m7ooa4c8/pmaO7QubhosJ
Jonathan
On Wed, Mar 27, 2013 at 8:48 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
I don't think it's fixed in 1.5.1.
In both 1.5.0 and 1.5.1, (range 1500) is not enough to cause
the overflow for me. However, (range 2000) successfully
overflows in both versions.
Jonathan
On Wed, Mar 27, 2013 at 8:53 PM, Timothy Baldridge tbaldri...@gmail.comwrote:
Holding on to the head
It's because the #() syntax always calls the content as a function.
So #(...) is the same as (fn [] (...)). In your case,
#({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
is the same as:
(fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
Note the extra () around {}. In other words,
columns
which they use underscore so I gotta go with underscores in order code to
match them :)
Ryan
On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg
wrote:
It's because the #() syntax always calls the content as a function.
So #(...) is the same as (fn
that #() executes the content
as a function, very helpful!
Ryan
On Friday, March 29, 2013 12:08:04 AM UTC+2, Jonathan Fischer Friberg
wrote:
It can still be done with the #(), with for example the hash-map function.
It's basically the same as the {} but as a function, like this:
(hash-map :a 3 :b 4
I think group-by can do what you want (and more);
http://clojuredocs.org/clojure_core/clojure.core/group-by
Jonathan
On Thu, Apr 4, 2013 at 2:16 PM, Christian Romney xmlb...@gmail.com wrote:
Hi all,
I was wondering if something in core (or new contrib) like this exists
already...
(defn
(letfn [(fib [x]
(memoize
#(if (or (zero? %) (= % 1))
1
(+ (fib (- % 1)) (fib (- % 2))]
(time (fib 30))
(time (fib 30))
(time (fib 40))
(time (fib 40)))
Calling fib just creates a new function, no values
are calculated. So
Oops ;)
Of course you are right. The amazing thing is that the times I observed
fitted somehow the situation (the first (fib 30) call taking much more time
than the others, the third call more than the second and fourth) that I was
tricked into believing the calculations were being done and
If that's a problem, you could try https://github.com/hugoduncan/criterium
On Thu, Apr 25, 2013 at 5:38 PM, Phil Hagelberg p...@hagelb.org wrote:
Three repetitions is not nearly enough to get a feel for how hotspot
optimizes functions when it detects they're in a tight loop. I don't know
how
Did you put / at the beginning of the string to resource? Because you
shouldn't.
You should call it like this: (resource foo.xml).
Jonathan
On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:
Hello everyone,
I hope you're all doing well...
Can anyone enlighten my
You could always give https://github.com/halgari/clojure-py a spin, might
not be so easy to get everything working though. :)
Jonathan
On Mon, Apr 29, 2013 at 2:48 PM, Lee Spector lspec...@hampshire.edu wrote:
On Apr 29, 2013, at 8:15 AM, Michiel Overtoom wrote:
On Apr 28, 2013, at
If you don't want to set the initial value to nil, set it to ::unbound or
similar. Should be very
hard to accidentally bind the same value.
Jonathan
On Mon, Apr 29, 2013 at 8:04 PM, AtKaaZ atk...@gmail.com wrote:
the pain with that is that it wouldn't work inside a function where a
would be
I'm currently making a library for jmonkeyengine. It's not
ready yet, however, a while back I decided to put jme in a repository.
Url: http://jmonkeyengine.s3-website-eu-west-1.amazonaws.com/;
Add to deps: [jme 2013-04-01]
The biggest problem with it right now is that it contains all test models
On Mon, Apr 29, 2013 at 5:25 PM, Konrad Hinsen
googlegro...@khinsen.fastmail.net wrote:
--On 29 avril 2013 09:09:27 -0400 Lee Spector lspec...@hampshire.edu
wrote:
On Apr 29, 2013, at 9:01 AM, Jonathan Fischer Friberg wrote:
You could always give
https://github.com/halgari/**clojure
don't support better. Everything from concurrency to the GC is
implemented better in the JVM.
Timothy
On Mon, Apr 29, 2013 at 2:41 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
On Mon, Apr 29, 2013 at 5:25 PM, Konrad Hinsen
googlegro...@khinsen.fastmail.net wrote:
--On 29
I think that for today I will stick with the lib folder solution,
proposed by James, but I encourage the knowledgefull people Jonathan and
James to work together to deliver a Clojars or Amazonaws online repository
with more-or-less daily update, since the engine is really well-maintained.
My effort can be found here:
https://github.com/odyssomay/orbit
It's kind of all over the place in that I have started on a lot of
things, but not really
finished any parts. In any case, should be some useful stuff in there.
I haven't really been active on the project lately - there's a bunch of
.
Jonathan
On Wed, May 1, 2013 at 11:20 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
My effort can be found here:
https://github.com/odyssomay/orbit
It's kind of all over the place in that I have started on a lot of
things, but not really
finished any parts. In any case, should
UI example:
https://github.com/odyssomay/orbit/blob/master/test/orbit/test/ui.clj#L45
Sorry for the spam. :)
Jonathan
On Wed, May 1, 2013 at 11:28 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
Some info about the current status:
* Input handling - missing joystick
If you don't need the result, you should use dorun instead of doall.
http://clojuredocs.org/clojure_core/clojure.core/dorun
Jonathan
On Sat, May 4, 2013 at 8:07 PM, Gary Verhaegen gary.verhae...@gmail.comwrote:
Just want to point out that doall seeming more idiomatic in this case
might just
You could try reading about it here:
http://search.cpan.org/~dconway/Acme-Bleach-1.150/lib/Acme/Bleach.pm
I still can't figure out exactly what it does though...
Reading the description, it seems like it removes, for example
whitespace at the end of lines. But from the example it seems
like it
That sounds scary. :)
I haven't experienced any of the sort. Tested in both linux 64-bit and
windoze 32-bit.
The problem likely stems from the way jme loads the native libraries. As
far as I know
they do it manually by extracting the libraries and then setting some
sort of path. It
should be
(:import ...) only works in (ns ...). Outside ns, you have to use (import
...) instead (note: no :).
See:
http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
Jonathan
On Mon, May 6, 2013 at 12:04 AM, Caocoa p.de.bois...@gmail.com wrote:
I haven't used clojurescript in a while, but if I recall correctly, the
only way
to not compile everything into a single file is to leave out the
:optimization flag
completely. If this is the case this should probably be considered a bug. I
might
be wrong though.
Jonathan
On Tue, May 7, 2013 at
groups of them with different lein-cljsbuild groups.
On Tue, May 7, 2013 at 12:24 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I haven't used clojurescript in a while, but if I recall correctly, the
only way
to not compile everything into a single file is to leave out
abouve. Maybe I just can't do this, but I thought I'd ask around.
Tim
On Tue, May 7, 2013 at 4:03 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
From the sample.project.clj:
; Determines whether the temporary JavaScript files will be left in place
between
; automatic builds
*DON'T DO IT*
I just realised, if the :optimizations missing triggers this
behaviour, it should be possible to set it to nil, and it was!
So try ':optimizations nil' in your build.
Jonathan
On Tue, May 7, 2013 at 10:20 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I tried
, ['edgar'], ['cljs.core',
'clojure.browser.repl', 'shoreleave.remotes.http_rpc']);
*main.js *
Hmm
Tim
On Tue, May 7, 2013 at 4:37 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
*DON'T DO IT*
I just realised, if the :optimizations missing triggers this
behaviour, it should
:8080/javascript/edgar.js
Tim
On Tue, May 7, 2013 at 5:26 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
You have to import the google closure library when compiling without
optimisation.
Given your build, probably something like this:
script type=text/javascript
src=public
I agree with Gary, there's normally not really any need to obfuscate the
implementation,
and using the underlying structure can sometimes be useful.
That said, if you really want to, you can create a woobly protocol and
implement it using reify, this will make the underlying implementation
On Sat, May 11, 2013 at 9:25 PM, Alex Baranosky
alexander.barano...@gmail.com wrote:
Most of the code I see and write at work at Runa uses (not (empty? foo)).
I'll continue to defend the position that it is more obvious code, and
therefore better (imo :) )
Alex
Completely agree. (seq
Nice introduction!
Problems/suggestions for lispindent can be reported here:
https://github.com/odyssomay/sublime-lispindent/issues
don't be shy!
In any case, I went ahead and implemented checking for the
syntax of the file. So non-saved files with clojure syntax is now
indented correctly.
This
On Sun, May 19, 2013 at 4:54 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:
ha! you cheated with iterate...
try this which is closer to the example...
(first (filter odd? (map #(do (println realized %) %) [2 4 6 7 8 9])))
realized 2
realized 4
realized 6
realized 7
realized 8
Found this: http://www.objecthunter.net/exp4j/
Might be useful.
Jonathan
On Wed, May 29, 2013 at 12:45 AM, SpiderPig spiderpi...@googlemail.comwrote:
You could just write this yourself.
It's easier than it looks.
First start with an evaluator for rpn (reverse polish notation)
expressions.
On Fri, Jun 7, 2013 at 11:13 PM, Matt Smith matt.smith...@gmail.com wrote:
(- '([1 2] [3 4] [5])
(partial map first)
flatten
)
Because this becomes
(flatten (partial '([1 2] [3 4] [5]) map first))
I think I understand how you thought; (partial map first) becomes a
function,
Yes, unless you wrap it in another macro.
(defmacro a [] (vec (map (fn [x] `(load-string-here ~x)) [1 2 3
4])))
= (a)
[1 2 3 4]
But it's still pretty useless, unless macros are to replace functions...
Jonathan
On Wed, Jun 22, 2011 at 8:20 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
stumbled upon another, abandoned
Clojure+Swing project called ... wait for it... Seesaw. Go figure :)
Best regards,
Dave
On Mon, Jun 20, 2011 at 7:57 AM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
Hi,
I figured that I would announce a library that I have been working
inc) (arr inc)) 1)
;; 4
((*** (arr inc)
(arr dec))
[1 1])
;; [2 0]
(( (arr inc)
(arr dec))
1)
;; [2 0]
((fst (arr inc)) [1 1])
;; [2 1]
Scott
On Mon, Jun 20, 2011 at 7:57 AM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
Hi,
I figured that I would announce
On Thu, Jul 7, 2011 at 7:42 AM, nchubrich nchubr...@gmail.com wrote:
* Since Lisp is highly extensible, in the long run being
'prescriptive' is a losing battle. It is better to eventually add
standard 'bad' features to the language than to tempt third parties to
do it in even worse and
On Fri, Jul 8, 2011 at 4:29 PM, James Keats james.w.ke...@gmail.com wrote:
May I also add the following caveat emptors:
- If you're new to programming, clojure will overwhelm you. Start with
something like python.
I think most programming languages overwhelm you if you don't have any prior
It looks like you haven't got enough privileges, try sudo gem install
vagrant
Jonathan
On Fri, Jul 8, 2011 at 6:58 PM, Lee Spector lspec...@hampshire.edu wrote:
On Jul 8, 2011, at 12:38 PM, Vivek Khurana wrote:
That is still not as easy as python. Running VM is a bigger overhead...
There
I don't agree that clojure is, or should be seen as something entirely
different than java. If it weren't for java, clojure wouldn't have much use
at all.
When it comes to IDEs, I agree. I write all code in vim (for editing only),
and do the rest from the command line (meaning mostly leiningen).
That's not very constructive at all.
I think clojure would work fine (or better) for enterprise applications. The
one thing that could pull it down is maintainability, as the maintainers
must know clojure.
There was recently a thread about working on large programs in clojure. It
might contain
Maybe this would do:
https://gist.github.com/1073506
I should add that I have never used iterators, and that the code is untested
;)
Jonathan
On Sat, Jul 9, 2011 at 11:10 AM, stu stuart.hungerf...@gmail.com wrote:
Hi,
I'd like to make use of Java classes implementing the Java2D
I don't think I like the notion of a lazy-seq and an iterator, since reading
the iterator also changes it. Consider the case where you create a lazy-seq
from an iterator, and the iterator somehow escapes. Somewhere else the
iterator is read from, and now the data that where supposed to be in the
Well, I guess.
But I get the feeling that the iterator are probably coming from some java
object somewhere, and might get passed around in that environment, that's
why I'm worried.
In the examples you mentioned, line-seq for example. The reader has already
'escaped' since it is passed as an
I think the reason is that an interface means that the function must be
'inside' the class.
I.e you can call (.method object). Since it isn't possible to extend a java
class in that way, it isn't possible to use extend. In a defrecord body
however, a new class is defined, which means that it's
There's no interfaces, that's the function definition.
define function max
(defn max
attach docstring
Returns the greatest of the nums.
attach metadata
{:added 1.0}
if max is called with one argument, use this function definition
([x] x)
if max is called with two arguments, use this function
All those are available in 1.2, or am I missing something?
From my own experience:
metadata, when I started to learn clojure, I thought this is awesome. When
I realized that metadata only applies to clojure types, it felt unreliable
and I never got to using it.
protocols records/types - they're
def defines a global binding (i.e. you can reach the symbol from
everywhere).
defn does the same thing, but always binds the symbol to a function.
Therefore, you only need either def OR defn.
(defn string-maker [the-string]
(str the-string))
OR
(def string-maker (fn [the-string] (str
I see I misunderstood the question, sorry about that.
What you want is a macro:
(defmacro string-maker [string-name the-string]
`(def ~(symbol string-name) ~the-string))
Jonathan
On Thu, Jul 14, 2011 at 1:13 PM, Giancarlo Angulo igan.l...@gmail.comwrote:
Please look at this:
I like to have the datastructure as one big mutable structure. It's not
optimal in many cases, but it is simple.
In this case you could have something like:
(def NoteDb
(atom
[{:text a note :category :misc}
{:text note 2 :category :misc}
{:text blabla :category :important}]))
(defn
Might be appropriate:
https://github.com/aboekhoff/congomongo
Jonathan
On Fri, Aug 5, 2011 at 1:29 AM, Sean Corfield seancorfi...@gmail.comwrote:
Available on Clojars.
Compatible with Clojure 1.2 and Clojure 1.3. Fixes (almost) all reflection
warnings. Handles multi-server connections (bug
Or
(load-string (+ 1 (+ 2 4)))
Jonathan
On Fri, Sep 9, 2011 at 5:14 PM, Chouser chou...@gmail.com wrote:
On Thu, Sep 8, 2011 at 5:16 PM, Tassilo Horn tass...@member.fsf.org
wrote:
Hi all,
I've just read Alan Malloy's excellent clojure persistence article at
Sort of.
http://georgejahad.com/clojure/cdt.html
Jonathan
On Sat, Sep 10, 2011 at 5:36 PM, Dennis Haupt d.haup...@googlemail.comwrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
hi there,
what's the currently best way to debug a clojure program?
ideally, i want to see all vars,
I've had no problems with functions containing -
Jonathan
On Fri, Sep 9, 2011 at 10:47 AM, Christina Conway
ccon...@annadaletech.comwrote:
A function name contains the characters -
e.g. foo-fn
The function causes an exception.
However the exception is not reported on the function but on
Incidentally, I was just working on such a thing.
I'll send it in a new thread.
Jonathan
On Sun, Sep 11, 2011 at 7:03 PM, Michael Jaaka michael.ja...@googlemail.com
wrote:
Couldn't match expected type `(t, t1)'
against inferred type `(t2, t3, t4)'
In the expression: (8, 11, 5)
In the
Hello,
I made a small macro, if anyone is interested.
https://gist.github.com/1209498
It wraps one or more forms and if an exception is thrown,
prints the form that caused it, and throws the exception itself.
Examples:
user= (trace-forms 3)
3
user= (trace-forms (+ 6 (/ 9 0)))
There is the inbuilt sort function, also sort-by is useful.
In The joy of clojure, there were an example of a lazy sort.
It can be found here:
http://www.manning.com/fogus/
In the file q.clj in the source code.
Jonathan
On Tue, Sep 13, 2011 at 1:44 PM, Sunil S Nandihalli
It was tested with 1.2.1
Jonathan
On Wed, Sep 14, 2011 at 9:09 AM, Sergey Didenko sergey.dide...@gmail.comwrote:
Looks interesting. Did you use it with Clojure 1.3 or earlier?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
You could call the mock file B_mock.clj
then
(require '[B-mock :as B])
Jonathan
On Wed, Sep 14, 2011 at 5:19 PM, Brian Hurt bhur...@gmail.com wrote:
Say I have two name spaces, A and B, with A depending on B. I want to test
namespace A, replacing module B with a mock B for testing purposes-
is still valuable for runtime tracing.
Luc P.
On Mon, 12 Sep 2011 11:31:39 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:
Hello,
I made a small macro, if anyone is interested.
https://gist.github.com/1209498
It wraps one or more forms and if an exception is thrown,
prints
I looked at it today and have updated the macro.
(same gist: https://gist.github.com/1209498)
Additions:
It detects if a form contains (recur ...), and if it does,
the form isn't wrapped in (try ...).
trace vectors, maps, and sets.
trace (fn* ...) (new ...)
---
The code feels a bit thrown
How about while?
(while not-finished
(do stuff ...))
On Wed, Sep 28, 2011 at 4:23 AM, Nathan Sorenson n...@sfu.ca wrote:
Quite often I convince myself I need state or some effectful trigger, but
further thought reveals a simpler stateless approach.
That being said--if you absolutely need
First of all, you should switch from
((fn [ls wip ans] ...) ls [] nil)
to
(loop [ls ls wip [] ans nil] ...)
Read about it here:
http://clojure.org/special_forms
Using higher-order functions, you could do:
(defn split-zero [coll]
(if (seq coll)
(let [divided (partition-by zero? coll)]
I managed to do it.
The problem is that we need to use the function set in a goog.net.Cookies
object.
There is already such an object, which is called goog.net.cookies, see the
bottom of the source file:
/**
* A static default instance.
* @type {goog.net.Cookies}
*/
goog.net.cookies = new
thus enable all Clojure developers to have lightning
fast Base64 encoding/decoding?
This is already possible, if you're using leiningen:
put the file in src/util/ and compile, you can now call it as usual.
On Thu, Oct 6, 2011 at 11:16 AM, Rok Lenarcic rok.lenar...@gmail.comwrote:
I use
I do
On Thu, Oct 6, 2011 at 2:32 PM, Simon Morgan s...@spamcop.net wrote:
When using clojure.org does anybody else quite frequently get the
Wikispaces homepage instead? This seems to happen most often when I
start Firefox because I always have a clojure.org tab open. Any idea
what's causing
As I understand it, tools.logging was created from clojure.contrib.logging
(but has been updated since).
In any case; if there exists a library in clojure/, which can perform the
same things as some part of contrib, use the clojure/ one.
On Wed, Oct 12, 2011 at 5:06 PM, jingguo
Hi,
As I understand it, clojurescript uses some unicode characters to identify
keywords/symbols.
I guess that's why (str 'a) gives me ï·‘'a
I thought that this was intentional, and that (name 'a) would give me a,
but I got the same result as with (str).
So how do I extract the name from a symbol
, browser REPL, etc.) ?
David
On Mon, Oct 17, 2011 at 6:41 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
Hi,
As I understand it, clojurescript uses some unicode characters to identify
keywords/symbols.
I guess that's why (str 'a) gives me ï·‘'a
I thought that this was intentional
this at the REPL (say via
script/repljs) ?
David
On Tue, Oct 18, 2011 at 7:22 AM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I'm on the master branch.
I compiled the file using 'cljsc file file.js', and run it in the
browser.
On Tue, Oct 18, 2011 at 1:16 AM, David Nolen dnolen.li
, David Nolen dnolen.li...@gmail.comwrote:
Does the same problem occur when trying this at the REPL (say via
script/repljs) ?
David
On Tue, Oct 18, 2011 at 7:22 AM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I'm on the master branch.
I compiled the file using 'cljsc file file.js
It works!
Thanks for all the help.
On Tue, Oct 18, 2011 at 5:52 PM, David Nolen dnolen.li...@gmail.com wrote:
I see you're not setting the encoding. Try adding the following to the top
of head
meta charset=UTF-8
David
On Tue, Oct 18, 2011 at 11:43 AM, Jonathan Fischer Friberg
odysso
(defn merge-data [data1 data2]
(map first (partition-by :id (sort-by :id (concat data1 data2)
Since the sorting is stable (relative order is kept), we know that the first
occurrence of each id is either the existing map from data1, or the new map
from data2.
On Tue, Apr 26, 2011 at 5:34
Correction:
(concat data1 data2) should be (concat data2 data1)
On Tue, Apr 26, 2011 at 6:37 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
(defn merge-data [data1 data2]
(map first (partition-by :id (sort-by :id (concat data1 data2)
Since the sorting is stable (relative
Since you are essentially using java, I think that a clojure bug can be
ruled out.
Have you checked the drive for errors?
On Tue, Apr 26, 2011 at 8:12 PM, Ken Wesson kwess...@gmail.com wrote:
Anyone know what is going on here? I'm trying to use my Clojure REPL
to rename a file that's gotten
I don't know.
However, given the situation I think
(cond
(empty? @unique-offers) (dosync ... alter ...)
:else (logger/log error))
is better, since the change is more isolated.
On Tue, Apr 26, 2011 at 9:45 PM, Zlatko Josic zlatko.jo...@gmail.comwrote:
Hi,
I use cond in dosync but it
On a closer look:
((logger/log map @unique-offers)
(alter unique-offers assoc offer-value streams))
should probably be
(do (logger/log map @unique-offers)
(alter unique-offers assoc offer-value streams))
On Tue, Apr 26, 2011 at 9:55 PM, Jonathan Fischer Friberg
odysso
unique-offers is old value but all-offers is
new value?
Thanks
On Tue, Apr 26, 2011 at 9:55 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I don't know.
However, given the situation I think
(cond
(empty? @unique-offers) (dosync ... alter ...)
:else (logger/log error
its transaction wich puts values in both maps.
Now first thread check second
condition (empty? @map2) which is false.
On Tue, Apr 26, 2011 at 10:17 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
The important part were that the dosync call is isolated. The condition
doesn't
Yes, you're right, I'm wrong. :)
The derefs must be in the dosync block. (which I somehow assumed, oh well)
On Tue, Apr 26, 2011 at 11:17 PM, Daniel Werner
daniel.d.wer...@googlemail.com wrote:
On Apr 26, 10:52 pm, Jonathan Fischer Friberg odysso...@gmail.com
wrote:
No, that isn't
So I have this question. I have heard that Clojure's data structures
are immutable and it has support for promises, agents, atoms etc.
It's not that clojure's data structures support promises, agents ...
It's more like promises, agents ... support clojure's data structures.
Changing something in
I wrote a simple implementation:
http://gist.github.com/953966https://gist.github.com/953966
(only supports operators)
It's not very elegant (I don't know how to use fnparse..), but it is
functional.
What it does is find out what the next element in the operator stack and the
out stack should be,
This is my take on this: http://gist.github.com/957028
The second file produces the correct result. The result isn't exactly like
you asked for. This is because it wouldn't support files that isn't in the
lowest level.
Ex:
(restore-hierarchy [[top level file1] [top level file2] [top
level2
= uses the clojure.lang.Util/equiv to compare two things. The source of
this function is: [1]
static public boolean equiv(Object k1, Object k2){
if(k1 == k2)
return true;
if(k1 != null)
{
if(k1 instanceof Number k2 instanceof
to haven't changed in 1.3.
Cheers,
Dominikus
On May 5, 4:27 pm, Jonathan Fischer Friberg odysso...@gmail.com
wrote:
= uses the clojure.lang.Util/equiv to compare two things. The source of
this function is: [1]
static public boolean equiv(Object k1, Object k2){
if(k1 == k2
It also seems that I have been linking to the wrong repo... :S
https://github.com/clojure/clojure
Should be the correct one.
On Thu, May 5, 2011 at 6:09 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I'm also interested in that.
I think it has to do with how clojure.lang.Compiler [1
I created a new datatype to solve this problem:
http://gist.github.com/958001
c-fn creates a comparable function;
(let [fnmaker4 (fn [coll] (c-fn [n] (nth coll n)))
ints (range)]
(= (fnmaker4 ints) (fnmaker4 ints)))
= true
On Thu, May 5, 2011 at 10:41 PM, Alan a...@malloys.org wrote:
Although (as I just realized), it fails miserably with closures.
On Thu, May 5, 2011 at 11:38 PM, Jonathan Fischer Friberg
odysso...@gmail.com wrote:
I created a new datatype to solve this problem:
http://gist.github.com/958001
c-fn creates a comparable function;
(let [fnmaker4 (fn [coll
1 - 100 of 192 matches
Mail list logo