I know there have been some recent improvements surrounding reading and
writing data structures. Is there a way to just say, Convert this to a
string that corresponds to the way it prints at the REPL?
I think you're looking for pr-str. For example:
(pr-str (take 10 (iterate inc 0)))
;;= (0 1
I need to start a ring server from an upstart script on Ubuntu. Normally I
would use an uberjar and execute java directly, but in this case I cannot do
AOT and would like to simply run lein ring server-headless from my upstart
script. Even when I use lein trampoline I get respawning too fast
Relatively succesfull efforts have been made to compile Clojure to ObjC, but
they aren't legally usable in practice.
Why wouldn't a cross compiler be legal? There are tons of apps in the
App Store that were originally written in C# and Lua (lots of game
frameworks compile down from higher level
There was a bug that prevented drip from working with preview10.
That's been fixed. Then for a while the drip JAR was distributed as
compiled by Java 7, which failed silently when run on older JVMs.
That's also been fixed now.
I've been using it successfully for the last few days now.
So if you
I know very little about the JVM eco-system. I have been using lein
uberjar for all of my webapps, and it has worked great (Jetty/Ring).
Why would I use uberwar? What are the advantages?
A WAR file can be dropped right into a app server like Tomcat. It
contains some extra context information
On Wed, Dec 19, 2012 at 9:52 AM, Jonathon McKitrick
jmckitr...@gmail.com wrote:
I was wondering if I could make changes in emacs, C-c C-k, and refresh the
web page to see the results.
You'll probably want to use ring-serve for this. To some degree
lein-ring also offers this functionality as it
I've done this for a project in Emacs, and Slime needed to get
slightly confused sometimes. As I recall the buffer names got out of
sync with the filenames somehow or something like that. Has anyone
gotten this working smoothly with Slime or nrepl-el?
It works well even with the minor quirks.
(.send goog.net.XhrIo action callback 'POST' serialized )))
You are using the clojure symbol 'POST' not the string POST. Switch
to double quotes and I bet it works.
jack.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
(zf/xml- zipper :ListRecords :record :metadata :oai_dc:dc :dc:language
zf/text)
This would require a namespace aware thing, but a possible syntax for
this (called Clark notation) is to use the URI of the namespace
instead of the prefix:
(zf/xml- zipper :ListRecords :record :metadata
I don't know if the Emacs clojure-mode is user-configurable in that way. I
haven't needed to change it. Most Clojure users seem to indent in pretty
much the same way, fwict, which is probably pretty close to how Emacs does
it automatically. I haven't tried Eclipse.
All the lisp and scheme
scenario. The minute forking occurs however you lose coordination
capabilities (at least this is my understanding). He said it very casually
in the video that is why this has been bugging me so much...
Fork/Join is just threads, so I'm not sure why you'd lose coordination
capabilities. You
user= ('X 'Y)
nil
All of these are as I expected except the last, which I thought would throw
something like the 1st case. What's going on there?
You've prevented X from being evaluated (it will be seen as the symbol
X), but you haven't prevented evaluation of the function call. Symbols
I did just that, but I don't get any speedup with leiningen. All I can
see is that after every leiningen command, drip ps shows one process
more. For example:
This is also happening for me. Is there some way to configure drip to
ignore certain arguments?
jack.
--
You received this message
I did just that, but I don't get any speedup with leiningen. All I can
see is that after every leiningen command, drip ps shows one process
more. For example:
This is also happening for me. Is there some way to configure drip to
ignore certain arguments?
I added a way to specify options
user= (defmulti collide classify-colliding-things)
You want (defmulti collide #'classify-colliding-things)
Binding to the var instead of the value will allow it to be udpated.
jack.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
So far, everything is working as I thought. But I also thought that apply
let me run a function on everything in a sequence. Other than str, I could
not get this to work:
user (apply #(println %1) @visitors)
I think you are looking for direct invocation:
(#(println %1) @visitors)
your
I've released a new version of lein-daemon. daemon is like 'lein run',
only it runs the process in the background rather than blocking.
0.3 and up is a complete re-write, that no longer depends on apache
commons daemon. The new version has no dependencies on any external
programs.
For
So taking up the task of insuring correctness/consistency but leaving aside
static typing as is typically practiced. How can we best catch errors and
inconsistencies in our code before our end users do? How can we do this
better than any competing system (like Haskell)? How quickly can
(defmacro vmap [coll f] '(map ~f ~coll))
This needs to be backtick, not single quote.
(defmacro vmap [coll f] `(map ~f ~coll))
jack.
--
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
What do I do if I have to instantiate two things that uses the same
dynamic binding at the same time. Using the java.jdbc example, what
if I wanted to run multiple selects from db-1 and insert each result
into db-2? Do I need keep calling (sql/with-connection db-2 ...)
after each select
(when-let [s (seq coll)]
(let [run (cons (first s) (take-while #(not= value (f %)) (next
s)))]
(cons run (partition-when f value (seq (drop (count run) s
)
)
)
)
...
What test?
(seq coll) is the test here. when-let (and if-let, etc) bind only when
the right
This probably just shows my naivety, but what do you mean unifying c
earlier? The order of forms in a `run` clause don't matter, right?
There's an explanation of it in the talk that Friedman and Byrd gave
at the Conj:
http://blip.tv/clojure/dan-friedman-and-william-byrd-minikanren-5936333
If I apply the following function to 4 and 6
(defn arith [x y]
(map (fn [op] [(op x y) `(~op ~x ~y)]) [+ - / *]))
I'd like to get a result of the form
([10 (+ 4 6)] [-2 (- 4 6)] ...)
but instead I get something like
([10 (#core$_PLUS_ clojure.core$_PLUS_@4f6de641 4 6)] ...
You want to
What's going on?
Symbols, like keywords, are functions that look themselves up in maps.
In the 2 arg version, you're supplying an invalid map and a not-found
value, and it's returning not-found. In the 1 arg version, it returns
the default not-found of nil.
jack.
--
You received this message
I'm looking for a parser generator library. I stumbled upon fnparse, but
unfortunately it doesn't work with clojure 1.3.
I ended up just using ANTLR and it works pretty well from Clojure.
Most of my time was spent on the grammar and implementation, not the
ANTLR integration bits.
I started
The instructions in the git repo don't work for me either, but
M-x clojure-mode-font-lock-setup
M-x font-lock-mode (turning it off)
M-x font-lock-mode (turning it back on)
does. The suggested (add-hook 'slime-repl-mode-hook
'clojure-mode-font-lock-setup) does not work either.
You can
doesn't show any effect of the for.
The only difference is the additional statement at the end.
I can not imagine how this statement sequentially behind can influence
the for.
for returns a lazy sequence. In the first case, in printing out the
result to the REPL, the lazy sequence is
An alternative solution to trying to make macros opaque is just to
disallow the macros which depend on disallowed functions. It should be
a relatively simple matter to generate this list programmatically from
clojure.core source. So instead of just saying You can't use count.
It would say You
I'm solving the following exercise and when I'm trying to use the answer:
#(reduce + (for [x coll] 1))
I get the error saying that I was using count which I'm not. Someone
knows why is that? Is this a bug in 4Clojure or something in the language
that I cannot see?
If one of the macros
The main feature in this release is Derek Mansen's work integrating
clj-stacktrace into the debugger frames, so now you can get stack traces
with alignment and colorization. I'm very excited about this release
since it's a significant usability improvement: http://imgur.com/fD3rA
I get the
Is there a technical reason that there is no (extend-type object ...)
in ClojureScript?
I just found myself implementing several protocols on the native
object to get better host interop, but it occurred to me that if it
was this easy, surely it would have already been done.
If there is no
I've noticed that swank (which I run in emacs using M-x clojure-jack-
in) doesn't pickup changes to the classpath on-the-fly. For example,
if I update my leiningen project.clj with a new dependency and run
lein deps, I need to restart swank to have it use the library. Is
there a way to load
Unfortunately, I'm not sure a game as small as asteroids would
work well to have multiple people working on it. Simply because each
part of the game (graphics, physics, gui, etc.) are all so small, that
multiple developers would just step on each other's toes.
What we need is a Clojure game
for example, right now i have a record called gameentity which
contains a position, the current health, speed, the polygon
representation which should be rendered and a few more things - but
haven't figured out yet where to put the logic and how to apply it so
that everything is easily
However I would recommend against
everything is a polygon route. Once again, for a simple game, this
may be fine, but you're now making an assumption: everything is a
polygon. What if you want a simple laser point-to-point entity? What
if you want a planet that is represented by a circle?
Also, I wonder if there are any existing realize type functions?
i.e.
(realize (filter ...))
This is what doseq, dorun, and doall are for.
jack.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Thoughts?
I like it. +1 to it going in sooner rather than later.
jack.
--
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 members are moderated - please be patient
Hi,
I discovered this testing some code this evening:
(String/valueOf nil) ; throws NullPointerException
(#(String/valueOf %) nil) ; null
Another formulation of the above (courtesy of brehaut in IRC):
(let [s nil] (String/valueOf s)) ; exception
(let [s nil] (String/valueOf ^Object s)) ; null
user = s1
(s1 (s2 s3) s4 s5 (s6 (s7 s8) s9))
How to convert s1 to a flat sequence like this:
(s1 s2 s3 s4 s5 s6 s7 s8 s9)
(flatten s1)
jack.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I'm having some trouble attempting to use interop with ClojureScript.
I'm trying to translate examples from the Closure book into
ClojureScript, and I keep getting stuck on various things.
1) When using goog.testing, it appears that I can't access
goog.testing.TestRunner and goog.testing.TestCase
Hm it seems like what he did was a bit extreme. Would you do it that
way? In Clojure you could just use atoms and all would be well, right?
My game is going to be quite a bit more complex than Pac-Man, the game-
state is going to be way more complex.
His stated goal was to provide examples of
Widgets that work identically [and correctly!] on all browsers +
You get widgets through goog.ui, which is part of Closure Library.
There are no special wrappers in ClojureScript for this yet, but the
infrastructure appears to be in place.
Custom widgets
You can write new goog.ui widgets, and
- On page 2 of the Closure book, there is a workflow figure on using
the Closure tools, how would ClojureScript change this workflow? It
would be great to post such a modified diagram to the closure wiki.
Some quick notes on this:
1) calcdeps.py and the compiler are taken care of for you by
Rich, the pseudo class model with the new keyword is a syntactic
obfuscation, semantically javascript is prototypical inheritance. It's
class free. In addition to the pseudo class inheritance advocated by
google closure and the prototypical inherent in javascript, others
like Doug Crockford
I'm exploring clojurescript and wondering how to use an external
library? In my particular case, I was trying to use Soy from Closure
Templates.
I realize that arbitrary third party libraries will need to fit into
the Closure Compiler ways, and part of my exploration is trying to
port some of my
You use js* like here
https://gist.github.com/1098417
See how jquery is being pulled in
Unfortunately this means that my external JS lib won't get any
benefits from the closure compiler. Is there some way to tell the
compiler where more external libs are and then use them via :require
just
I'm working through Closure tutorials translating them to
ClojureScript. Unfortunately, I've hit a problem where the code works
with {:optimizations :simple} but fails with {:optimizations
:advanced}.
The code is very simple. It basically is a trivial template example
with Soy (from Closure
You can use the :libs key in the options which are passed to build.
Thanks very much for this pointer. That worked like a charm.
jack.
--
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
48 matches
Mail list logo