Hello
words is not of a primitive type. Try:
(defn shorts-to-bytes [#^shorts src #^bytes dst words]
(let [words (int words)]
(loop [src-offset (int 0)
dst-offset (int 0)]
(when ( src-offset words)
(let [sample (short (aget src src-offset))]
(aset dst
On Sun, Sep 6, 2009 at 16:29, icemazeicem...@gmail.com wrote:
Hello!
First of all, let me congratulate with the devs for their great work:
I've been using Clojure for just a couple of weeks and I had a lot of
fun learning it and experimenting with it.
I'm starting a concurrency-heavy
On Sun, 6 Sep 2009 07:54:33 -0700 (PDT)
Andy Fingerhut andy_finger...@alum.wustl.edu wrote:
Is there any reason to keep aset-* functions around in Clojure? I
guess backwards compatibility?
It definitely seems worth flagging them when *warn-on-reflection* is
true, in a similar way to
triddell wrote:
This patch fixed the issue for me on the IBM JDK.
Sadly, not for me! (IBM 1.5.0) c/c/pprint/ColumnWriter still fails
with:
[java] java.lang.ClassFormatError: (clojure/contrib/pprint/
ColumnWriter) field name is invalid at offset=0 (ColumnWriter.clj:36)
... during contrib
@Christophe: thanks, your hint helped.
@B Smith-Mannschott:
Questions about how best to optimize clojure code to approach java
performance have come up with fair regularity in the past. You might
find some good ideas if you search through the archives a bit.
I see.
As I said before (OP), I
Hi!
Is anyone else working on a Common Lisp style loop? I'd hate to
duplicate effort.
I wrote one yesterday, though I still have to read that stuff on how
to decently package a lib. ;)
http://github.com/tayssir/cl-loop/tree/master
(I might not have written this, but I couldn't figure out a
Heh, I've always wanted one of these. Anyways, I think that instead of
emulating loop , you should try to somewhat emulate iterate. You would
need a code walker, though, because you probably wouldn't want to use
brackets for all the special case loop constructs. Is there one for
clojure? I don't
My response is inline too!
Be sure that:
- the REPL it's working fine (if it let you work normally then it's
fine).
I am not sure if I have found the REPL in the ACB yet. Is it the
WinCommand Clojure 1.0 tab you are talking about? How do I setup ACB
the first time?
Yes. That is the
Just out of curiosity, is there any technical reason that you decided
to use signals instead of passing closures?
(Modularity; Efficiency; more idiomatic to Java?)
On Sep 6, 5:29 am, rb raphi...@gmail.com wrote:
On Sep 4, 8:30 pm, Jonathan Smith jonathansmith...@gmail.com wrote:
Hi Ralph,
On Sep 7, 2:51 pm, Gorsal s...@tewebs.com wrote:
Heh, I've always wanted one of these. Anyways, I think that instead of
emulating loop , you should try to somewhat emulate iterate.
http://common-lisp.net/project/iterate/
Good point! I only used Iterate a couple times, and now I'm reading up
Heh, I've always wanted one of these. Anyways, I think that instead of
emulating loop , you should try to somewhat emulate iterate.
http://common-lisp.net/project/iterate/
Good point! I only used Iterate a couple times, and now I'm reading up
more seriously on it... I think I can keep the
+1 for a Clojure port of Iterate; it's a fantastic library.
I believe it's also completely specified, which is not the case for
LOOP. LOOP is a little like English in that regard... very powerful,
but time flies like an arrow, and fruit flies like a banana!
Due to Clojure's extremely easy integration with Java, your suggestion
makes a lot of sense. But there's still a problem:
it requires everyone learns Clojure has to know Java (not only the
platform, but also the syntax). Moreover,
once we combine the compiled language and script language (just
Hi,
I'm new to Clojure (and Lisp-type languages in general) and I've never
used Java... in short, I have a steep learning curve littered with rocks
and nails. I also don't know whether it's a good thing that I have
long experience with Python and C :-P
In any case, as a first project, I'm
Hi, icemaze:
With trying the following code, I found now Clojure is only around 15
times slower than Java. (java6 -server)
Elapsed time: 76.134661 msecs
Elapsed time: 9.509398 msecs
Elapsed time: 15.137116 msecs
Elapsed time: 1.827812 msecs
Elapsed time: 14.477701 msecs
Elapsed time: 1.057064
On Sep 7, 4:27 pm, B Smith-Mannschott bsmith.o...@gmail.com wrote:
[snip]
Questions about how best to optimize clojure code to approach java
performance have come up with fair regularity in the past. You might
find some good ideas if you search through the archives a bit.
That said,
On Mon, Sep 7, 2009 at 1:17 AM, Cliff Wellscl...@twisty-industries.com wrote:
What I've tried (no laughing!) is this bit of code:
(ns site.database
(:use [compojure])
(:use [clojure.contrib.sql])
(:use [site.setup])
(if (= *db-adapter* mysql)
(:use [site.adapters.mysql :as
Are we sure that it is the aset-* operation that is causing a slowdown
and not the fact that the aset-* operations are not being inlined,
whereas the regular aset operation is?
If so, the aset-* ops might be faster, and just in need of a small
update!
A lot of the time when something is slower
Hi,
I have created a build.xml file to setup the directory structure and
download the required jars. To have a running clojure application. All
the required class path settings are taken care of inside the xml
file, so you can have a running hello world jar in a couple of second.
It is
URL: http://github.com/nullstyle/clojure-quickstart/tree/master
Hi all,
As a little weekend project and something to spur me to start
learning maven, I put together a simple little clojure quickstart
archetype. It sets you up a hello world command line application from
which you can build
Hello,
On Mon, Sep 7, 2009 at 7:36 PM, Jonathan
Smithjonathansmith...@gmail.com wrote:
Are we sure that it is the aset-* operation that is causing a slowdown
and not the fact that the aset-* operations are not being inlined,
whereas the regular aset operation is?
aset-* uses
(ns testcomp)
(var-get (or (ns-resolve *ns* 'foo)
(intern *ns* 'foo :foo)))
;; foo ;(1)
;; (println foo) ;(2)
;; (do foo 3);(3)
;; (fn [] foo) ;(4)
;; ((fn [] foo)) ;(5)
;; ((fn [] (println foo))) ;(6)
Or, you can go the opposite way and write a macro that expands into the
appropriate ns form. This will work if the information you need from
*db-adapter* is there by macroexpansion time.
A macro that does a similar job to ns, but adds conditional features to the
ns DSL, can wrap and generalize
Just a little message to put this information online. Sorry if it's a
tad off-topic.
If you're look at the following error message while using VimClojure
on MS Windows:
Error detected while processing function
112..vimclojure#ExecuteNail..vimclojure#ExecuteNailWithInput:
line 19:
Couldn't
Thank for the link +2
I think that Java C# languages (not the platforms) are not the
places for monads (or functional programming in that respect).
As for the success of ideas, not long ago functional languages them-
selfs were thought of as too academic for practical use (multicore
change all
Hi everyone! I have some data that consists of key/value pairs, but
that need to maintain their order, in terms of when they were added to
the list. In most lisps you'd do this with an association list, with a
performance penalty of course if the alist gets too large.
I was wondering if there's
On Mon, Sep 7, 2009 at 5:37 AM, David Andrewsdammi...@gmail.com wrote:
triddell wrote:
This patch fixed the issue for me on the IBM JDK.
Sadly, not for me! (IBM 1.5.0) c/c/pprint/ColumnWriter still fails
with:
[java] java.lang.ClassFormatError: (clojure/contrib/pprint/
ColumnWriter)
Hi Mark,
I like your clojure-maven-plugin, but I discovered a problem with 1.0.
If a namespace declaration has metadata, like this:
(ns #^{:doc This is my namespace.}
my.namespace)
The the plugin fails to read the ns name. You get an error message
like Cannot find file __init.class
Doh - I suspected I'd have something that might trip me up on that namespace
discovery :( Metadata is something I've not used too much yet..
I'll take a look at it tonight...
--
Pull me down under...
On Tue, Sep 8, 2009 at 11:10 AM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:
Hi Mark,
I'm working on cleaning up the code for clojure-mode.el, which provides
Clojure support for Emacs.
It includes some functionality for interacting with subprocesses. This
is a small subset of the functionality of the functionality included in
SLIME, but it's simpler and easier to configure.
I had considered just searching .clj files and using the file name
(filtering on (ns sounds good thou).
Initially I didn't like that as people -may- not stick to good convention
and use a different namespace than filename, but I think failing and making
them conform to a good standard is
It might be sufficient to scan for files containing (ns and then
determine the namespace name from the file name (. becomes / and
- becomes _). Otherwise, you might need to depend directly on
Clojure and use its reader.
I don't think it will work for the plugin, but I wrote a lib in
Clojure
(script.env/def-ns script.ParenMatcher
(:gen-class
:implements [org.eclipse.jface.text.source.ICharacterPairMatcher]
:state state
:init init
:methods [[setPainter
[org.eclipse.jface.text.source.MatchingCharacterPainter] void]])
(:use script.genutils)
(:import
On Sep 7, 8:36 pm, Phil Hagelberg p...@hagelb.org wrote:
... I don't know if the built-in subprocess features are
worth keeping around any more. Personally I have never used them or
heard of anyone using them; I wonder if they are just legacy baggage.
Never used them; only use SLIME. Never
Excellent! This was one of the missing pieces I was hoping to pull together
next.
into your code, and no support fr clojure-maven-plugin clojure:run (it
I could change this to check if you mention a .clj or just a class name, and
run either-or.
Theres also the
I think the problem is the typecasting and the bit-shifting. I think
both involve casting one of the parameters to a java.lang.Number.
On Sep 7, 5:03 am, rivercheng riverch...@gmail.com wrote:
Hi, icemaze:
With trying the following code, I found now Clojure is only around 15
times slower
I think the problem is the typecasting and the bit-shifting. I think
both involve casting one of the parameters to a java.lang.Number.
On Sep 7, 5:03 am, rivercheng riverch...@gmail.com wrote:
Hi, icemaze:
With trying the following code, I found now Clojure is only around 15
times slower
On Mon, Sep 7, 2009 at 8:54 PM, Mark Derricuttm...@talios.com wrote:
Initially I didn't like that as people -may- not stick to good convention
and use a different namespace than filename, but I think failing and making
them conform to a good standard is acceptable.
I think if the namespace
Very basic question. What's the idiom for producing a new seq wherein
each val is based on pairs from an existing seq, e.g.:
; add together n0 n1, n1 n2, n2 n3, etc.
[1 2 3 4 5 6]
; giving...
[3 5 7 9 11]
The verbose way would be something like:
(loop [s origSeq n [ ])
(let [a (first
should read:
(loop [s origSeq n [ ])
(let [a (first s
b (second s)]
(if (nil? b)
n
(recur (rest s) (conj n (+ a b))
On Sep 7, 6:51 pm, Brian Will brian.thomas.w...@gmail.com wrote:
Very basic question. What's the idiom for
One of the things that I'm not happy with my archetype with right now
(I'm working on it at the moment) is that there isn't an way to
support both AOT compilation as well as directly running the script
that feels right. Everything I've thought about seems overwrought.
Adding support for
I know that this has come up before on the group and but is this not
essentially dependency injection where the dependency being injected
is a name space that presumably follows a particular convention in
terms of what functions it provides?
I remember people making it pretty clear that they
I'd use map, reduce, partial, and partition like so
user=(map (partial reduce +) (partition 2 1 [1 2 3 4 5 6]))
(3 5 7 9 11)
On Sep 7, 9:53 pm, Brian Will brian.thomas.w...@gmail.com wrote:
should read:
(loop [s origSeq n [ ])
(let [a (first s
b (second s)]
Okay, syntax question. When defining a namespace
(ns my-ns
(:require [clojure.contrib [str-utils2 :as s]])
(:import (java.util Regex Date Etc)))
Why does the require use a vector, and the import statement use a
list? Could they both be vectors? This confused me when using imports
for a
Most definitely - I did have a repl goal for awhile but had issues with the
input/output streams. Looking at my github forkqueue I see someones pulled
it back out (or added a new one, I've not yet had a look at it) which might
be a starting point for you...
But by all means - patches galore are
Phil Hagelberg p...@hagelb.org writes:
I'm working on cleaning up the code for clojure-mode.el, which provides
Clojure support for Emacs.
Further things I am considering removing:
* support for Emacs 21 (which was released around 2001)
* the ability to turn off highlighting multi-line def
Yet another way :)
user= (map + (rest a) a)
(3 5 7 9 11)
--~--~-~--~~~---~--~~
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
Is there a way to deal with this:
user= ( \a \b)
java.lang.ClassCastException: java.lang.Character cannot be cast to
java.lang.Number (NO_SOURCE_FILE:0)
So far the only things I know are to coerce or use interop eg:
user= (.compareTo \a \b)
-1
Clojure's compare;
(compare \a \b)
-1
user= (doc compare)
-
clojure.core/compare
([x y])
Comparator. Returns 0 if x equals y, -1 if x is logically 'less
than' y, else 1. Same as Java x.compareTo(y) except it also works
for nil, and compares numbers and collections
Also look at the ClojureShell Maven plugin,
http://github.com/fred-o/clojureshell-maven-plugin/tree/master
which runs a REPL or Swank server.
-SS
On Sep 7, 10:41 pm, Mark Derricutt m...@talios.com wrote:
Most definitely - I did have a repl goal for awhile but had issues with the
input/output
Is anyone aware of a Clojure meetup in Ann Arbor, MI? I used to attend
a very small one in Brooklyn and Im missing it. If anyone is
interested in starting something that could be cool too!
Cheers,
Clint
--~--~-~--~~~---~--~~
You received this message because you
Hi, evandi:
I've tried to use aset to write to a short array, and there's no
typecasting and bit-shifting, but it is still slow.
But if I write to a int array, it will be more than two times faster.
Therefore, maybe 'aset' is optimized only for 'int' ?
On Sep 8, 9:33 am, evandi
On Mon, Sep 7, 2009 at 5:19 PM, Conrad drc...@gmail.com wrote:
Alternatively, I suppose it would be possible to create a new type of
map that performs better than an alist but can return items in the
order they were added to the list, if desired
Or use an existing type: the
An interesting founding is that it seems typecasting from short to int
and asetting to an int-array is 3-4 times faster than typecasting from
int to short and asetting to an short array.
On Sep 8, 9:33 am, evandi evan135...@gmail.com wrote:
I think the problem is the typecasting and the
Hi Clint,
I attend the Ruby meetings locally and we're all interested in
functional languages.. we used to do an erlang/functional languages
group. I'd also be interested in getting something like this together.
-Lance
On Mon, Sep 7, 2009 at 9:32 PM, newsomchcnew...@gmail.com wrote:
Is
On Sep 7, 2009, at 5:19 PM, Conrad drc...@gmail.com wrote:
Hi everyone! I have some data that consists of key/value pairs, but
that need to maintain their order, in terms of when they were added to
the list. In most lisps you'd do this with an association list, with a
performance penalty of
Hi,
How about just keep a list of keys as an extra list besides the hash-
map?
The look-up and iterating without order can be done efficiently
without the help of the key list.
Iterating with the original order is a little bit expensive but should
be acceptable if the hash function is fast.
ah nice - perfect thanks
On Sep 8, 2:02 pm, Adrian Cuthbertson adrian.cuthbert...@gmail.com
wrote:
Clojure's compare;
(compare \a \b)
-1
user= (doc compare)
-
clojure.core/compare
([x y])
Comparator. Returns 0 if x equals y, -1 if x is logically 'less
An interesting founding is that it seems typecasting from short to int
and asetting to an int-array is 3-4 times faster than typecasting from
int to short and asetting to an short array.
Thought: Java primitive types, when manipulated individually, are all
secretly ints — there is no real
59 matches
Mail list logo