Count me among those who would like to see at least def- added to core, and
possibly private versions of the other types of def as well.
--
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
Check for example this code:
http://shootout.alioth.debian.org/u64q/program.php?test=pidigitslang=clojureid=1
It is slower than scala 8 (!!!) times.
But peppering it with types can easily bring it on par with java/
scala.
Any takers ?
--
You received this message because you are subscribed to
I would rather see defn- removed, than add any more foo- functions. If
there are any more function attributes we want to tag things with
(say, automatically memoized?) that would be 2^N new convenient
definition forms, in an already-packed clojure.core namespace. And
it's not hard at all to (let
Hi,
Am 18.09.2011 um 04:58 schrieb Eamonn:
I tried the following
Var keyword = RT.var(clojure.core, keyword);
Var hashMap = RT.var(clojure.core, hash-map);
hashMap.invoke(keyword.invoke(a), 1);
then I created the following function
(defn foo[key paramMap](key paramMap))
Object
Am 18.09.2011 um 05:55 schrieb Ken Wesson:
The easiest might be to just pass a map literal (in String form)
through the Clojure reader. Variable integers or other simple objects
can just be incorporated using the Java String + operator; the
concatenation will always start with a string
Hi,
Am 18.09.2011 um 07:31 schrieb Brent Millare:
Is it possible to cast a number into an int in 1.3.0-RC0?
;user= (type 0)
java.lang.Long
;user= (type (int 0))
java.lang.Long
int does cast to an integer for direct java interop. type is function so the
integer will be boxed. 1.3 will
On Sun, Sep 18, 2011 at 4:06 AM, Meikel Brandmeyer m...@kotka.de wrote:
Am 18.09.2011 um 05:55 schrieb Ken Wesson:
The easiest might be to just pass a map literal (in String form)
through the Clojure reader. Variable integers or other simple objects
can just be incorporated using the Java
I would rather see defn- removed, than add any more foo- functions.
+1
--
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,
Am 18.09.2011 um 10:11 schrieb Ken Wesson:
Tell me which is simpler:
Reader.read({:foo 1 :bar + x + });
String x = 13rabc;
Have fun.
Var keyword = RT.var(clojure.core, keyword);
Var hashMap = RT.var(clojure.core, hash-map);
hashMap.invoke(keyword.invoke(foo), 1,
Thanks for the reference Mark, much appreciated.
I add the private meta-data by hand, but (defn- foo 2) is so much more succinct
than (def ^:private foo 2) - where ^:private is almost half the declaration. I
also find the placement of the meta-data tag to be intrusive and disruptive
when
+1 for easily controlling the surface area of an API and explanatory
defs over inline/expanded literals.
Sent from my iPad
On 18 Sep 2011, at 10:14, Rob Lally rob.la...@gmail.com wrote:
Thanks for the reference Mark, much appreciated.
I add the private meta-data by hand, but (defn- foo 2) is
Just to pile on with Alan here: defn- is the oddball here, a vestige of a time
when metadata on vars was more cumbersome and less common. Adding a def- would
cover one very particular case; to make the point rhetorically, what def* form
would be required to produce (for example):
(def
I would rather see defn- removed, than add any more foo- functions.
We will see this subject line in this mailing list every few months until the
end of time, or until def- is added to core.
The burden, no matter how distributed, of answering that question forevermore
greatly outweighs the
On Sun, Sep 18, 2011 at 4:40 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 18.09.2011 um 10:11 schrieb Ken Wesson:
Tell me which is simpler:
Reader.read({:foo 1 :bar + x + });
String x = 13rabc;
Have fun.
Syntactically invalid Clojure code would fail just as much in Clojure
source
Cool - wasn't aware of that.
On 16 September 2011 15:07, Chris Granger ibdk...@gmail.com wrote:
FWIW there's also cljs-watch:
http://github.com/ibdknox/cljs-watch
On Sep 15, 6:35 am, Stuart Campbell stu...@harto.org wrote:
Hello,
I've written a small hack for the ClojureScript
Hi Meikel,
Even if I use what type does underneath and call .getClass myself (so
there is no boxing), I still get type long. Also to be more specific,
I am interested in the primitive int, not java.lang.Integer.
Best,
Brent
On Sep 18, 4:10 am, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am
We will see this subject line in this mailing list every few months until the
end of time, or until def- is added to core.
So be it.
The burden, no matter how distributed, of answering that question forevermore
greatly outweighs the burden of moving a def- macro from a contrib file to a
Using 1.3.0-RC0
I can't seem to access clojure.lang.DynamicClassLoader's public static
fields. Is there something else preventing me from doing this?
;user= clojure.lang.DynamicClassLoader/classCache
CompilerException java.lang.RuntimeException: Unable to find static
field: classCache in class
On Sep 18, 2011, at 3:38 PM, Stuart Halloway wrote:
The burden, no matter how distributed, of answering that question
forevermore greatly outweighs the burden of moving a def- macro from a
contrib file to a core file. It even outweighs the aesthetic concerns (which
I confess I don't
Everyone is welcome to make faster versions if they can figure out how.
I suspect that most of the time is spent in BigInteger math in that
particular program. If so, type annotation won't speed that up.
Glad to be proved wrong, though!
Andy
On Sun, Sep 18, 2011 at 12:02 AM, Vagif Verdi
One more detail. The Scala program, and I think all of the fastest programs
for that problem, use the GNU GMP library for big integer arithmetic.
If the Clojure program also used that library, it should be as fast, or
nearly so, as any other program that uses the same algorithm and the GNU GMP
The API already contains `find` and `contains?`, which are woefully
misleading names. That's not a big deal: I'm *terrible* at naming. I tell
people that all the time. I've learned to accept it. It doesn't detract from
my wonderfulness. It doesn't detract from the underlying wonderfulness
Hi,
Am 18.09.2011 um 15:36 schrieb Brent Millare:
Even if I use what type does underneath and call .getClass myself (so
there is no boxing), I still get type long. Also to be more specific,
I am interested in the primitive int, not java.lang.Integer.
You could do a hardcore try and use a
No need to leave Clojure to see what's going on:
(definterface IntTest
(intTest [^int n])
(intTest [^long n]))
(deftype IntTester []
IntTest
(intTest [this ^int n] (println A primitive int!))
(intTest [this ^long n] (println A primitive long!)))
(comment
(.intTest (IntTester.) 1) ;
On Sun, Sep 18, 2011 at 6:38 AM, Stuart Halloway
stuart.hallo...@gmail.comwrote:
Alan covered the biggest problem succinctly: it pollutes the language core
to provide convenience APIs that are combinatorial in nature.
I don't understand your comment about polluting the language core. Do you
That's cool. Good to know.
Thanks,
Brent
On Sep 18, 12:25 pm, David Nolen dnolen.li...@gmail.com wrote:
No need to leave Clojure to see what's going on:
(definterface IntTest
(intTest [^int n])
(intTest [^long n]))
(deftype IntTester []
IntTest
(intTest [this ^int n] (println A
Figured it out, those fields are private. Just reading the source code
I didn't realize if you don't declare it public, it defaults to
private. Shows how much I know about java syntax...
-Brent
On Sep 18, 10:22 am, Brent Millare brent.mill...@gmail.com wrote:
Using 1.3.0-RC0
I can't seem to
Not quite; fields without an access modifier are package-private. That means
that code in classes in the same package (here, `clojure.lang`) can access such
fields without any issue.
The distinction is without a difference for you here, of course — especially
since Clojure treats all
I don't understand your comment about polluting the language core. Do you
really think people are going to use def- for some other purpose? If you
don't, then it is not pollution.
Fair enough. Maybe pollution wasn't the best word. Introducing a combinatorial
set of names is a [some other
I've not followed the benchmarking game much at all, but it surprises
me that implementations are allowed to use native libraries at all.
I figure that there must have been some discussion/debate around this
somewhere at some point, but a few minutes of googling yielding
nothing interesting.
On Sep 18, 2011, at 1:10 PM, Stuart Halloway wrote:
The other example that immediately leaps to mind is that the family of
get-in, get, and update-in implies the existence of update. It is rather
startling to me that update does not exist in the core.
This is a good question. I don't
Thanks for clarification.
-Brent
On Sep 18, 1:00 pm, Chas Emerick cemer...@snowtide.com wrote:
Not quite; fields without an access modifier are package-private. That means
that code in classes in the same package (here, `clojure.lang`) can access
such fields without any issue.
The
@Chas, update uses a function to perform the update. Think of it as being
like swap! and alter, but for persistent associative structures. So you can
write something like: (update {:foo 0} :foo inc) to increment the value of
:foo.
update is to update-in as assoc is to assoc-in.
If you write a
Here is a brief discussion from January 2011:
http://alioth.debian.org/forum/forum.php?thread_id=14814forum_id=999group_id=30402
If you want to follow it in time order, read it from bottom to top.
Andy
On Sun, Sep 18, 2011 at 10:19 AM, Chas Emerick cemer...@snowtide.comwrote:
I've not
On Sep 18, 10:44 am, Chas Emerick cemer...@snowtide.com wrote:
On Sep 18, 2011, at 1:10 PM, Stuart Halloway wrote:
The other example that immediately leaps to mind is that the family of
get-in, get, and update-in implies the existence of update. It is rather
startling to me that update
Hi,
Am 18.09.2011 um 18:54 schrieb Brent Millare:
That's cool. Good to know.
And another (concluding?) remark: Calling .getClass on a primitive doesn't
work, since primitives are no objects. So the integer is boxed again to … Long.
Hence you get the same result as with type or class.
What really puzzles me is that it doesn't seem to be generally
regarded as idiomatic Clojure style to just use top-level (let)s for
your private globals. This has lots of benefits:
- If you do this you can make them actually, genuinely private, rather
than just marked as please don't use this
-
Personally, I don't use this particular style for.. probably pretty poor
reasons. I find that I end up declaring every constant that might be needed in
a file in a single let at the top of the file because:
a) Clojure's declare before use semantics make ordering technically important
rather
ha ! ha !
I really like the comparison core/kitchen sink :)))
I find it appropriate.
It never really bothered me to require an external lib to get these
fancy definitions. And I use them every where
Core should restricted to ... core things. What makes Clojure run by itself.
Syntactic
Hi Eamonn,
if you find this too tedious to write and use it quite often, then there is
always the possibility to hide things a little bit behind a facade.
class Clj {
static final Var seqVar = RT.var(clojure.core, seq);
static final Var keywordVar = RT.var(clojure.core, keyword);
Hi Meikel,Ken
Thank you so much for taking the time to reply to my question. Meikel
Thanks for the code. I will implement as described above.
On Sep 18, 6:28 pm, Meikel Brandmeyer m...@kotka.de wrote:
Hi Eamonn,
if you find this too tedious to write and use it quite often, then there is
Just skimming this on the phone, has no one mentioned RT.map?
On Sep 18, 2011 5:58 PM, Eamonn odon...@gmail.com wrote:
Hi Meikel,Ken
Thank you so much for taking the time to reply to my question. Meikel
Thanks for the code. I will implement as described above.
On Sep 18, 6:28 pm, Meikel
What really puzzles me is that it doesn't seem to be generally
regarded as idiomatic Clojure style to just use top-level (let)s for
your private globals. This has lots of benefits:
- If you do this you can make them actually, genuinely private, rather
than just marked as please don't use
Confession:The best way I have found to learn a language is to pick a
girl and make something that impresses her.
When I was learning to use Node.js, I made a chat room for my
girlfriend and I to talk in when we doing a long distance
relationship. It had a sassy robot that pulled pictures of
If Robocode is fun to you, why not do that then:
http://nakkaya.com/2010/07/06/controlling-robocode-engine-from-clojure/
http://www.fatvat.co.uk/2009/05/clojure-and-robocode.html
There's also been a thread on this group about the same topic a while ago.
Hope this helps
Andreas
On 19 September
Hi,
You can also do it the other way around, use gen-class
and write yourself a static entry point callable from Java.
You get all the Clojure runtime init stuff done and you can define your
dependencies in
the clojure file (require or use). Then you can dive into the Clojure world for
as
On Sun, Sep 18, 2011 at 3:40 AM, Meikel Brandmeyer m...@kotka.de wrote:
Var keyword = RT.var(clojure.core, keyword);
Var hashMap = RT.var(clojure.core, hash-map);
hashMap.invoke(keyword.invoke(foo), 1, keyword.invoke(bar), x);
This one is more simple. This is clojure code.
Since I've ended
47 matches
Mail list logo