> doseq is a macro, not a function, and its expansion expands the loop right
> in place :
Right. Why does it work (in the finally block) when wrapped up in a
function, but not when doseq is called directly?
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
Why does that work? The same recursion happens in the finally. There's
a layer of indirection now, but the doseq was already a layer of
indirection between the finally and doseq's internal recur.
I see from the linked thread above that the basic issue is a known
implementation issue with Clojure t
Actually, the for didn't work for me either but I believe that was a
lazy evaluation issue. The doseq seems to use internal recursion,
which breaks the try/finally. My final solution was to build up doseq
functionality with reduce. See below:
(defn foo1 []
(try
(println "body")
(finally
Thanks to both of you for the replies. Adrian, I like the in-line loop-
recur. Cuppo, that example is essentially the same one that I was
describing but it was key to helping me, as I saw that it evaluated
fine when I expected it to fail based on my original problem.
Turns out that the problem was
I have a function foo which uses tail recursion:
(defn foo [] (recur))
I need to do some clean-up work after foo (there is an external
binding that requires some post-foo processing), and this needs to
happen even if foo fails. The naive approach was:
(try (foo)
(finally (clean-up))
Howe
I've been using Clojure for a great deal of what I code for the last 6
months or so, both professionally and personally. (And plan to make an
appropriate donation through my company once we've monetized the
Clojure-based product).
In particular, we've created a data integration tool coded in Cloj
> Has anyone here been able to install Clojure on IcedTea?
For what it's worth, I run Clojure on SoyLatte and have never had a
problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this
If you maintain some discipline in your engineering process, then
there's very little risk due to the specific library (and if you don't
keep a high level of discipline, then you're finished before you
start).
- Test the h*ll out of everything. If there are bugs in Clojure that
affect you you'll
Are there strong feelings against moving away from a centralized
contrib repository in favor of a directory (probably on clojure.org)
of independent projects? Seems to me that this simplifies the matter
of getting just the libraries you need without having to worry about
unrelated dependencies, an
On Apr 13, 4:50 pm, "Stephen C. Gilardi" wrote:
> % java -cp clojure.jar clojure.main -e "(in-ns 'funky-ns)" --repl
> #
> funky-ns=>
Worked perfectly, thanks!
> Regarding your Case 2 where it appeared you were actually in a
> namespace other than the one shown in the prompt, that's very
> u
I have a bootstrap file (executed either on the command line or via
user.clj) that contains an in-ns call, along with other stuff that I
have verified working (e.g. println statements).
I'd like the bootstrap file to leave the REPL in whatever namespace I
last specified with my in-ns. But I'm get
Does anybody know if there's a way to coerce gen-class into creating a
static block in the generated class?
thanks,
Greg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send em
That's exactly what I did; no issues. Thanks!
On Mar 31, 1:47 pm, Stuart Sierra wrote:
> As an interim solution, you could write a wrapper class in Java that
> extends the parameterized class, then extend that class in Clojure.
> -Stuart
--~--~-~--~~~---~--~~
You
Aquamacs is probably your editor of choice on OSX; then follow
standard emacs/slime instructions as per the other links...
On Mar 30, 8:59 am, Sean wrote:
> Mark,
> This is a great writeup on installing clojure. As an OSX nerd, my
> main problem is getting an editor up and running. Maybe you c
I need to extend an abstract Java class with a generic type, ala:
public abstract class Foo {}
I tried the syntax (gen-class :name fooImpl :extends com.x.Foo) and
get
java.lang.ClassNotFoundException: com.x.Foo
Without the I'd get: a RuntimeException complaining that I'm
extending the raw typ
I see that a "lib" section has been added to the Clojure site since I
was last there, which is a good major step. I think that it may be
useful to add a section there explicitly describing the differences
from standard Java packaging, perhaps adding a Java package example to
compare against the li
Let me offer a perspective coming from a Java background:
I know that there are subtle differences between a namespace and a
Java package, but I still tend to subconsciously consider them
analogous: they are container structures for organizing code. The code
itself (Java classes, or Clojure files
nting the wheel again...
>
>
>
> On Thu, Jan 29, 2009 at 6:15 AM, Greg Harman wrote:
>
> > One of Clojure's big selling points (obviously) is the support for
> > concurrent programming. However, the performance gains you get with
> > this concurrency hits
Agreed; the communication layer needs to come first. Regarding
serialization, specifically, I think we get that for "free" with s-
exps (there may be some under-the-hood evaluation time necessary for
remoted expressions, but [de]serialization is rarely a lightweight
process).
On Jan 29, 10:03 am,
One of Clojure's big selling points (obviously) is the support for
concurrent programming. However, the performance gains you get with
this concurrency hits a scalability wall once you're fully utilizing
all the cores available in your server. The next step, of course, is
to add additional servers
Oh, to make sure I answered your direct questions:
> increases. So the question is: what are the different ways that one
> can run or package up a Clojure/Java program, so that it is invoked by
> running a shell (or DOS cmd) script?
Compile the clojure files (or not) and package them in a .jar.
Hi Tim,
The REPL is your tool for working with your program, debugging,
tuning, etc. But it's not your primary source repository! You'll keep
your source in a file hierarchy, organized by namespace (similar to a
Java package, albeit with subtle differences). As you're working with
the source, you
A couple things:
1. I don't know about embedding jars... Instead, use the Class-Path
manifest attribute to link in clojure.jar.
2. I noticed that your jar command was specifically packaging only
compileexample.class. You need all 4 of those generated classes in the
jar.
-Greg
On Jan 27, 11:01
ssion in the REPL, it gets
> evaluated. Evaluation goes through the Compiler which generates
> bytecode from your forms. Before the bytecode can be executed, it
> needs to be loaded into the JVM, and that happens by wrapping it in a
> class and loading that.
>
> On Sun, Jan 25, 20
Thanks for the explanation, Meikel.
My statement about anti-pattern was predicated on each call to fn[]
creating a new class - I see from your explanation and from going back
and re-reading Rich's old posts on this topic that I misunderstood it
before. (If it did create a new class each time, I'd
I believe you, but I don't understand why. I'm doing nothing but
evaluate my test function over and over. Since no new functions are
being defined, why would this evaluation use any PermGen?
On Jan 25, 5:57 am, Christian Vest Hansen
wrote:
> Clojure creates class not for every function call, but
> This could be a real problem for Clojure. I can think of other
> techniques that could easily result in the creation a large number of
> anonymous functions that ought to get gc'd after a few ms but
> permanently increase memory usage by a significant amount. I don't
> know the JVM very well at
I'm trying to debug a problem in one of my programs in which PermGen
usage grows with and during each run (cumulatively within the same
REPL session) until I eventually run out & get the out of memory JVM
exception. So I wrote the following utility just to help me track
usage while I hack:
(defn
can't seem to find any documentation
for what _ as a function argument means...
On Jan 22, 6:14 am, Greg Harman wrote:
> Thanks Tim, I'll have a look at that.
>
> To clarify my use case, I was thinking of events that can be processed
> sequentially but that may take a non-
Thanks Tim, I'll have a look at that.
To clarify my use case, I was thinking of events that can be processed
sequentially but that may take a non-trivial amount of time to
complete (both CPU and IO bound at different stages of processing) so
it's ideal to have a thread pool to process different t
I'd like to implement a processing queue in which I'll asynchronously
drop events (represented by, say, a structmap) onto a queue, and
retrieve the results later.
One possible approach to this could be using an agent to store the
results (the agent's controlled state is a collection of results fr
doc (the doc
does discuss "branch" but it wasn't clear what the definition of
branch was - as per my misunderstanding).
On Jan 18, 4:36 pm, Christophe Grand wrote:
> Greg Harman a écrit :
>
> > Take the following data structure, wrapped up with clojure.zip/seq-
Take the following data structure, wrapped up with clojure.zip/seq-
zip: '(+ (- 1 2) (* 3 4))
Repeatedly calling clojure.zip/next produces these "nodes":
+
(- 1 2)
-
1
2
...
The (- 1 2) is what's throwing me off. Drawing out a tree structure, I
see that my nodes are + - 1 2 * 3 4 and the struct
-Greg
On Jan 17, 2:15 pm, Nathan Kitchen wrote:
> On Sat, Jan 17, 2009 at 11:06 AM, Greg Harman wrote:
>
> > Meta: This thread is a revival and continuation of last month's
> > discussion at:
> >http://groups.google.com/group/clojure/browse_thread/thread/e1226810b.
Meta: This thread is a revival and continuation of last month's
discussion at:
http://groups.google.com/group/clojure/browse_thread/thread/e1226810b6ac7bfc/8e0f53c141c26fcc?lnk=gst&q=eval+binding#8e0f53c141c26fcc
---
Nathan, did you ever come up with a better way to do this than using a
global v
> > 2. If I want the Clojure functions that underlie the methods in the
> > generated class used directly by my Clojure code as well (which I do),
> > then I'm stuck having to either violate standard Clojure/Lisp function
> > naming conventions in favor of Java-friendly naming or I have to write
>
rd_edition/html/lexical.html#3.8
>
> user=> (Character/isJavaIdentifierPart (int \-))
> false
> user=>
>
>
>
> On Fri, Jan 16, 2009 at 9:56 AM, Greg Harman wrote:
>
> > I think I may have found a minor issue with gen-class, but wanted to
> > confirm with the group
fierPart (int \-))
> false
> user=>
>
>
>
> On Fri, Jan 16, 2009 at 9:56 AM, Greg Harman wrote:
>
> > I think I may have found a minor issue with gen-class, but wanted to
> > confirm with the group that I'm not just doing something stupid...
>
> > (ge
I think I may have found a minor issue with gen-class, but wanted to
confirm with the group that I'm not just doing something stupid...
(gen-class :name mypkg.foo
:prefix ""
:methods [[my-method [Object] Object]])
Results in the following method signature in the .class file
You're my personal Santa Claus today! :-)
Confirmed present and working for both insert and update, using a 2
field where clause.
On Jan 14, 5:14 pm, "Stephen C. Gilardi" wrote:
> I've added update-or-insert-values. I'd appreciate hearing how it
> works for you.
--~--~-~--~~
Steve,
Thanks much for your work. The new with-query-results seems to work
quite well.
Your timing is impeccable with this set of changes: I had just
finished hacking out a (much uglier) version of update-values as well.
(I'll switch over to using the clojure.contrib.sql versions now for a
numbe
Asbjxrn,
One thing that leaps out to me performance-wise is the 3 nested loops
(dotimes, dotimes, loop/recur). Whatever's inside the inner loop is
getting run a lot of times! General advice about reducing loop depth
and computation required inside the innermost loop aside... have you
looked at cl
For more than just experimentation with one file, you might also want
to look into lib packaging so that you can 'require' or 'use' rather
than have to go down to the level of 'load' or 'load-file'. Quick
summary, if your file has namespace "foo.bar" then package it in file /
foo/bar.clj (relative
unction and just get this
all into the macro, but I burned my allotted time on it before I got
that working...
-Greg
On Jan 9, 5:05 pm, Greg Harman wrote:
> Would someone mind posting an example of a parameterized query using
> clojure.contrib.sql? There are examples in the source of n
Would someone mind posting an example of a parameterized query using
clojure.contrib.sql? There are examples in the source of non-
parameterized queries, and do-prepared is used to parameterize values
for inserts, but I can't seem to get my form quite right for a query.
thanks,
Greg
--~--~---
Thanks, Meikel.
I feel a bit silly, but I do have it working now.
* Not quoting foo is more than superfluous; it was the primary cause
of my problem. I did study that clojure.org example, just missed the
lack of quote...
* There wasn't an example of a void return type and I assumed that,
like an
t a patch.
On Jan 7, 10:39 pm, Greg Harman wrote:
> I'm playing around with gen-interface, and compiled the following:
>
> (ns mypkg.compiletest)
> (gen-interface :name mypkg.ICompileTest
> :methods [['foo [] []]])
>
> I then used a java .class decompi
I'm playing around with gen-interface, and compiled the following:
(ns mypkg.compiletest)
(gen-interface :name mypkg.ICompileTest
:methods [['foo [] []]])
I then used a java .class decompiler to look at the resulting .class
file expecting to see an interface with a single method c
> You're calling my bluff, eh? Well, no I don't yet.
Although I have been known to do some bluff-calling, in this case I
was actually hoping you had done it because I need this for a project
I'm working on. :-)
> I think the problem with your example is trying to work with classes
> or namespac
Chouser,
Do you have an example of gen-interface + proxy working together? Take
a look at the following. Proxy works fine for a Java-provided
interface, but not for the generated one (ICompileTest.class is being
generated and is in the filesystem/classpath where expected.)
(ns compiletest)
(gen-
Bingo - *compile-path* was a relative dir. Defining it as the full
path did the trick.
Thanks!
> Also, make sure the directory named by *compile-path* exists on the file
> system. Compilation creates subdirs, but not *compile-path* itself.
--~--~-~--~~~---~--~~
Y
> One solution would be to load a single file and then have that file use
> add-classpath to set the classpath, but add-classpath is unreliable;
> I've had problems getting it to work consistently and have been told in
> #clojure that I shouldn't be using it.
Possibly the cause of the compile pro
and
the directory in *compile-path* is also on the cp (via add-
classpath).
It's not the "load" operation that caused it - I removed that entirely
and just put a placeholder (defn foo [] true), and the compilation
still crashes on this line.
On Jan 7, 10:17 am, Greg Harman wrot
Nevermind, with a fresh start today (and perhaps more importantly,
perhaps, a fresh environment) compiling seems to work fine.
> It works for "require" and for calling functions in the package(s),
> but the problem now is that it doesn't work for AOT from the REPL.
>
> (compile 'package1) crashes
y under a
> directory (or JAR file) on the Java classpath. Also check out the Ant
> build.xml files from Clojure core and clojure-contrib.
>
> -Stuart Sierra
>
> On Jan 6, 1:11 pm, Greg Harman wrote:
>
> > Hi all,
>
> > I'm struggling a bit with how be
In partial answer to my own question, I found these threads helpful:
http://groups.google.com/group/clojure/browse_thread/thread/bf9672989524a1bf/1f35a50643bd6325?lnk=raot
http://groups.google.com/group/clojure/msg/58e3f8e5dfb876c9
Everything seems to work well, except compilation. I'll post any
The REPL & Main section of the website doesn't have any content... not
written yet, or accidental omission?
http://clojure.org/repl_and_main
-Greg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To
Hi all,
I'm struggling a bit with how best to organize and bootstrap a
multiple-source file project so that it can be run either command-line
(java -cp clojure.jar:myapp.jar ...) or by running a load method from
the REPL without having to explicitly change the classpath in my
user.clj before runn
Thanks, Mike - although we had already looked at the context
classloader, your explanation did provide some inspiration for a
workaround. The correct classloader should be available in the JSP and
so it should be possible to grab it there and pass it into Clojure as
a variable (or a binding?) in t
Thanks for that - I'm all up to date now. The bad news is that it
didn't seem to affect my problem at all.
On Dec 28, 6:58 pm, "Michael Wood" wrote:
> The current version of Clojure is 1185. Clojure was recently moved to
> Google Code:
>
> http://groups.google.com/group/clojure/browse_thread/t
I tried creating a JSP to let Slime connect to a REPL running in
Tomcat, as was posted here:
http://groups.google.com/group/clojure/browse_thread/thread/d73efa2943179a36/dd1c84dcf658436e?lnk=gst&q=jsp#dd1c84dcf658436e
The JSP "works" in that there is an instance of swank running in
Tomcat's JVM,
61 matches
Mail list logo