Carlo,
See below.
On Tuesday, 8 April 2014 12:20:16 UTC+10, Carlo wrote:
On Mon, Apr 07, 2014 at 04:08:03AM -0700, Peter West wrote:
I'm trying to understand the difference between two alternatives in the
following code that reads from a resource file.
(defn vcf-res-reader
Hi James,
I'm new to clojure and maybe for this reason it's possible to put some
'stupid' questions, I came for Java so for me it's normal when I call a
fc/method to execute the body of that fc/method and return a result; this
is the reason for why I expect a result when I call (test-fc
Hey Leif,
Thanks a lot for pointing this out! I did some rudimentary search before
writing dag-runner and missed this one [shy]
Prismatic Graph looks like a very comprehensive implementation. I'll play
with the code and try to learn the way they implement the idea. Thanks a
lot.
Hesen
On
On Mon, Apr 07, 2014 at 11:23:31PM -0700, Peter West wrote:
On Tuesday, 8 April 2014 12:20:16 UTC+10, Carlo wrote:
Your issue here is that the symbol lineseq in the eval form doesn't
have a name to refer to. You do have a local binding for lineseq, but
it's not visible to the eval:
Hi,
I am new to Clojure, so please forgive me if this does not make sense.
I was surprised to find out in the REPL that every? returns true if you
pass in an empty or nil collection.
user= (every? #(= 77 %) nil)
true
user= (every? #(= 77 %) '())
true
I looked at the source for every?
It's very common for a sequence argument to also work with nil, with the
same semantics as an empty sequence. They are completely different things
but
Clojure is sloppy in this regard.
I believe this is intended.
Thanks,
Ambrose
On Tue, Apr 8, 2014 at 2:08 PM, Jeff Mad jeff...@gmail.com wrote:
Regardles of the underlying implementation, why do you think false would be
a better result for nil or empty collections? Can you give an example where
current every? behavior causes problems?
Jozef
On Tue, Apr 8, 2014 at 8:08 AM, Jeff Mad jeff...@gmail.com wrote:
Hi,
I am new to Clojure, so
Jeff Mad jeff...@gmail.com writes:
Hi Jeff,
I was surprised to find out in the REPL that every? returns true if
you pass in an empty or nil collection.
user= (every? #(= 77 %) nil)
true
user= (every? #(= 77 %) '())
true
That's correct. Every item in an empty collection satisfies the
Depends who is doing the expecting as to whether that behaviour is correct.
Formal logicians, mathematicians, computer scientists etc. would respond
sure, it is vacously true. For almost everybody else it feels wrong
but is then true when you think about it a bit.
I would suggest the
Hi.
We've just open sourced Protean (https://github.com/passivsystems/protean),
a little Clojure/edn project which enables simulation of RESTful API's.
Configuring projects with edn is compact and efficient and does not require
polluting actual project code in anyway.
API project behaviour
Hi Luca and Phil,
Thanks for your insights.
Especially your example, Phil, is very revealing.
I think I now have a direction for further thought. And of course I did not
expect there to be a 'magic silver bullet' answer to the question.
Cheers,
Christian
--
You received this message
Just downloaded and started with Clojure.
Is there a reason that cursor movement does not work in the REPL? I am used
that I can use up-cursor to execute an old commands again.
--
Cecil Westerhof
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
Leiningen is really the place to start, it bundles REPL-y, which includes
these features.
Follow the instructions to install: http://leiningen.org/
Then you can simply 'lein repl' in a project root (with the project's
dependencies) or it'll just open up a basic repl.
On Tue, Apr 8, 2014 at
cursor movement requires readline
library
support, I assume you start clojure by
using
java -cp bin/clojure-
*
.jar clojure.main
you can add readline library via
rlwrap java -cp bin/clojure-*.jar clojure.main
or you can do this using lein https://github.com/technomancy/leiningen,
and start
Hi Webb,
What exactly you mean by '*The point was you aren't using lazy-seq as
intended here since you are always creating a singleton sequence*' ? In my
sum function:
(
defn test-fc
sum of all collection elements using recursion and laziness
[coll]
(letfn [(sum-fc [sum coll]
2014-04-08 14:34 GMT+02:00 Di Xu xudi...@gmail.com:
cursor movement requires readline
library
support, I assume you start clojure by
using
java -cp bin/clojure-
*
.jar clojure.main
you can add readline library via
rlwrap java -cp bin/clojure-*.jar clojure.main
Works like a charm.
On Tuesday, April 8, 2014 7:57:10 AM UTC-5, sorin cristea wrote:
What exactly you mean by '*The point was you aren't using lazy-seq as
intended here since you are always creating a singleton sequence*' ? In
my sum function...I intend to compute sum of elements of a collection.
Hi all,
We released version 1.1.1
today: http://immutant.org/news/2014/04/08/announcing-1-1-1/
We also released version 1.2.1 of the lein-immutant
plugin: http://immutant.org/news/2014/04/08/lein-immutant-1-2-1/
Unless any bugs are reported against 1.1.1, we don't expect to release
another
I sometimes find that after mutating an atom, I want to create some
side-effect that depends on the old and new state as well as the context in
which the change was made. Because of the dependence on context, a watch
doesn't work (unless there's something I'm not thinking of). So I add
things to
See https://groups.google.com/d/topic/clojure/2dHvX7bf7nA/discussion,
http://stackoverflow.com/a/22409846/1756702, where the old and new state of
an atom is returned using the lower-level compare-and-set! operation.
On Tuesday, April 8, 2014 10:41:50 AM UTC-5, John Hume wrote:
I sometimes
Thanks to all for the nice explanations. I understand the reasoning.
On Tuesday, April 8, 2014 1:53:44 AM UTC-7, Colin Yates wrote:
Depends who is doing the expecting as to whether that behaviour is
correct. Formal logicians, mathematicians, computer scientists etc. would
respond sure,
+1 that answer
Also if it served your needs, watches give you the old and new
values
http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/add-watch
On Tuesday, April 8, 2014 11:00:20 AM UTC-5, A. Webb wrote:
See https://groups.google.com/d/topic/clojure/2dHvX7bf7nA/discussion,
So should I open a bug on this map behavior? This also breaks
composability with things like filter because they assume that nil being
returned implies a closed channel, and proceed to close their output
channel...
e.g.
(filter identity (map seq c))
will close the output channel after
Cognitect (and previously Relevance) always seem to have openings for
contract Clojure developers. I was wondering if anyone here has applied
for and/or actually been hired for one of these positions, and was willing
to share their experience?
I have thought about the possibility of being a
On Tue, Apr 8, 2014 at 12:56 PM, Mike Haney txmikes...@gmail.com wrote:
Cognitect (and previously Relevance) always seem to have openings for
contract Clojure developers. I was wondering if anyone here has applied for
and/or actually been hired for one of these positions, and was willing to
Applying too early will never hurt you, so long as you are candid about
where you are and where you want to be. It took me three rounds of
rejection+feedback to land my first high-profile tech job.
The contracting relationship is designed to handle high variability. You
might get lucky and see
Why aren't watches adequate? You could test inside them if you really wish
to create the side-effect based on your context.
On Tuesday, April 8, 2014 12:41:50 PM UTC-3, John Hume wrote:
I sometimes find that after mutating an atom, I want to create some
side-effect that depends on the old
In common lisp I had the following code:
(let (
(difference)
(i)
(val)
)
(loop for i from 1 to 1000 do
(setq val (sqrt i))
(setq difference (abs (- (expt val 2) (* val val
(unless ( difference 1.1755025E-38)
(print (format nil
Does this give you the results you are looking for?
(doall
(for [i (range 1 1000)
:let [val (Math/sqrt i)
diff (Math/abs (- (Math/pow val 2) (* val val)))]
:when ( diff 1.1755025E-38)]
(println (format Different for %d (%e) i diff
cldwester...@gmail.com
I upgraded my emacs and clojure-fill-docstring seems to have disappeared.
clojure-mode is still there and activated but no clojure-fill-docstring.
Before I spend time hunting through changelogs has anybody else noticed?
Is this expected?
--
You received this message because you are
2014-04-08 20:49 GMT+02:00 Toby Crawley t...@tcrawley.org:
Does this give you the results you are looking for?
(doall
(for [i (range 1 1000)
:let [val (Math/sqrt i)
diff (Math/abs (- (Math/pow val 2) (* val val)))]
:when ( diff 1.1755025E-38)]
(println
Hi Colin,
Colin Yates colin.ya...@gmail.com writes:
Before I spend time hunting through changelogs has anybody else
noticed? Is this expected?
`clojure-fill-docstring' behavior was somewhat wrong and the
whole function not necessary, I removed it recently.
That said, there are some quirks.
Hi Bastian, sucks being sick. You mention it was unnecessary - can you let
me know the thing that made it redundant? I tried fill-paragraph but that
doesn't quite work...
On Tuesday, 8 April 2014 20:28:52 UTC+1, Bastien Guerry wrote:
Hi Colin,
Colin Yates colin...@gmail.com javascript:
Colin Yates colin.ya...@gmail.com writes:
Hi Colin,
I upgraded my emacs and clojure-fill-docstring seems to have
disappeared. clojure-mode is still there and activated but no
clojure-fill-docstring.
Before I spend time hunting through changelogs has anybody else
noticed? Is this
Colin Yates colin.ya...@gmail.com writes:
Hi Bastian, sucks being sick. You mention it was unnecessary - can
you let me know the thing that made it redundant?
It was less redundant than weird.
I tried fill-paragraph but that doesn't quite work...
Can you explicit what does not work?
There
Yep - that issue covers the issue. I don't have any other problems other than
that issue.
I shall watch that issue closely :)
From: bastiengue...@gmail.com
To: colin.ya...@gmail.com
CC: clojure@googlegroups.com
Subject: Re: where as clojure-fill-docstring gone?
Date: Tue, 8 Apr 2014
ccm the Cassandra Cluster Manager, https://github.com/pcmanus/ccm, allows the
running up of arbitrary Cassandra clusters from specific version source.
ccm-clj (https://github.com/SMX-LTD/ccm-clj) is a Clojure interface designed
specifically for the ease of use of ccm in Clojure integration
This will only give you one nil:
(doseq [i (range 1 1)]
(let [val (Math/sqrt i)
diff (Math/abs (- (Math/pow val 2) (* val val)))]
(when ( diff 1.1755025E-38)
(println (format Different for %d (%e) i diff)
On Tuesday, April 8, 2014 9:28:44 PM UTC+2, Cecil Westerhof
That last line is the repl printing out the result of the for, which
returns a seq of the return values from the for body (in this case, the
return value of println). If you run this code as part of an
application, you would not see the seq of nils printed. To suppress
printing them in the repl,
On the first question, Other needs its own checkbox.
-- John
On Monday, April 7, 2014 7:26:08 PM UTC-4, Rich Morin wrote:
My spouse (Vicki Brown) has put together a very short survey on wiki
use. If this is of possible interest to you, read on...
-r
The SurveyMonkey page for the Wiki
2014-04-08 22:01 GMT+02:00 Walter van der Laan waltervanderl...@fincite.nl
:
This will only give you one nil:
(doseq [i (range 1 1)]
(let [val (Math/sqrt i)
diff (Math/abs (- (Math/pow val 2) (* val val)))]
(when ( diff 1.1755025E-38)
(println (format Different for
Hi,
* I am aware of core.async. However, I don't like the fact that (go
... ) is a macro, thus forcing the ! and ! to appear in the body,
and I can't do nested things like:
(defn foo [chan]
(let [x (! chan)] ... ))
(go ... (foo ... ))
* For the following, I only need it to work
I think you might be able to use put! with a callback, or (go (! ..))
within foo for a transient go process. Not sure if there's any ill effects.
On Tue, Apr 8, 2014 at 4:51 PM, t x txrev...@gmail.com wrote:
Hi,
* I am aware of core.async. However, I don't like the fact that (go
... )
I'd really like to avoid callbacks. :-)
If cljs had promises, it would suffice. :-)
On Tue, Apr 8, 2014 at 2:00 PM, Gary Trakhman gary.trakh...@gmail.com wrote:
I think you might be able to use put! with a callback, or (go (! ..))
within foo for a transient go process. Not sure if there's any
What exactly are you trying to do? Could you describe the problem you're
trying to solve in more detail?
- James
On 8 April 2014 22:02, t x txrev...@gmail.com wrote:
I'd really like to avoid callbacks. :-)
If cljs had promises, it would suffice. :-)
On Tue, Apr 8, 2014 at 2:00 PM, Gary
Here's what I see in LT:
https://www.dropbox.com/s/nd1xf00sbdwjpgc/Screenshot%202014-04-08%2014.05.06.png
i.e., the correct, expected behavior - exactly the same as in a regular REPL.
Maybe you have some customization in LT that is causing it? Or perhaps one of
your plugins?
Sean
On Apr 7,
I'm guilty of the X-Y problem.
I'm trying to, inside of CLJS, write a simple WebOS.
So I want to simultaneously be able to run things like:
* a notepad app
* an IRC app
* a webRTC video chat app
I have built each of these individual pieces in CLJS, -- but combining
them / having them
Hello world!
I'm a C# developer who recently went to an interview at a major bank here
in NYC and found that they've been using Clojure for their business logic
for over a year already and that got me curious, so I find myself on
unfamiliar territory learning how to program in a functional
On Apr 8, 2014, at 12:23 PM, Anthony Ortiz anthonypa...@gmail.com wrote:
I'm now going through the book 'Programming Clojure'. So far I've seen a lot
of utility/academic examples such as fibonacci but little in the way of an
actual real-world example of a top-to-bottom desktop application
I'm trying to update records in a vector, which match certain criteria.
Record:
(defrecord Item [id name description])
How can I say e.g. set name of element to foo where id is equal 1?
The vector is mutable (ref). I would do
(dosync (commute myVectorRef ))
Can't figure the
I
But 1. Can't find examples with records, 2. Not sure if I can use it to
update a different field than the one I'm using to do the query. In the
examples fields seem to be the same.
Leave off the last path segment and return the full updated record, not
just the new field's value.
--
You
Hi,
sorry I don't get it. I just started learning Clojure.
I did this to remove element with id 1
(commute items #(remove (fn [x](= (:id x) id)) %))
From your statement I understand update-in would work for the update, but I
don't know the syntax. Something like
(commute
Ahh dataprovider/products should be items. Forgot to simplify.
Am Mittwoch, 9. April 2014 00:12:48 UTC+2 schrieb Ivan Schuetz:
Hi,
sorry I don't get it. I just started learning Clojure.
I did this to remove element with id 1
(commute items #(remove (fn [x](= (:id x) id)) %))
From
hrm, update-in isn't meant to be used that way.
Here's an example from clojuredocs:
user= (def p {:name James :age 26})
#'user/p
user= (update-in p [:age] inc)
{:name James, :age 27}
;; remember, the value of p hasn't changed!
user= (update-in p [:age] + 10)
{:name James, :age 36}
The
I would use merge to update the record with the map... but I don't know how
to get it from filter operation. Maybe I should not solve this with 1-liner.
Am Mittwoch, 9. April 2014 00:14:09 UTC+2 schrieb Ivan Schuetz:
Ahh dataprovider/products should be items. Forgot to simplify.
Am
Maybe this will help:
(update-in [[] 2 3 4] [0] (constantly 1))
[1 2 3 4]
(update-in [[] 2 3 4] [2] (constantly 1))
[ [ ] 2 1 4]
(update-in [[] 2 3 4] [1] (constantly 1))
[ [ ] 1 3 4]
(update-in [[] 2 3 4] [0 :a] (constantly :b))
java.lang.IllegalArgumentException: Key must be integer
Interesting. I just removed my LT installation and any config files I could
find, then downloaded a new version and used that - no plugins, no changes
to the configuration - and I still see the truncated string.
On Tuesday, 8 April 2014 15:06:56 UTC-6, Sean Corfield wrote:
Here's what I see
My response had the assumption that this is an example of an X-Y problem
:-).
If you want to literally do what you said, then you can't use update-in
because the value at that point is a seq.
If you have to continue in this way, for some reason, what you probably
want is map-indexed, which
Alternatively, you could sprinkle (into [] ..) to feed the result of
remove/filter back into a vector.
On Tue, Apr 8, 2014 at 7:16 PM, Gary Trakhman gary.trakh...@gmail.comwrote:
My response had the assumption that this is an example of an X-Y problem
:-).
If you want to literally do what
Ah, actually, there's one mistake in my responses, you want to change out
the element based on id, not index, in which case I'd simply recommend map
or mapv. Just remember anytime you change one thing you have to iterate
over the whole vector, worst-case, O(n).
If you use a map of :id to record,
Hi, Ivan.
(defn set-item-name [data id newname]
(mapv #(if (not= (:id %) id) ; - NB mapv keeps it a vector
% ; no-op
(assoc % :name newname))
data))
(dosync (commute items set-item-name 1 foo))
This really only makes sense if :id is *not*
Clojure wrapper for the mongo-db java api
https://github.com/aboekhoff/congomongo
New in this release:
• change default Clojure version from 1.5.1 to 1.6.0 (we still support
back to 1.3.0)
• update Java driver to 2.12.0 to support MongoDB 2.6.0
• support :write-concern
What is going to fulfill a promise? How will you know when a promise is
fulfilled. In a single threaded VM like JS you're stuck with callbacks.
Nothing short of full program transformation will give you any better
experience than core.async.
A good way to look at it is this...if you do this in
I haven't built anything with OM or react as yet. But I have read about it
and I like the model in principle.
A thought which repeatedly pops into my mind when I read about this is -
ok, react in written in js. which is great for the web. What would happen
if it were written in Clojure and
I had the same issue and solved it by having 3 source paths:
- src (containing the app)
- src-dev (containing the dev version of the logging ns)
- src-prod (containing the production version of the logging ns)
cljsbuild development builds use source paths [src src-dev] and
production builds use
65 matches
Mail list logo