If one used those preds to try putting values on the channels one is asking
about, then yes, that would generate a classic nasty check-then-act
scenario:
(when-not (closed? c) (! c 42)) ;; Value could be never put, in face of
interleavings
Programmers experienced in concurrency should have
Consider a happy, oblivious producer of values:
(def c (chan 42))
(go (while true (! c (rand
It doesn't know where/now the channel is consumed (which part of the point
of channels/queues). However, we *do* know that at some point, nobody will
need the result of our producing, so we should
As you can read here:
http://martintrojer.github.io/clojure/2013/07/07/coreasync-and-blocking-io
doing blocking IO in a go block should be avoided. So I was thinking that
an alternative to non-blocking IO APIs is using agents and channels.
The following sample program intends to illustrate the
Took me a while to get the idea but higher-order channels are brilliant -
that way one ensures a given reply was actually targeted at one's request.
Thanks for the suggestion!
Faux-agents would have the limitation of not being to (reasonably) perform
blocking I/O - which is the point of my
I'm implementing a program D. Hofstadter describes in *Fluid Concepts: *
https://github.com/vemv/jumbo/* *Even in the original text,
concurrency/parallelism is a crucial part of the domain so Clojure is super
well-suited.
While visualising the carried-in process is not a goal of the project
I recall from Rich's presentation on reducers (and it's intuitively true
anyway) that FJ is not well suited to all workloads: uniform ones would do
just fine with a fixed allocation of tasks to threads. I believe the
tradeoff in that case is that one has to manage parallelism very explicitly.
Yeah being able to reuse names is part of the point of namespaces :) it makes
me sad when libraries use ugly names like megaref (for ref) or alter!! (for
alter) instead of exploiting this fact.
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
Nobody wants to store every regexp in a separate file.
That's because regexes are 'atomic' - you don't place Clojure expressions
in the middle of them. SQL or math are vastly different from that. As for
SQL, it *is* common practice to store them as isolatedly as possible.
I have not
- doc strings with examples could be more human readable
(defn ^{:examples '[(with-out-str (clipboard (doc distinct)))]
clipboard [x] ...)
Just if a mechanism like this were used more widely... we'd get syntax
coloring for free, and a facility for programatically querying examples.
.
On Monday, March 18, 2013 12:50:13 PM UTC+1, Marko Topolnik wrote:
On Monday, March 18, 2013 12:35:31 PM UTC+1, vemv wrote:
Nobody wants to store every regexp in a separate file.
That's because regexes are 'atomic' - you don't place Clojure expressions
in the middle of them. SQL or math
Python has a notation for raw strings
Python also has multiple inheritance :) what I want to mean is that some
features have dubious value, regardless of whether they made it to language
X or Y.
I'm working on a project right now where the lack of raw strings is
killing me.
Do
Daniel,
Starting from today and until March 29 organisations can send their
applications. Which date will you pick?
Thanks,
Victor
On Thursday, February 14, 2013 7:03:58 PM UTC+1, Daniel Solano Gómez wrote:
Hello, all,
It's official: Google Summer of Code 2013 is on.
Last year, Clojure
Starting from today organisations can send their applications, so you may
be running out of time for posting ideas!
I just pointed out this at the main thread
https://groups.google.com/forum/?fromgroups=#!topic/clojure/vDiha4tYC_s
On Saturday, March 16, 2013 6:00:44 AM UTC+1, Chris Bui wrote:
Given that you like webdev, you may be interested in improving cemerick's
Friend library. There are a bunch of interesting features yet to be
implemented!
On Saturday, March 16, 2013 6:00:44 AM UTC+1, Chris Bui wrote:
Hi everybody, I'm a student looking to apply for GSOC 2013. I'm trying to
All class-generating Clojure constructs that one can use at runtime such as
proxy, reify, or defrecord, seem to generate instance methods only.
gen-class can emit static methods, but one cannot leverage its
functionality at runtime.
Any way to accomplish this?
--
--
You received this
Related with my immediately previous question (generate static methods at
runtimehttps://groups.google.com/forum/?fromgroups=#!topic/clojure/Hu-oOlSccPc),
but not the same.
There's a Java lib which I import and run from a Clojure repl. In that
repl, if I perform e.g. (defrecord Foo []), then
:
2013/3/17 vemv ve...@vemv.net javascript:
I guess that somehow the Java library uses a different classloader or
something like that? Any possible solution?
Clojure itself uses a separate classloader: a
clojure.lang.DynamicClassLoader instance.
If you can use an instance
not access a member
of class vemv.NGSession with modifiers public static volatile
sun.reflect.Reflection.ensureMemberAccess (Reflection.java:95)
Fortunately I could reproduce the issue isolatedly, in the following class
which has no dependencies/etc: https://gist.github.com/vemv/5180168
If I try
Ahhh I tracked it down - the class was not public. I thought .java files
had to define at least (and at most) *one* public class/enum/interface.
How much sense can it make to define a private class in its own file? :(
On Sunday, March 17, 2013 5:54:58 AM UTC+1, vemv wrote:
The relevant Java
A bunch of bugfixes have been introduced since 2.0.0 which I need ASAP for
the projects I'm working on.
How to use the development version of Lein?
One cannot perform lein upgrade 2.1.0-SNAPSHOT.
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
(defprototocol P ...) does two things: define a map on the current
namespace, and generate an interface on a package that will have the same
name as the current namespace.
(defprotocol P (x [_])) ;; - P
(class P) ;; - clojure.lang.PersistentArrayMap
(:on-interface P) ;; - user.P
(.isInterface
On the Clojure side the only thing you can do is to serialize writes to the
resouce (the db connection). So at most one thread can be performing an
update operation, at a given time. You can increase concurrency by
mantaining read-only db connections (most likely in an
ad-hoc/by-convention
Two queues cover the 80% case: an implementation of BlockingQueue (array,
linked list backed), and clojure.lang.PersistentQueue.
The former provides concurrency semantics: there are no 'stale values'
issues associated to mutation, and you can choose whether your reads/writes
are blocking
I believe protocols can entirely alleviate the need for feature expressions.
On Saturday, February 16, 2013 5:28:59 PM UTC+1, Mimmo Cosenza wrote:
Hi all,
the more I learn cli/cljs the more I find myself in looking for libraries
running on both sides of a clojurean web app. hiccup/valip, c2,
IIRC they're building it in such a way it can be extended via plugins. So
just wait :)
On Friday, March 1, 2013 6:04:50 PM UTC+1, Charles sanders wrote:
Is there a way for outsiders to contribute to lighttable ?
On Fri, Mar 1, 2013 at 9:03 AM, Mark C cham...@netscape.net javascript:
wrote:
So I was playing with AOT for the first time. My main reason to use it is
so the consumer Java code doesn't look so alien / run-timey.
The thing is, I encountered that the following line causes `lein compile`
to hang:
(defn -server [] (jetty/run-jetty #'app {:port 8000 :join? false}))
So I was playing with AOT for the first time. My main reason to use it is
so the consumer Java code doesn't look so alien / run-timey.
The thing is, I encountered that the following line causes `lein compile`
to hang:
(def server (jetty/run-jetty #'app {:port 8000 :join? false}))
(for
Looks like refs are not particularly the best tool for the job in this case
- those values aren't going to change a lot right? And they could be
expressed as a single hashmap - removing the needs for transactionality.
Answering to your question, it is impossible to reach the (when...) without
Being *x* is the function you use for switching between buffers, one can
add a hook to *x* that will perform a nrepl-eval-ns-form, or more
sophisticated stuff like adding a :reload clause, sending the ns form to
the nrepl console as well, etc.
--
--
You received this message because you are
Your additional points make more evident the need to put some final effort
on the design of ExceptionInfo - leaving it alpha would be pretty
unfortunate.
On Monday, February 18, 2013 2:05:39 PM UTC+1, Dave Sann wrote:
I don't expect this to go into 1.5.
But the point raised by vemv
While there are other possible uses
(examplehttps://twitter.com/borkdude/status/302881431649128448),
I see myself mainly using as- as a mechanism for resorting to thread-last
within a thread-first expression.
For example, given
(- [[1 1 1] 2 3] (nth 0))
I might want to add an operation that
Couldn't clojure.lang.ExceptionInfo be imported by default? That'd surely
help making ExceptionInfo the idiomatic exception to be thrown.
On Thursday, February 14, 2013 4:33:42 AM UTC+1, stuart@gmail.com wrote:
If you care about Clojure 1.5 compatibility for your codebase, please test
it
instance easily by using the core fn
`ex-info`. So something like ... (throw (ex-info {:foo bar})) works
fine. ~BG
On Sun, Feb 17, 2013 at 10:05 PM, vemv ve...@vemv.net javascript:
wrote:
Couldn't clojure.lang.ExceptionInfo be imported by default? That'd
surely
help making
fn's keyword arguments feature provide unrolled, optional key-value args:
(defn foo [ {:keys [a b c]}]
[a b c])
(foo :c 4) ;; [nil nil 4]
On Sunday, February 17, 2013 10:06:13 PM UTC+1, AtKaaZ wrote:
Was there a library or some other way to pass ie. maps to functions
so that the order of
You can increase the chances of generating discussion by boiling down both
the relevant content of paper and your program to a minimal, self-contained
form.
Cheers - Victor
On Friday, February 15, 2013 4:05:09 PM UTC+1, thattommyhall wrote:
A few months ago I reread Simon Peyton Joneses
First of all, I must say I'm new to testing in Clojure. My current workflow
is pretty simple:
* Edit + save the tests (which use clojure.test - I hear Midje is better
though) in emacs
* Run `lein test` in the terminal
* recur
But then the printed values (triggered when e.g. an `are` case
I never tried out core.logic. This is how I just got it installed in less
than a minute. Really no magic here:
lein new foo; cd foo
# google core.logic, grab the dependencies vector ([org.clojure/core.logic
0.7.5]), attach it to your project.clj
lein repl
(use 'clojure.core.logic)(run* [q]
12:26:15 AM UTC+1, Jules wrote:
Sure, but you have assumed that you have a perfectly working clojure
environment set up. *That* is the hard part.
On Friday, February 15, 2013 12:19:34 AM UTC+1, vemv wrote:
I never tried out core.logic. This is how I just got it installed in
less than
You want either `reduce` or `loop` as the control flow construct, and
`conj` for appending items to a collection (without resorting to
mutability). Have a look at them, they're pretty well covered in the
available books, tutorials etc.
Hope it helps - Victor
On Friday, February 15, 2013
Glad to hear that Phil! You're entirely right - I didn't realise that
distributing jar to Java consumers doesn't imply AOT-compiling the
libraries at all.
David, on your implementation - I may be missing something, but why not
just vary-meta each collection found in the bindings?
Also, it
Define an API in terms of messages
I'm not familiar with the concept - just out of curiosity, what does a
mesagge-based API consist of? Is the drastically different from most
REST/JSON web APIs out there?
Thank you - Victor
--
--
You received this message because you are subscribed to
I like the parentheses better. My only complaint is that I have to press
the shift key to type them.
You can always remap your keyboard / keyboard bindings. For example in
emacs:
(define-key clojure-mode-map 9 'paredit-open-round)
--
--
You received this message because you are
Going the build route, probably use maven to produce debug and production
artifacts of differing versions: blah-1.0.0-DEBUG.jar and blah-1.0.0.jar.
My thoughts too. And there's no need for convention madness - e.g.
Leiningen could transparently create those versions to the user: the
:18:54 PM UTC+1, vemv wrote:
Given that: a) fns can have names for debugging purposes, and b) data
structures can have metadata, wouldn't it be a good idea to let let auto
attach (where possible) the names of the bindings to their corresponding
values?
For example, the improved let I'm
Given that: a) fns can have names for debugging purposes, and b) data
structures can have metadata, wouldn't it be a good idea to let let auto
attach (where possible) the names of the bindings to their corresponding
values?
For example, the improved let I'm thinking of would translate this
The issue is more like, Apple forbids using development tools other than
those they foster.
Relatively succesfull efforts have been made to compile Clojure to ObjC,
but they aren't legally usable in practice.
On Tuesday, January 22, 2013 8:27:51 PM UTC+1, JSchmitt wrote:
On Tue, Jan 22, 2013
repl-y (Lein's default repl) only shows the first line of the stack trace
rather than the whole thing. nrepl.el can optionally behave the same.
It's a good default - as I see it, it relieves 90% of the pain associated
to errors in clojure.
As for the contents of those first-lines - it often is
The traditional project explorer / directory tree I use is dirtree:
https://github.com/zkim/emacs-dirtree - with a couple of tweaks I found it
to be very useful.
It is based on tree-mode. There are other available file browser plugins
based on it.
--
You received this message because you are
I was just wondering - given that we have the #() and #{} literals, why not
a #[] as well? Queues look like a good fit.
--
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
One man's composition is another's conflation - someone on Twitter
I don't necessarily agree with the opening quote, but I thought it was an
interesting one :)
It is not uncommon to hear/read from the Clojure commmunity that X
complects a with b, hence X is bad, without giving further
Surely because Fogus was in process of upgrading it :D
go check it out now!
http://dev.clojure.org/display/community/Clojure+Success+Stories
On Friday, December 14, 2012 3:34:23 PM UTC+1, Jeff Heon wrote:
I'm asked to log in now to access this page.
On Thursday, April 28, 2011 11:03:53 PM
Thanks for the answer Herwig!
swank-clojure and nrepl(.el) can do pretty amazing things. But in my
opinion, at least in the context of Java interop there is still work left
to do...
Lastly, as of today, what can clojurescript do that clojure can't?
On Saturday, November 24, 2012 11:36:50 PM
While coarse-grained imports are pretty obviously a suboptimal practice, I
believe the lack of some this possibility (in at least some form) hinders
exploratory programming / API discoverability.
Would it be feasible to add an :as directive to 'import? An use case:
; --- state of the editor at
Hi Tim,
I followed your recipe and unfortunately it doesn't work - one keeps
waiting for the output at the repl.
The `foo` namespace seems to be loaded twice. So I modified index.html to
load main.js only. This doesn't fix the issue though.
Could you please verify this?
Thanks - Victor
On
Hello there,
I'm not quite sure whether is convenient for each method implementation to
possibly shadow previous names, particularly those of clojure.core.
(defprotocol Example
(get [this]))
The previous example redefines get in the current namespace. But is that we
usually mean by
Correction: records/types actually include plenty of dot-accesible methods,
though less than lists -for instance- do.
(mapv println (.getMethods (.getClass (ARecord.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send
Would it be feasible to efficiently make them first class? Surely this
isn't a new question, as many would desire to write
(mapv .toString (range 10)) rather than (mapv #(.toString %) (range 10)).
Couldn't find info on that topic...
*(just an example, I know there's str)
On Monday, September
Hi Matthias, I can't disagree with you, and am open to change my mind. Just
a question. Given again this example:
(ns protocols)
(defprotocol P (get [_]))
(ns app)
(defrecord R []
protocols/P
(get [_]
42))
(can you call R's get without resorting to dot-notation, this is, with a
This issue best illustrates how imperative and functional thinking differ.
When I write code such as
(map not [true false])
, I implicitly think imperatively: compiler, please traverse this
collection, applying 'not to each element
I could also word my thoughts functionally: I desire the
There are few -if any- concepts attached to REST; it is just a low-level,
ideologically-neutral technique. There is more than one way to do it,
hence you really can't talk 'against' it any more than you can talk against
hashmaps, for instance.
That said, getting RESTful design right is pretty
Tried it. It's not hard to see how it can be one little practical app worth
its price. Thanks for sharing Evan!
--
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
61 matches
Mail list logo