Well, for those who use emacs, you could always make it *look* like it was
pretty... For example:
(eval-after-load 'clojure-mode
'(font-lock-add-keywords
'clojure-mode `(("\\"
(0 (progn (compose-region
(match-beginning 0) (match-end 0)
,(make-char 'greek-iso8859-7 107)) ;; a lambda
The idiomatic JDBC solution to this problem is a DataSource:
http://download.oracle.com/javase/6/docs/api/javax/sql/DataSource.html
http://bitbucket.org/kumarshantanu/clj-dbcp/src
A connection-pooling data source does exactly that - it recycles the
connection for many statements. The close() metho
A bimap is a map where each elements of the pair can be used as key to
access it..
Sunil.
On Tue, Nov 16, 2010 at 12:44 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:
> Hello everybody,
>
> Is there something like a bimap in clojure? I know I can have two regular
> hash-maps .. but I
Hello everybody,
Is there something like a bimap in clojure? I know I can have two regular
hash-maps .. but I was wondering if there is a better implementation..?
a similar implementation in c++ is
http://beta.boost.org/doc/libs/1_41_0/libs/bimap/doc/html/index.html
Thanks,
Sunil.
--
You rec
Hi,
On 16 Nov., 02:31, Ken Wesson wrote:
> Eh. I'd heard first and rest had replaced next. No?
No. This was a misinformation. To elaborate a bit more on the
differences pointed out by Sean:
next returns nil if there are no more items in the sequence, which is
nice to use in if and when stateme
I totally misunderstood the role of the EVAL context flag in the
compile method of ObjExpr. Is there a general writeup anywhere of how
the compiler works, especially the interaction of parse and emit?
On Nov 15, 4:59 pm, Ken Wesson wrote:
> On Mon, Nov 15, 2010 at 4:24 PM, Alan wrote:
> > On No
I may be using the term wrong; while concurrency isn't necessary, I'm
really just looking to minimize the # of times I'm opening/closing
connections, but also looking to minimize unnecessary open
connections. I suspect what I'm really looking for is a macro to
detect every instance of "(sql/with-c
On Mon, Nov 15, 2010 at 5:31 PM, Ken Wesson wrote:
> Eh. I'd heard first and rest had replaced next. No?
rest and next do different things:
rest - Returns a possibly empty seq of the items after the first.
Calls seq on its argument.
next - Returns a seq of the items after the first. Calls seq o
The main page link to API is a little confusing/annoying.
I expect it to go here: http://clojure.org/api
( I expect this because doing a google search on "clojure api" brings
it up)
However the main page link to API goes directly to here:
http://clojure.github.com/clojure/
It's kind of annoying/
On Mon, Nov 15, 2010 at 6:49 PM, Meikel Brandmeyer wrote:
> Changing the above code to the following (which is similarly readable) should
> give an immediate speed bump. Rich once stated something around 20%, although
> I have not verified the numbers and this was quite a while ago...
>
> (loop
I think the minimal character count for composition and partial functions in
haskell are some of the reasons that haskell code is so impenetrable to
non-haskell hackers. Feel free to rig up crazy unicode characters to any
identifier you want in your own code, just don't ask me to read or debug
Coming from Haskell, where composition and partial functions are cheap and
free in terms of character count, it is actually pretty discouraging to have
to spell it out in Clojure for the same effect. Some of the cases where you
"should" be using multiple expressions in Clojure would be perfectly c
Hi,
Am 15.11.2010 um 23:07 schrieb Ken Wesson:
> (loop [s some-coll o nil]
> (if (empty? s)
>o
>(let [f (first s)]
> (blah blah blah s blah blah blah f blah blah blah)
> (recur (rest s) (conj o foobar)
>
> or some similar control flow structure, where s gets first and re
On Mon, Nov 15, 2010 at 4:41 PM, Alan wrote:
> Yes, the API *does* suggest using seq to check for emptiness. (empty?
> x) is implemented as (not (seq x)). You certainly won't ever get
> improved performance by using empty? - at best you break even, most of
> the time you lose. For example:
>
> (if
On Mon, Nov 15, 2010 at 4:24 PM, Alan wrote:
> On Nov 15, 12:12 pm, Alyssa Kwan wrote:
>> In your example, my-generator isn't the concern. It's the call to my-
>> generator that creates functions, each of which creates bytecode, is
>> loaded as a class, then is instantiated, and finally invoked.
Hi,
I'm trying to work out a way to define a multimethod dispatch function that
will allow me to make a decision based on two values. In the example below I'm
using symbols for the values of the major and minor values, mostly for
convenience. What I'm trying to do is dispatch a multifunction o
On Mon, Nov 15, 2010 at 2:35 PM, trying clj wrote:
> File example\some.clj
>
> (ns example.some (:use example.someother))
>
> (defn helloworld [] (print "helloworld"))
>
>
> File example\someother.clj:
>
> (ns example.someother (:use example.some))
>
> (defn sample [] (helloworld))
>
>
> A compile
On Mon, Nov 15, 2010 at 11:35 AM, trying clj wrote:
> A compile error "Unable to resolve helloworld in this context" is produced
> (on either latest clojure-maven-plugin or Leiningen). If the two defn's are
> switched places, the build completes successfully.
>
> This is very basic functionality b
On Nov 15, 2010, at 4:41 PM, Alan wrote:
> Yes, the API *does* suggest using seq to check for emptiness. (empty?
> x) is implemented as (not (seq x)). You certainly won't ever get
> improved performance by using empty? - at best you break even, most of
> the time you lose. For example:
>
The on
Yes, the API *does* suggest using seq to check for emptiness. (empty?
x) is implemented as (not (seq x)). You certainly won't ever get
improved performance by using empty? - at best you break even, most of
the time you lose. For example:
(if (empty? x)
; empty branch
; not-empty branch
Can be
On Nov 15, 12:12 pm, Alyssa Kwan wrote:
> In your example, my-generator isn't the concern. It's the call to my-
> generator that creates functions, each of which creates bytecode, is
> loaded as a class, then is instantiated, and finally invoked.
Not true. Compiling my-generator creates two clas
Done.
On Nov 15, 12:21 pm, Rick Moynihan wrote:
> Hi Alex,
>
> I have one more Clojure Group for you:
>
> The Manchester (UK) Clojure Dojo
>
> http://manchester.clojuredojo.com/
>
> I'm currently in the process of organising our next meeting, but a
> link on the clojure.org website would be appre
File example\some.clj
(ns example.some (:use example.someother))
(defn helloworld [] (print "helloworld"))
File example\someother.clj:
(ns example.someother (:use example.some))
(defn sample [] (helloworld))
A compile error "Unable to resolve helloworld in this context" is produced
(on eith
If you look at the bytecode for the closures, you'll see that the Var
that *ns*/a points to is resolved at time, and the Java
reference is stored as a static final class member. That's a small
use of additional permgen.
In your example, my-generator isn't the concern. It's the call to my-
gener
In another thread, someone just indicated that a closed-over variable
chews up permgen. Is this true?
I had been under the impression that keywords didn't get
garbage-collected, so runtime generation with (keyword foo) ought to
be used sparingly, but that was it.
Perhaps the scenario was somethin
On Mon, Nov 15, 2010 at 10:26 AM, Alan wrote:
> The one that bugs me is complement - such a long name for a commonly-
> useful function. I often wind up defining ! as an alias for
> complement, but maybe others will think that is poor style.
Possibly because bang functions indicate "Here be drago
On 15 Nov, 19:34, Brian Goslinga wrote:
> Well, assuming the memory is available, at least Clojure is guaranteed
> to support vectors with more than 1024 elements...
Unfair comparison. Clojure is not a standard, it's an implementation.
SBCL is guaranteed to support vectors with >> 1024 elements t
I'm building an ETL app, so aggregate functions of arbitrarily large
arity is a necessity. I've had to wrap a lot of core clojure
functions with concrete arg lists to make them work with lazy
sequences. In my limited experience, machine generated code of this
nature should use lazy sequences that
Performance is part of it too. Allowing dispatch on arity leads to
faster code.
Many of the functions that operate on sequences are lazy so dispatch
on arity doesn't apply.
On Nov 15, 11:52 am, Chris wrote:
> If you have a function that needs to treat multiple arguments as a
> group, what force
Hi,
Am 15.11.2010 um 17:52 schrieb Chris:
> If you have a function that needs to treat multiple arguments as a
> group, what forces drive you to represent this as a single sequence
> argument vs. an "&" argument? To give a concrete example, why does
> "+" work like
>
> (+ 1 2 3 4)
>
> instead
On Mon, Nov 15, 2010 at 1:26 PM, Alan wrote:
> I think comp is nice and short, personally. Partial is okay, and the
> long name helps discourage me from using it when I should be using #()
> instead - partial is a bit slower. And if you find yourself wanting to
> nest #() forms, it's not that bad
On Mon, Nov 15, 2010 at 10:52 AM, Michael Wood wrote:
> On 15 November 2010 16:08, David Sletten wrote:
>> The StackOverflowError jumps over the lazy seq.
>
> The quick, brown StackOverflowError jumps over the lazy seq?
The reversible, associative vector jumps over the lazy seq ... for
certain a
On Mon, Nov 15, 2010 at 11:52 AM, Chris wrote:
> If you have a function that needs to treat multiple arguments as a
> group, what forces drive you to represent this as a single sequence
> argument vs. an "&" argument? To give a concrete example, why does
> "+" work like
>
> (+ 1 2 3 4)
>
> instea
On Mon, Nov 15, 2010 at 10:21 AM, Victor Olteanu wrote:
> That's right - but I'm happy they are back up.
> I was in the middle of working for something requiring the clj-time library,
> and all of a sudden GitHub starts reporting it's missing. I was thinking,
> wow, did the author suddenly decided
On Nov 13, 11:48 pm, Robert McIntyre wrote:
> So my friend and I were screwing around, battling versions of LISP as
> nerds are wont to do, when I came across this:
>
> (eval `(clojure.core/+ ~@(take 1e4 (iterate inc 1
> Invalid method Code length 89884 in class file user$eval13607
>
> This is
I think comp is nice and short, personally. Partial is okay, and the
long name helps discourage me from using it when I should be using #()
instead - partial is a bit slower. And if you find yourself wanting to
nest #() forms, it's not that bad to switch to partial, and it may
serve as a warning si
Hi Alex,
I have one more Clojure Group for you:
The Manchester (UK) Clojure Dojo
http://manchester.clojuredojo.com/
I'm currently in the process of organising our next meeting, but a
link on the clojure.org website would be appreciated.
R.
On 31 October 2010 02:38, Alex Miller wrote:
> Hi al
If you have a function that needs to treat multiple arguments as a
group, what forces drive you to represent this as a single sequence
argument vs. an "&" argument? To give a concrete example, why does
"+" work like
(+ 1 2 3 4)
instead of
(+ [1 2 3 4])
Is it performance? Aesthetics? Composab
On 15 November 2010 16:08, David Sletten wrote:
> The StackOverflowError jumps over the lazy seq.
The quick, brown StackOverflowError jumps over the lazy seq?
--
Michael Wood
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group,
On Nov 14, 6:48 am, Robert McIntyre wrote:
> So my friend and I were screwing around, battling versions of LISP as
> nerds are wont to do, when I came across this:
>
> (eval `(clojure.core/+ ~@(take 1e4 (iterate inc 1
> Invalid method Code length 89884 in class file user$eval13607
>
> This is
That's right - but I'm happy they are back up.
I was in the middle of working for something requiring the clj-time library,
and all of a sudden GitHub starts reporting it's missing. I was thinking,
wow, did the author suddenly decided to take to the hills, like someone once
did (in the Rails commu
Conrad Barski, author of "Land of Lisp" (http://www.amazon.com/gp/
product/1593272812) will be giving a talk entitled *Land of Lisp: The
Clojure-ish Parts* at the National Capital Area Clojure Users Group
(CAPCLUG) on November 18, 2010 at 6:15 pm. The meeting will be held
at 12021 Sunset Hills Roa
The StackOverflowError jumps over the lazy seq.
Have all good days,
David Sletten
--
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
On 15 November 2010 09:46, Rick Moynihan wrote:
> On 14 November 2010 20:47, Victor Olteanu wrote:
>> Github is down at the moment unfortunately...
>
> Ahhh great, it's back up... Looks like github was partially down as
> other pages were returning for me.
I'm guessing this was the cause...
ht
>
> You should be able to use (apply max-key f someseq); apply takes a variable
> number of args, and only the last is expanded.
>
Thanks, thought there would be something like this!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this gro
On 14 November 2010 20:47, Victor Olteanu wrote:
> Github is down at the moment unfortunately...
Ahhh great, it's back up... Looks like github was partially down as
other pages were returning for me.
Thanks
R.
--
You received this message because you are subscribed to the Google
Groups "Cloj
On Sun, Nov 14, 2010 at 9:36 PM, Eric Kobrin wrote:
> This brought to mind the general case of detecting emptiness. The
> current practice of using `seq` to check for non-emptiness wastes
> resources.
It depends: in many cases you need to call seq anyway in the non-empty
branch so seq+if-let is
47 matches
Mail list logo