Since there seems to be interest in the exact mechanics:
For every special form there exists a subclass of Expr in the clojure
compiler, which represents the special form in the analysis result. Every
such class directly implements the behavior of the special form in terms of
compiler
if-let and when-let also come in handy in a lot of those cases.
If the nils already are in a data structure, there are (filter
identity ..)and (remove
nil? ..) to remove false and/or nil values from sequences.
On associatives, there is an :or key available in the destructuring dsl: (let
[{x :foo
2013/3/13 Mark Engelberg mark.engelb...@gmail.com
Still, it would be nice to understand whether it's possible to achieve the
same effect as Clojure core's settable vars.
It is, because clojure doesn't do anything magic here (apart from the
effects its set!-able vars have ;-).
The catch is:
FWIW, I've just built jdk8-b78 on my linux machine (due to the oracle build
being unavailable) and everything seemed to work:
%
JAVA_CMD=~/checkout/openjdk8/build/linux-x86_64-normal-server-release/images/j2re-image/bin/java
lein version
Leiningen 2.0.0 on Java 1.8.0-internal OpenJDK 64-Bit
This special handling technique is known as a compiler macro in
clojurescript (and elsewhere). Essentially, all direct calls to instance?
get emitted as an instanceof expression for performance.
Higher order uses behave as expected:
user= (apply instance? Long [])
ArityException Wrong number of
Also direct calls are only handled, if the first arg is a symbol that
directly resolves to a class:
user= (def C Long)
user= (instance? C)
ArityException Wrong number of args (1) passed to: core$instance-QMARK-
clojure.lang.AFn.throwArity (AFn.java:437)
Starting from this, I just discovered
2013/2/27 Ben Evans benjamin.john.ev...@gmail.com
To add a bit more light on this, my JDK 8 Mac build is from the lambda
repo, so may have changes which are ahead of mainline JDK8 (to
Herwig's point).
Tried lambda-8-b79-linux-x64-25_feb_2013.tar.gz from
http://jdk8.java.net/lambda/ it works
way to trace the process? How would I
work out what's going on in a given case?
On Thursday, February 21, 2013 6:59:33 PM UTC, Herwig Hochleitner wrote:
Both are true.
The type function doesn't have a primitive version, so its argument gets
auto-boxed.
--
--
You received this message
Both are true.
The type function doesn't have a primitive version, so its argument gets
auto-boxed.
--
--
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
2013/2/21 Phil Hagelberg p...@hagelb.org
Unless you want to clear the cache manually every time your dependencies
change, you'd have to make a parallel tree of jars for each version of
Clojure you plan on using.
Ah yes, I forgot that clojure code may compile differently, depending on
the
I agree that unchecked-multiply should do an unchecked multiply, even when
faced with objects. Going to bring that up on clojure-dev.
A workaround: (unchecked-multiply (long seed1) 0x5DEECE66D)
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
2013/2/17 Geo ggrigor...@gmail.com
So how come Clojure's get and count don't incur the reflection penalty?
Clojure's collection functions do a typeof dispatch for JVM types. In a
bootstrapped clojure, that would be solved with protocols.
E.g.
I have successfully used ClojureScript to write a Car2Go App for
Blackberry: http://appworld.blackberry.com/webstore/content/19205189/
The big challenge there was actually the volatile platform (mandatory
battery pulls after reading the geolocation anyone?), while ClojureScript
has played along
Also, my dev setup:
- two build profiles via lein-cljsbuild: one debug, one optimized
- lein ring server for local dev, handler accepts ?debug=true
- lein cljsbuild auto in the background
- occasionally a browser-repl in emacs inferior-lisp
The main difficulty regarding ClojureScript itself is
2013/2/12 ckirkendall ckirkend...@gmail.com
I recently added support for xpath and custom selectors in addition to the
standard ccs3 selector. I added these to get around some of the
limitations of goog.dom.query and querySelector. I would be interested in
your specific use case to see if
2013/2/12 ckirkendall ckirkend...@gmail.com
I would be very interested in your code. Awhile back I did add support
for most enlive selectors to enfocus. So you can use something like [:td
:#id1] in your enfocus templates.
Have a look at https://gist.github.com/bendlas/4942735
Feel free to
+1 for Brandon's response
Additionally I'd like to note that it's not strictly necessary to have IF
as a primitive.
You can build IF out of thin lambda, by defining TRUE as a function calling
its first argument and FALSE as a function calling its second argument.
In a strict language like
2013/2/8 vemv v...@vemv.net
Do you see such a mechanism being incorporated to clojure.core/let -
should I open a ticket?
Only for debugging and not before it has a proven implementation. For
production, we actually want less metadata. At least in memory constrained
environments like android.
I'd use sockets (or even pipes, if you really don't need any flexibility in
the setup),
it doesn't get much simpler than that.
They just work.
cheers
2013/2/7 JvJ kfjwhee...@gmail.com
I'm looking to do some simple messaging (json strings) between programs
running on the same machine. One
On Feb 4, 2013 7:58 PM, Dave Sann daves...@gmail.com wrote:
The syntax does complect in one case.
When you really do want a list as opposed to a function call. hence quote
and (list ...)
The evaluation rules are clojure's implementation of reduction in lambda
calculus.
Every clojure form has
Clojure has a feature called locals clearing, which sets 'coll to nil
before calling reduce in test1, because the compiler can prove it won't be
used afterwards.
In test2, coll has to be retained, because reduce is called a second time
on it.
2013/2/5 N8Dawgrr nathan.r.matth...@gmail.com
If
Me:
No
Well, actually Ambrose of core.typed has proposed an interface to let the
compiler know about type information.
That seems to make it conceivable to mark functions as pure, hence,
implement the optimization you proposed, Jim.
Sorry if my first response sounded a tad negative, btw
According to the Implementations page of the edn wiki [1], libclj [2]
seems to be a possible starting point for that plan.
[1] https://github.com/edn-format/edn/wiki/Implementations
[2] https://github.com/brandonbloom/libclj
2013/2/5 Matthew Phillips mattp...@gmail.com
Hello,
a quick search
2013/2/4 Sergey Didenko sergey.dide...@gmail.com
My point is to introduce a second-class syntax to attract orthodox
users. Definitely not migrating.
OK, I can see how I missed that point. I would say then: go ahead,
transform a couple of clojure source files to that style and see, if you
can
I can't see the community migrating to such a syntax, even if somebody
bothered to implement a reader for it.
For me, the parentheses are vital in editing my source code. With lisp, I'm
editing faster than with any other language, thanks to paredit.
Regarding people seeing parens as an obstacle:
There actually is a standardized value for no value in clojure: nil
The reason it's not useable as such in some places, is exactly it being
standardized.
Were we to introduce another such non-value, e.g. #blackhole, I think the
following would happen:
- people would be horribly confused on
When you find non-idiomatic code in clojure's impl, the reason is almost
always performance.
In this case the clojure.string version is more performant since it saves:
1) the allocation of a lazy seq over the characters of the string
2) the allocation of a java.lang.Character for every char in the
IMO there is little value in big dependency hair-balls and gui tools
leakily abstracting devop taks.
There is, however, value in curated sets of independent libriaries that
work well together. Also in having declarative syntax available for common
tasks.
Still IMO, Clojure's web story is still
I'd try to run a lein repl in a terminal widget.
Maybe http://code.google.com/p/qterminal/ does the trick?
2012/12/28 Fred Eisele phr...@gmail.com
Systems have customization languages.
Python seems to be the current darling.
I would like to know how to implement a Qt widget containing the
I've created a test harness for this as a leiningen plugin:
https://github.com/bendlas/lein-partest
You can just put
:plugins [[net.bendlas/lein-partest 0.1.0]]
into your project and run
lein partest your.ns/testfn 6
to run 6 threads/processes in parallel
The plugin then runs the
In my very incomplete understanding, the main difference between datalog
and core.logic is that datalog is set-oriented and core.logic is
tuple-oriented. Also datalog is designed to join and filter on external
datasources, while in core.logic, fresh vars (i.e. join points ??) also can
be created
You could add check for other keys than :then and :else being used.
For documentation, I'd add a docstring Macro, similar to if but with
branches labeled by keywords :then, :else. + the usage examples you posted.
Also, have you looked at cond and if-not?
Using cond to me feels like labeling the
In clojure, as in java, you can compile against a stub class and run
against the real class with the same signature.
2012/12/6 Vladimir Tsichevski tsichev...@gmail.com
Hi,
I'm using CCW to compile Clojure to java classes.
I have to compile a static class method call like this:
One more strange fact: When you remove third-party, but run with the
released closure-library, you don't see the warning, but repl still doesn't
work. Thinking of it, I have run into that before.
So my theory is, that the build with the plain goog.jar fails because its
deps.js refers to
Am 04.12.2012 09:41 schrieb David Nolen dnolen.li...@gmail.com:
I believe this error is because you're not including the google closure
third party jar as a dependency.
Yes, this is http://dev.clojure.org/jira/browse/CLJS-418
--
You received this message because you are subscribed to the
I managed to get your example to work by copying the third-party jar into
lib/
One thing I ran into: Do a `rm .repl/ out/ -r` between runs, especially
when compiles have failed.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group,
The page in the iframe contains the REPL implementation for the browser.
It's compiled and optimized with its dependencies.
Therefore the client runs in its own window object, isolated from problems
including global identifiers, modified prototypes, differing library
versions and compilation
I think this is a great addition to the ecosystem, thanks!
Right now I'm considering doing a small game, just to give it a try.
2012/12/2 Mikera mike.r.anderson...@gmail.com
Sure - added instructions and uploaded version 0.0.1 to Clojars.
Hopefully that works smoothly, any issues let me
2012/11/27 John Gabriele jmg3...@gmail.com
Hm. I need to read up on what the dex is, and why one would want to dex
it. :)
Dex is the utility transforming java byte code to dalvik executable
bytecode, that can run on android. It's written in java so can be applied
to itself.
I remember a blog
Encoding Keywords as Strings is a performance optimization in clojurescript.
js/String is in fact extended to IFn to make it work
https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1795
I don't think it is an immutable design choice, but a replacement with
interned
seq?, sequential? and coll? are the predicates for ISeq, Sequential and
IPersistentCollection, respectively.
Sequential is just a marker interface which doesn't promise anything but a
defined order of elements.
Since ISeq already is a seq and IPersistentCollection derives from
Sequable, both will
2012/11/26 David Nolen dnolen.li...@gmail.com
keywords symbols as proper types is probably not far off and optimizing
them doesn't need to wait for a general whole program optimization strategy.
Certainly, gclosure can't generally eliminate the check in: var mykw
= kw_table[kw_str] ||
2012/11/26 Philip Potter philip.g.pot...@gmail.com
Since ISeq already is a seq and IPersistentCollection derives from
Sequable,
both will succeed in a seq call.
A Seqable isn't necessarily a seq:
Didn't say that, but Sequable defines the .seq() method, so it will succeed
in a seq call.
2012/11/26 John Gabriele jmg3...@gmail.com
What are currently the main limitations in creating and running
Clojure programs on Android? (Does some limited subset of Clojure
work? Does the bytecode that Clojure produces run on Dalvik?)
Clojure on Android is alive and well as far as I'm aware.
I'm not convinced about allowing wildcard imports. Same reason that we
discourage use without :only for.
About discoverability: I'd take a look at the autocompletion code for
swank-clojure, lein repl, et. al.
Maybe there is a contrib in there?
About your static/dynamic remark: In static langs
Try quoting the code you want to macro expand, like: (macroexpand-1
'(cljs.core/gen-apply-to))
Otherwise clojure would try to macroexpand the result of (gen-apply-to)
Am 21.11.2012 13:07 schrieb László Török ltoro...@gmail.com:
Hi,
How can I use macroexpand et. al to check an output of a
In the case of the dependency in crosspagechannel, relevant to the browser
repl, svn blame tells me that in commit r1816, the dependency to
goog.async.Deferred got added to xpc:
I've seen this same NPE in my project. I managed to work around it by
temporarily throwing out the browser repl. It seems to trigger the NPE. Not
sure how and why.
2012/11/13 Evan Mezeske emeze...@gmail.com
The policy is: update the default version as quickly as possible when a
new
sense to split closure lib?
2012/11/13 Herwig Hochleitner hhochleit...@gmail.com
I've seen this same NPE in my project. I managed to work around it by
temporarily throwing out the browser repl. It seems to trigger the NPE. Not
sure how and why.
2012/11/13 Evan Mezeske emeze...@gmail.com
I concur, but maybe we could make a second release of the closure lib main
jar, with a dependency on third-party?
That would reflect the actual dependency.
I know, you asked for testing before the release. Sorry for not catching
this one.
2012/11/13 Stuart Sierra the.stuart.sie...@gmail.com
Am 14.11.2012 01:30 schrieb Marek Šrank markus.mas...@gmail.com:
I also had the same issue some time ago and it was caused by incorrect
using of dash ('-') vs. underscore ('_') in project/namespace name... I
don't remember what concretely was wrong, but you at least can try all
possibilities
2012/11/8 Sankrant Chaubey sankrant.chau...@gmail.com
Clojure runs on multiple platforms namely the JVM, CLR and Javascript, but
the ecosystem in all these mentioned platforms is quite different from each
other; i.e the process of thinking methodologies change when working with
different
2012/11/8 Thomas Heller th.hel...@gmail.com
I'm trying to write a Macro for CLJS which calls a Javascript Function
directly in the generated code (NOT in the macro). But since the javascript
function (and namespace) is unknown to Clojure it fails trying to resolve
it.
Syntax quote (`)
Ah, only now I see what you were even trying to do. Let me explain why I
think not having unpack is a good idea:
In clojure syntax, (G (F x)) is, under all circumstances - even if F is a
macro -, G called with a _single_ argument, which is the result of (F x)
Even if we had smth like unpack,
2012/11/8 Ben Wolfson wolf...@gmail.com
A message in early 2010 notes that there had been some discussion of
adding support for : to cond, but I suppose nothing came of
that---does anyone know why or if it's still something that might
happen?
Occasionally I had found found something like
2012/11/8 Ben Wolfson wolf...@gmail.com
Is that true? I mean, lots of uses of condp I see have the p be =, and
this came up for me precisely because I was using a map as the test in
cond. In any case, when it *is* useful, it's pretty useful.
= is a point in case:
(condp = foo
bar :
Hmm, this is the second (unverified) report of transients being slower than
persistents.
Jim, are you on OSX too, by chance? Which JVM?
--
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
I'm not aware of such a list, but there aren't that many special forms.
Other than the mentioned fn*, let* and catch, you have loop* and def.
def doesn't create a lexical binding like the others, but creates its var
before evaluating its init-expr.
--
You received this message because you are
On my repl into is consistently faster.
What versions of clojure, java and the OS are you running?
--
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
On my machine the version with into fluctuates around 200ms, whereas the
version with naive-into fluctuates around 300ms.
Have you tried running the examples multiple times to give the jit time to
warm up?
--
You received this message because you are subscribed to the Google
Groups Clojure
try in clojurescript is actually a macro that uses the builtin try* and
adds type dispatch.
So to catch everything, just use (try* ... (catch e ...)). This maps
directly to javascript's try.
This question seems to come up a lot: Maybe it should be documented where
it's visible to people looking
Created an issue: http://dev.clojure.org/jira/browse/CLJ-1098
Don't know if patch is welcome, but fix should be trivial, so not much is
lost if declined.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
I've also run into this. Maybe this is just an oversight, since clojure
handles nils gracefully almost everywhere else.
Should CollFold and IKVReduce be extended to nil, or is there some
rationale against it?
--
You received this message because you are subscribed to the Google
Groups Clojure
Streaming simultaneously can result in all kinds of problems due
differences in speed and reliablility between a disk and network
connection. So if you can, buffer the data for the write to S3. Maybe you
could just stream to S3 from the file after you've written it?
If you must stream
I've implemented the fixes as suggested and created 3 tickets with patches:
1) Omit var statements http://dev.clojure.org/jira/browse/CLJS-397
Except for the new js rendered by stack traces on the repl, this should be
a no brainer
2) Create a new macro extend-instance
- Herwig Holchleitner: how would that solution with protocols be? I write
a protocol that defines methods like `get` and `duplicate` and extend it
for each buffer, delegating the methods to their specific implementations?
ie, (defprotocol UnifiedBuffers (get [buff] get data from buf)
Sorry, I mistakenly pressed the send shortcut in gmail. The
modified-version of io/copy is:
(defn copy-multi
([input outputs] (copy-multi input outputs (make-array Byte/TYPE 1024)))
([^java.io.InputStream input outputs buffer]
(let [size (.read input buffer)]
(when (pos? size)
The typehint of output should be ^java.io.OutputStream, sorry.
Also to your use case:
If you don't actually want to stream simultanously, you need to write the
data into a buffer and later stream from that.
Sorry again for the whopping triple post.
--
You received this message because you are
2012/10/18 Mark Engelberg mark.engelb...@gmail.com
When I want to add print commands for debugging, I usually either do it
the way David Nolen described, i.e., binding _ to a printf statement, or I
use a little utility macro like this (picked up from stackoverflow):
(defmacro dbg[x] `(let
2012/10/19 Bruno França dos Reis bfr...@gmail.com
The reason why I wrote a macro instead of a function is because 'get' and
'duplicate' are not declared in any common superclass of the different
buffers, so I was getting lots of reflection!
Are there alternatives to the macro that avoid
Happy birthday Clojure!
Big thanks to Rich and the whole community!
--
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 with
2012/10/16 David Nolen dnolen.li...@gmail.com
Yep I think there are quite a few things like this. But I don't think we
need an optimization pass for this paticular case (and I'm not saying
that's not a good idea - see below). Hopefully we can a direct patch for
this issue around top level
2012/10/16 David Nolen dnolen.li...@gmail.com
I'm aware of this one as well. But again I think we can and should do a
quick fix in the compiler for this. Either the user used multimethods or
they did not.
I don't see how such a quick fix could be done, without the compiler
gaining a concept
2012/10/16 David Nolen dnolen.li...@gmail.com
ClojureScript programmers benefit from the assumption of whole program
optimization for production code. Also remember we have analyze-file.
They most certainly do, but in my mind this assumption is only made in the
google closure compiler, right
2012/10/16 David Nolen dnolen.li...@gmail.com
None of the invocation optimizations make any sense for anything other
that advanced optimization.
But the invokations in javascript output work even when not using google
closure at all, e.g. the REPL.
They hard code static assumptions that
2012/10/16 David Nolen dnolen.li...@gmail.com
But the invokations in javascript output work even when not using google
closure at all, e.g. the REPL.
Yes because we don't try to optimize them.
And suppose one tried to optimize them: With an established concept of
compilation units, it's
When investigating what the closure compiler does with cljs output, I
discovered the following:
Google closure does not eliminate unused var reads. This means that e.g. a
deftype
(deftype A [])
which compiles to
workbench.foo.A = (function (){
snip
});
workbench.foo.A; // --
Javascript native try-catch is available as the compiler builtin try* form.
cljs.core/try desugars into try* + a type dispatch in catch blocks.
So to catch Strings you would write (try ... (catch js/String e ...)) and
to catch everything (try* ... (catch e ...))
--
You received this message
That is because dispatch on argument count is fast, while apply is slow.
Especially so since it might have to create an intermediate seq.
It's a performance optimization.
kind regards
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
2012/9/25 Brandon Bloom snprbo...@gmail.com
clojurescript gives no access to javascript's delete operator.
There is a js-delete macro in core. It uses the same form as your proposed
adel form.
Oh, beg your pardon, I have overlooked that.
I have to admit, a del! form for deleting
Not sure if this has been reported before - I searched JIRA and the
mailing list, but couldn't find anything, but it's difficult to search for
_…
Bug?
Mapping limitation?
This behavior comes from cljs.compiler/munge, I'd say it's a mapping
limitation that should be considered a bug.
A
2012/9/13 David Nolen dnolen.li...@gmail.com
If people are encountering reasons
to use it - something is missing from ClojureScript that needs to be
provided.
I think I found such a reason: clojurescript gives no access to
javascript's delete operator. Deleting is not the same as setting to
2012/9/24 Frank Siebenlist frank.siebenl...@gmail.com
Guess the AOT compiler uses it but the REPL-one doesn't (???).
The reason for this is two-fold:
1) Vars in Clojure are not suffering from that issue, since they are
reified. That means, that their field in the java class is a generated
Have you looked into work-stealing algorithms? Fork-Join (of which reducers
can take advantage) implements that. The basic idea is that you split your
work into delays (as in clojure.core/delay, called Tasks in Fork-Join)
where convenient in your algorithm and push them onto your work queue. You
TBH, I wasn't sure what exactly the question was. I'll assume for the rest
of this answer, that by 'opportunities for parallel execution' you mean
uses of fold.
So if you're asking how to control the number of threads used for folding:
That's a constructor argument of ForkJoinPool, which defaults
(alter-var-root pool #(.setParallelism % 6))
Sorry for the nitpick, but that would just have been (.setParallelism pool
6), were it possible.
I need to call the ctor and somehow rebind the 'pool' var to that object.
How do I do that? any ideas?
(alter-var-root
Hello,
right now, this works in clojurescript:
;; in a file lib/fancy.cljs
(ns lib.fancy)
(defn fun [x]
[:runtime :fun x])
;; in a file lib/fancy.clj
(ns lib.fancy)
(defmacro fun [x]
[:precompiled :fun x])
;; in a file app/core.clj
(ns app.core
(:require
[lib.fancy :as fancy])
*typo correction*: the third block should be in a file app/core.*cljs*
*
*
thanks
--
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
2012/9/13 David Nolen dnolen.li...@gmail.com
That's how compiler macros are intended to work.
Great! So am I right with the notion, that clojure's defmacros are not
compiler macros and one would use the :inline meta key in clojure to
achieve the same effect?
Supposing that I am, that means
Thanks for your clarification!
A few further thoughts:
ClojureScript may one day be self-hosting but it's not a near term
goal given the desire to target the kinds of clients that run
JavaScript.
Considering that the path to a self hosting clojure would probably start at
clojurescript and
While you have found the solution, note that there are 3 places for
metadata in an expression like:
(def a (atom []))
- The value inside the atom can have metadata: (meta @a)
This will change with a swap!
- The atom itself can have metadata: (meta a)
This will survive a swap!
- The var
I'm using moustache for all my projects. The new ones too, with clojure
1.4+ and ring 1.0+
Works great, I'd recommend it.
cheers
--
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
Append: you don't need to fork or update it, since it uses version ranges
in its dependencies.
--
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
2012/9/7 Murtaza Husain murtaza.hus...@sevenolives.com
I have noticed that moustache swallows any errors, is there a way so that
any errors bubble up ?
I'm not sure what you mean, in my experiences exceptions thrown by handlers
always bubble up.
in this example
(defn route-handler [req]
In my experience, ring responds with 500 on error.
You can use ring.middleware.stacktrace to make the error show up in the
browser.
--
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
response wrapping, that allows you to just return strings, is a
convenience feature living in compojure, not ring.
If that resolves your problem, please consider reposting to the list, so
that others may benefit.
kind regards
On Friday, September 7, 2012 4:18:28 PM UTC+5:30, Herwig Hochleitner
wrote
Ah, didn't know about those. Thanks for the hint!
On Topic: Issue has been resolved in a private exchange.
kind regards
Am 07.09.2012 19:10 schrieb Baishampayan Ghose b.gh...@gmail.com:
(defn route-handler [req]
(throw (clojure.lang.ExceptionInfo. Error)))
OT - IMHO you should use
2012/9/4 mdzaebel mdzae...@web.de
(doseq [s '(a b c)] (intern *ns* s 0)) creates non-dynamic var's.
However, how could I produce *dynamic* var's. I tried with-meta but
failed. In other words, what does (def ^:dynamic a) internally do?
You can use clojure.lang.Var.setDynamic
Beware however, that interning vars programmatically is not recommended. If
you need fresh vars during runtime, use with-local-vars, which also
produces dynamic vars.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
2012/9/5 Andy Fingerhut andy.finger...@gmail.com
If someone types in the literal map {:a 5 :b 10 :c 13 :a -5}, what is the
correct thing?
Some people might be thinking the correct thing is I want the last key
:a's value, -5, to win always, no matter if the key :a occurs more than
once. I
201 - 300 of 351 matches
Mail list logo