Re: surprising behaviour with do, ns and def

2009-07-13 Thread Stuart Sierra
in namespace user. The crux is this: (def...) is a special form, so the usual rules don't apply. In this case, what matters is when the (def...) form gets READ, not when it gets evaluated. To get the behavior you expect, try the intern function. -Stuart Sierra

Re: tests involving threads

2009-07-07 Thread Stuart Sierra
the future was created. clojure.test uses dynamic bindings for counting the number of tests/assertions. So yes, the answer is to do all your assertions in the test body, not in other threads. I hope this is a special case that won't be a problem too often, since I don't see any way around it. -Stuart

Re: Calling static methods on a variable holding a class

2009-07-07 Thread Stuart Sierra
On Jul 6, 6:59 pm, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, I needed to call a static method on a class stored in a var yesterday and found that it was a little bit trickier than I initially thought. My first impression is that this is probably not the best way to go about this. Java

Re: how does clojure's reader determine encoding when reading source from file?

2009-07-02 Thread Stuart Sierra
Hi Ben, Clojure assumes UTF-8 when loading code. If you want to load source code in a different encoding, you can open a java.io.Reader with the appropriate encoding; the easiest way to do that is probably to use clojure.contrib.duck-streams and bind *default-encoding*. -SS On Jul 2, 2:20 am,

Contrib branch compatible with Clojure 1.0

2009-07-02 Thread Stuart Sierra
Hi folks, I have created a branch of clojure-contrib that should be fully compatible with Clojure 1.0: http://github.com/richhickey/clojure-contrib/tree/clojure-1.0-compatible This includes c.c.test-is with the older syntax for are. Maybe this should be updated to use the newer syntax. Contrib

Re: Contrib branch compatible with Clojure 1.0

2009-07-02 Thread Stuart Sierra
On Jul 2, 2:17 pm, Chouser chou...@gmail.com wrote: Also, is there any reason not to call this contrib-1.0?  It seems to me that it would be most useful to have major contrib versions simply map to major clojure versions:  contrib-1.a.x for clojure-1.a.y The consensus on the dev list

Re: ANN: libraries promoted from contrib to clojure

2009-06-29 Thread Stuart Sierra
On Jun 29, 11:14 am, John D. Hume duelin.mark...@gmail.com wrote: There may already have been a discussion about this in IRC, but I would have loved to see the 'are' macro continue to support the old syntax (maybe with deprecation warnings) as well as the new until after 1.1 is released.

Re: defn memory question

2009-06-25 Thread Stuart Sierra
On Jun 25, 6:25 am, Rich Claxton rich.clax...@gmail.com wrote: Hello I have just started learning Clojure and functional programming, quick question, what happens internally when I do a defn, does this create the byte code, or a ref to the function which is stored, as it does actually create

Re: Differences between 'compiled', 'clojure interpreted', 'clojure in a jar in classpath' and 'load'

2009-06-25 Thread Stuart Sierra
the difference is barely noticeable. The location the code came from (file, JAR, typed at the REPL) makes no difference. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Roadmap of Clojure 1.1

2009-06-25 Thread Stuart Sierra
On Jun 25, 2:51 am, michael frericks michael-freri...@web.de wrote: a) new features planned, b) things that break Clojure 1.0 c) and maybe removed features? Check out http://clojure.org/todo -SS --~--~-~--~~~---~--~~ You received this message because you are

Re: A website written using Clojure.

2009-06-25 Thread Stuart Sierra
On Jun 25, 3:59 pm, Berlin Brown berlin.br...@gmail.com wrote: But does anyone have a problem with Lisp/S-Expressions to HTML/XHtml, especially for the entire document.  What is wrong with using some form of templating system. Yes, I'm partial to StringTemplate, a Java template framework.

Re: clojure.contrib.trace enhancement proposal: dotrace

2009-06-17 Thread Stuart Sierra
Hi Michel, Thanks for working on this! I'm going away this week, but I'll be sure to look at this more closely when I get back. (I wrote the first c.c.trace, it may have been modified by others since.) -Stuart Sierra On Jun 16, 7:13 pm, Michel Salim michel.syl...@gmail.com wrote: I've often

Re: binding at the REPL

2009-06-16 Thread Stuart Sierra
Strange, I get the expected result, Clojure SVN revision 1382: user (def dozen 12) #'user/dozen user (binding [dozen 13] dozen) 13 user (#(binding [dozen 13] dozen)) 13 user -the other Stuart On Jun 16, 2:08 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: This surprised me. What part of

Re: Mnesia like?

2009-06-15 Thread Stuart Sierra
kind of durable Ref that commits to disk, but never had the time to write any code. At some point, you're basically implementing a database, and that's a lot of work. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: (re)setting a function globally

2009-06-10 Thread Stuart Sierra
? It's not much less hacky, but you can do: (alter-var-root #'report-problem (fn [_] mdc.common.test-expect.test-is-adapter/report-problem) The only real difference is that this will preserve var metadata. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: Clojure at LispNYC tonight 7pm

2009-06-10 Thread Stuart Sierra
On Jun 9, 10:32 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: Join us Tuesday, June 9 from 7:00-9:00 for Stuart Sierra's presentation:     Implementing AltLaw.org in Clojure Slides and video here: http://lispnyc.org/wiki.clp?page=past-meetings We'll try to get something lighter than

Re: (re)setting a function globally

2009-06-10 Thread Stuart Sierra
Can I help from the test-is side? Could test-expect be added to clojure-contrib? -Stuart On Jun 10, 1:36 pm, Matt Clark matt.clar...@gmail.com wrote: Thanks for these ideas, I will give them a try tonight and update the adapter namespace with the changes.  If anyone knows of a more

Clojure at LispNYC tonight 7pm

2009-06-09 Thread Stuart Sierra
, software transactional memory, and tools for managing mutable state in a multithreaded environment. Clojure is compiled on-the-fly to Java bytecode, and offers direct and convenient access to any Java library. Stuart Sierra http://stuartsierra.com/ has contributed many

Re: Multimethods derive

2009-06-07 Thread Stuart Sierra
relationships outside the Java class hierarchy. So for now, defining your own root ancestor is the way to proceed. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: What books have helped you wrap your brain around FP and Clojure?

2009-06-07 Thread Stuart Sierra
://gigamonkeys.com/book/ Clojure borrows the good bits of CL. SICP is available online too, http://mitpress.mit.edu/sicp/ -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: Optimizing cross-product mappings

2009-06-05 Thread Stuart Sierra
[] (for [x (range 1 9), y (range 1 )] (format %05d-%04d x y))) -Stuart Sierra --~--~-~--~~~---~--~~ 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

Re: unit testing private methods?

2009-06-03 Thread Stuart Sierra
var)) (intern *ns* symbol var This is slightly evil, and I would never recommend it for any purpose except unit testing, but there it is. -Stuart Sierra On Wed, Jun 3, 2009 at 12:36 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Allen, You could write a function that uses

Fwd: Clojure at LispNYC, June 9th

2009-06-03 Thread Stuart Sierra
.  Clojure is compiled     on-the-fly to Java bytecode, and offers direct and     convenient access to any Java library.     Stuart Sierra http://stuartsierra.com/ has contributed     many modules to Clojure's standard library, including a     testing framework, a code walker, and a macro-based

Re: Using generics

2009-05-29 Thread Stuart Sierra
retrieve them. -Stuart Sierra On May 28, 5:23 pm, tsuraan tsur...@gmail.com wrote: I have a java class whose constructor expects (among other things) a BlockingQueueLong.  It's easy to create a BlockingQueue in clojure (obviously), but I can't figure out the syntax to specialize it to the Long

Re: Question about building modular code in Clojure

2009-05-17 Thread Stuart Sierra
-root, and the changes would only affect the current thread. -Stuart Sierra On May 17, 3:24 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Thanks for your questions.  I'll try to explain better. First, I'll explain that my line of work is to build tools to generate puzzles.  I often have

Re: Extending clojure.contrib.json.write/print-json

2009-05-13 Thread Stuart Sierra
Hi Josip, The latest version of c.c.json dispatches on the type function, which in turn uses class. It should be pretty easily extendible. -Stuart Sierra On May 12, 9:26 am, Josip Gracin josip.gra...@gmail.com wrote: Hi! I'm querying a DB and getting java.sql.Timestamp in results, among

Re: Macros applied to entire programs

2009-05-12 Thread Stuart Sierra
... (prn transformed-code) (recur))) But this sort of source-level transformation is rarely used in Lisp- like languages. A more typical approach would be to write a macro or function that overrides some core function, then use that in your own namespace. -Stuart Sierra

CANCELED: Clojure talk at LispNYC May 12

2009-05-11 Thread Stuart Sierra
Hi folks, I just found out that my presentation for tomorrow has been canceled, due to problems with the venue. But LispNYC will still be meet at the Sunburnt Cow, 137 Avenue C between 9th 10th Streets. I'll be there to talk about Clojure over drinks. My presentation has been postponed to

Re: contrib javalog depends on Java 6

2009-05-10 Thread Stuart Sierra
I'll remove it. -SS On May 10, 1:56 pm, miner stevemi...@gmail.com wrote: I'm just getting started with Clojure.  I had a small issue trying to build the clojure-contrib project.  I'm on an old PPC Mac with only Java 5.  The javalog.clj file requires Java 6. There's an easy fix for

Re: CL libraries - Newbie question

2009-05-10 Thread Stuart Sierra
APIs. Whatever. Java libraries tend to be used by more than two people, so they have a higher likelihood of actually working. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Launching apps

2009-05-09 Thread Stuart Sierra
On May 8, 6:30 pm, Chris Dean ctd...@sokitomi.com wrote: How do folks launch their apps? Shell scripts, calling AOT-compiled classes (gen-class with a -main function). -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: CL libraries - Newbie question

2009-05-09 Thread Stuart Sierra
. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr

Re: java faster than clojure?(probably not)

2009-05-09 Thread Stuart Sierra
One comment, although this has no effect on performance: you don't need to use the static class fields as functions. That is, you can write Math/PI and Short/MAX_VALUE instead of (Math/PI) and (Short/ MAX_VALUE). -Stuart Sierra On May 9, 6:53 pm, Julien julien.ma...@gmail.com wrote: I'm

Re: clojure.contrib.pprint.PrettyWriter ClassNotFoundException

2009-05-09 Thread Stuart Sierra
The pretty-printer requires clojure-contrib to be compiled with ant - Dclojure.jar=... You may be missing that. -SS On May 9, 8:25 pm, Aaron Feng aaron.f...@gmail.com wrote: When I tried to import PrettyWriter from clojure-contrib I'm getting java.lang.ClassNotFoundException.  Am I missing

Re: clojure.contrib.test-is/run-tests throws Wrong number of args passed to: test-is$report

2009-05-07 Thread Stuart Sierra
Hi Stephane, Sorry about this; it was my fault. Should be fixed now, contrib SVN rev. 773. -Stuart Sierra On May 7, 8:27 am, stephaner stepha...@gmail.com wrote: Hi everyone, I've upgrade to the lastest release, i'm trying under Emacs to run- tests and now I receive the following error

Re: HTTP clients in clojure

2009-05-07 Thread Stuart Sierra
On May 6, 8:34 pm, Eric Tschetter eched...@gmail.com wrote:  I'm wonder if such a thing exists, or has everyone basically just rolled their own wrapper on top of their favorite Java HTTP client library? I just use the Apache Commons HTTP client. -SS

Re: gen-class :exposes-methods

2009-05-07 Thread Stuart Sierra
Hi Bruce, It looks like your namespace only implements an interface, rather than extending a class. You need an :extends... line in your (:gen- class...) to set the concrete base class. -Stuart Sierra On May 7, 12:26 pm, gun43 bg-561...@versanet.de wrote: I am having trouble calling

Re: clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-06 Thread Stuart Sierra
On May 5, 2:05 pm, Timo Mihaljov noid@gmail.com wrote: When clojure.contrib.test-is/run-tests is given an invalid argument, it throws a NullPointerException: Fixed! -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Method overloading proxy method

2009-05-05 Thread Stuart Sierra
org.example.FancyInputStream   (:gen-class :extends java.io.InputStream)) (defn -read-void [this]   (int \a)) Related: You can also use the :exposes-methods argument to gen-class to access superclass methods. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you

Re: clojure.contrib.test-is/run-tests throws NullPointerException w/ invalid args

2009-05-05 Thread Stuart Sierra
On May 5, 2:05 pm, Timo Mihaljov noid@gmail.com wrote: When clojure.contrib.test-is/run-tests is given an invalid argument, it throws a NullPointerException: Yes, I'm aware of this, will try to fix. -SS --~--~-~--~~~---~--~~ You received this message

Re: Help: Newbie question get contributed libraries to work

2009-05-05 Thread Stuart Sierra
the classpath; check the docs. You can check the classpath at the REPL like this: (System/getProperty java.class.path) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

Re: Writer turned programmer seeks string processing advice

2009-05-05 Thread Stuart Sierra
libraries) in Java that you could use from Clojure. -Stuart Sierra On May 5, 12:16 pm, dhs827 scheur...@gmail.com wrote: Hi, my name is Dirk Scheuring, I'm a writer based in Cologne, Germany, and I want to write something about AI that can only be expressed by using AI technology and technique

renamed file in duck-streams

2009-05-03 Thread Stuart Sierra
that may need to be fixed to make proper file names. file is for strings that are assumed to be valid file names. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

Re: Does read-string ignore bindings local to forms?

2009-05-01 Thread Stuart Sierra
On May 1, 9:28 am, Julien julien.ma...@gmail.com wrote: How could (read-string ) access to a binding local to a form? Is this possible? (let...) defines a lexical scope, which is only available to forms that are physically (lexically) inside the let. The result of read- string doesn't count

Re: how do I create a runnable clojure program

2009-04-29 Thread Stuart Sierra
to have any hope of success. At some point I hope to write an article with more details. In the mean time, search the list to learn about gen- class and compile. -Stuart Sierra On Apr 29, 7:04 am, Santanu thisissant...@gmail.com wrote: Hi Everybody, I wanted to compile a .clj clojure file

Re: java enum problem

2009-04-29 Thread Stuart Sierra
On Apr 29, 10:14 am, brus emil.bru...@gmail.com wrote: (def AShow (proxy [Enum] [AlwaysShow 1])) I don't think you can proxy an enumeration. You can use gen-class, but even that doesn't work perfectly. You may need to break down and write some Java. -Stuart Sierra

Clojure talk in NYC May 12

2009-04-29 Thread Stuart Sierra
* Clojure libs I've written, like test-is -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send

Re: Clojure talk in NYC May 12

2009-04-29 Thread Stuart Sierra
On Apr 29, 11:21 am, Rich Hickey richhic...@gmail.com wrote: I'll be there - looking forward to it! Ooh, pressure. Guess I gotta make it good. -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Metadata for Any Object

2009-04-29 Thread Stuart Sierra
On Apr 29, 5:58 pm, Stu Hood stuh...@gmail.com wrote: Instead of attaching the metadata directly to the object, what if the metadata was stored outside the object, in a global map of {object metadata, ...}? In order to handle garbage collection, something similar to Java's WeakHashMap could

Git with Google Code

2009-04-28 Thread Stuart Sierra
FYI, for those interested in using Git for Clojure sources, here's Google's advice on how to use Git with Google Code: http://google-opensource.blogspot.com/2008/05/develop-with-git-on-google-code-project.html -SS --~--~-~--~~~---~--~~ You received this message

Re: Should line-seq close the reader?

2009-04-28 Thread Stuart Sierra
clojure.contrib-duck-streams has a similar function, read-lines, that does close the Reader after all the lines have been read (and the sequence consumed). It's not entirely safe, because if an exception or something prevents you from reading all the lines, the Reader remains open. -Stuart

Re: learning clojure, converting a sequence with repetitions to a multi-map

2009-04-28 Thread Stuart Sierra
Hi Boris, welcome to Clojure! This function looks reasonable to me. In your example, you don't need to write #(identity %) -- just identity is enough. If you want to preserve the order of objects in the sequence, you can use a vector instead of a list. I would use contains? in the conditional

Re: How to call function (or Java method) using string name?

2009-04-27 Thread Stuart Sierra
instead. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr

Re: areduce flaw

2009-04-27 Thread Stuart Sierra
methods when they are used as a value, but that might not be easy or efficient to implement. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: How to call function (or Java method) using string name?

2009-04-26 Thread Stuart Sierra
write (+ 1 2 3), the compiler automatically resolves the + to get the Var #'clojure.core/+ To invoke Java methods by name, use the Java Reflection API: http://java.sun.com/docs/books/tutorial/reflect/index.html -Stuart Sierra On Apr 26, 10:46 am, timc timgcl...@gmail.com wrote: Is there a way

Re: Google announcement, version 1.0 SCM Holy War (not really)

2009-04-24 Thread Stuart Sierra
, since git allows you to delete or undo almost anything, including commits in the remote repository. That's actually one of the reasons Google gives for not supporting git -- all that freedom makes it hard to re-implement git on top of their infrastructure. -Stuart Sierra

tangent: X10 language

2009-04-23 Thread Stuart Sierra
address space (called a place). If you want to manipulate data in another place, you have to send the code there with an operator called at. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group

Re: Oracle and Clojure

2009-04-21 Thread Stuart Sierra
control over Java as a means of achieving a competitive advantage over other users in a manner that is detrimental to the ecosystem around the language. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Modifying data structures without changing their interface

2009-04-20 Thread Stuart Sierra
programming in Lisp, then they probably are. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group

Re: Modifying data structures without changing their interface

2009-04-19 Thread Stuart Sierra
) (def p1 (person {:name Stuart Sierra})) (p1 :name) ;;= Stuart Sierra ;; Now change the definition of person. (defn person [record] (fn ([key] (if (= key :name) (str (:first-name record) (:last-name record)) (key record))) ([key value] (if (= key :name

3 new contribs: jar, classpath, find-namespaces

2009-04-19 Thread Stuart Sierra
- clojure.clojure-main ... clojure.contrib.classpath: Small utilities for examining the Java CLASSPATH. clojure.contrib.jar: Small utilities for examining JAR files. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Possible bug of clojure.contrib.json.read

2009-04-17 Thread Stuart Sierra
that maps can only have strings as keys. Maybe json-str should enforce that. -Stuart Sierra --~--~-~--~~~---~--~~ 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

Re: Executable Namespace Proposal

2009-04-17 Thread Stuart Sierra
is invoked as a script. ... Thoughts? I suggest using a -main function for this purpose. Then with (ns ... (:gen-class)) you can generate a static Java class with same behavior. And public static void main(String[] args) is already the standard Java way to make a class executable. -Stuart Sierra

Re: Improving clojure.jar/clojure-contrib.jar compression (ClassLoader alternatives)

2009-04-17 Thread Stuart Sierra
an (old) article with a related example: http://www.javaworld.com/javaworld/jw-04-2000/jw-0421-zipclass.html -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: The Path to 1.0

2009-04-17 Thread Stuart Sierra
my request. :) But it's worth thinking about, given the level of interest recently. I don't care about git/svn/whatever. It's pretty easy to bridge between them these days. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: The Path to 1.0

2009-04-16 Thread Stuart Sierra
management and documentation markup are components of this. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from

Re: Contribs with dependencies

2009-04-15 Thread Stuart Sierra
need a more sophisticated system. We can try to piggyback on an existing Java system like Maven or Ivy, or start from scratch. But someone(s) will then have to take responsibility for maintaining that repository. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: Contribs with dependencies

2009-04-14 Thread Stuart Sierra
FooFactory) (:needs (org.foo.lib :name FooLib, :url http://foo.com/ lib, :version 1.2))) I'm NOT proposing a dependency management system to download and install the JAR files. That way lies madness. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message

Re: What is the difference between :type and :tag metadata?

2009-04-14 Thread Stuart Sierra
in the map itself? -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr

Re: Google includes Clojure in App Engine demo

2009-04-14 Thread Stuart Sierra
On Apr 13, 9:44 pm, levand luke.vanderh...@gmail.com wrote: As a demo of JVM languages running on the Google App Engine, they included a Clojure REPL. Nifty. Printing doesn't seem to work. -S --~--~-~--~~~---~--~~ You received this message because you are

new contrib: per-thread-singleton

2009-04-14 Thread Stuart Sierra
/view_bug.do?bug_id=5025230 -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure

Re: Question about metadata on map keys

2009-04-10 Thread Stuart Sierra
on map keys. In general, if the metadata matters for the value of an object, then it shouldn't be metadata. Some alternatives: 1) put the information directly in the map values; 2) store metadata on the map values; 3) use maps as keys. -Stuart Sierra

Re: set-system-properties

2009-04-10 Thread Stuart Sierra
On Apr 9, 10:48 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Yes to almost all of this (r662). I am not totally comfortable with   the false/false conversion. Cool. I'm not crazy about false/false either, since it's not symmetric. -Stuart

Re: Question about metadata on map keys

2009-04-10 Thread Stuart Sierra
a function, memoize it, and you only need to store the paths. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from

new contrib: singleton

2009-04-09 Thread Stuart Sierra
- clojure.contrib.singleton/singleton ([f]) Returns a memoized version of a function with no arguments. The memoized version caches the function's return value. This is useful for lazily creating global objects that are expensive to initialize. Warning: Make

Re: DISCUSS: tests that read and write files

2009-04-09 Thread Stuart Sierra
(.delete *tmp-properties-file*))) -Stuart Sierra On Apr 9, 1:54 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: In r659 I added a unit test to clojure-contrib that needed to read and   write from the filesystem. I picked a dumb and simple convention, and   welcome review from other

Re: reading properties file: does this helper already exist?

2009-04-09 Thread Stuart Sierra
By the way, recent versions of duck-streams assume UTF-8 unless you rebind *default-encoding*. -Stuart S. On Apr 8, 6:15 pm, Perry Trolard trol...@gmail.com wrote: Hi Stuart, Not sure if you saw my post athttp://bit.ly/sRnfG(links to list), or the props.clj file in the Google Group. In

Re: clojure dependency management and build

2009-04-09 Thread Stuart Sierra
I keep a Clojure stuff dir with the latest revisions of all the projects I track -- Clojure, contrib, swank, slime, etc. -- and update them all with a shell script that runs the various svn update and git pull commands. So I always have access to the latest version of everything. But I don't

A large Clojure deployment

2009-04-07 Thread Stuart Sierra
is online, GPL'd, at http://github.com/lawcommons -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from

Re: A large Clojure deployment

2009-04-07 Thread Stuart Sierra
. The Lucene/Solr index is ~6 GB. The HTML content is ~4 GB, compressed. 99% of the pages are static HTML, pre-rendered in a Hadoop job. -Stuart Sierra On Apr 7, 10:47 am, Sean francoisdev...@gmail.com wrote: Okay wow...  it'll take some time to fully appreciate this. Can you comment on your hardware

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-07 Thread Stuart Sierra
Yeah, I'm thinking of renaming duck-streams/file to something like file-str or filename. -Stuart Sierra On Apr 7, 1:13 am, samppi rbysam...@gmail.com wrote: In addition, it's a bad idea to have these two superficially similar functions have the same name, file. If, in the end, both

Re: A large Clojure deployment

2009-04-07 Thread Stuart Sierra
There isn't an RDBMS mostly because I have an irrational prejudice against them. In this case, the content is mostly static. The Hadoop jobs process collection of source documents -- a few dozen GB, a big ol' mess of PDF, XML, JSON, even WordPerfect! -- and, many hours later, output two things:

Re: A large Clojure deployment

2009-04-07 Thread Stuart Sierra
in a java editor ? Or was it for performance concerns ? ... thanks, -- Laurent 2009/4/7 Stuart Sierra the.stuart.sie...@gmail.com Here:  http://www.altlaw.org/ About 4000 lines of Clojure code, 2500 of Java, powering a web site with well over a million pages, averaging around 10,000

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread Stuart Sierra
is particularly Clojure-like, that would just be (File. foobar). -Stuart Sierra On Apr 5, 5:30 pm, James Reeves weavejes...@googlemail.com wrote: I'd like it if they were combined. You could then use (file foo/bar) or (file foo bar). - James On Apr 5, 9:25 pm, Stuart Halloway stuart.hallo

Re: A syntax feature request: splitting literal strings

2009-04-04 Thread Stuart Sierra
that I just felt like using in my program.)) This is a really long string that I just felt like using in my program. -Stuart Sierra On Apr 4, 11:26 am, samppi rbysam...@gmail.com wrote: I see—perhaps using (str) would indeed be the best answer

Re: proposed new contrib: java-utils

2009-04-04 Thread Stuart Sierra
On Apr 3, 10:17 am, Stuart Halloway stuart.hallo...@gmail.com wrote: (3) coercions for Java's irritating types: File/String, ... clojure.contrib.duck-streams has file but not the others -the other Stuart --~--~-~--~~~---~--~~ You received this message because

Re: retrieving argument :tag metadata

2009-04-04 Thread Stuart Sierra
(meta (resolve 'slurp) f user (meta (first (first (:arglists (meta (resolve 'slurp)) {:tag String} -Stuart Sierra On Apr 4, 5:43 pm, Carsten Saager csaa...@gmail.com wrote: Perhaps I am too stupid, but I can't get it too work to define a function/macro that returns me the arglists

test-is now supports TAP

2009-04-01 Thread Stuart Sierra
for TAP output came from Meikel Brandmeyer's ClojureCheck library. -Stuart Sierra --~--~-~--~~~---~--~~ 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

Re: Gen-class, extending a parameterized type

2009-03-31 Thread Stuart Sierra
As an interim solution, you could write a wrapper class in Java that extends the parameterized class, then extend that class in Clojure. -Stuart On Mar 31, 11:23 am, Chas Emerick cemer...@snowtide.com wrote: gen-class does not yet support parameterized types.  Rich is aware of   the issue,

Re: file io

2009-03-30 Thread Stuart Sierra
On Mar 26, 1:34 pm, Victor Rodriguez vict...@gmail.com wrote: (defmacro with-out-as   [f body]   `(with-open [w# (writer ~f)]      (binding [*out* w#]       �...@body))) I've added something very similar to this to clojure.contrib.duck- streams. -Stuart Sierra

Re: new in contrib.test-is: fixtures

2009-03-30 Thread Stuart Sierra
On Mar 29, 3:05 pm, John D. Hume duelin.mark...@gmail.com wrote: This is a cool functional way of defining these, but I think I'd prefer to just call the fixture function from the tests needing common setup because of the standard problems with shared setup in unit tests. (In brief, the test

slightly off-topic: JDK 7 performance boost

2009-03-30 Thread Stuart Sierra
Thought some might be interested: http://lingpipe-blog.com/2009/03/30/jdk-7-twice-as-fast-as-jdk-6-for-arrays-and-arithmetic/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

new in duck-streams: with-out-writer / with-in-reader

2009-03-28 Thread Stuart Sierra
))) (defmacro with-in-reader Opens a PushbackReader on f, binds it to *in*, and evaluates body. [f body] `(with-open [stream# (PushbackReader. (reader ~f))] (binding [*in* stream#] ~...@body))) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message

new contrib: with-ns macro

2009-03-28 Thread Stuart Sierra
namespace, which is then immediately removed. The temporary namespace will 'refer' clojure.core. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

children function for hierarchies

2009-03-27 Thread Stuart Sierra
] (contains? (parents h t) tag)) (descendants h tag) The repetition is necessary because clojure.core/global-hierarchy is private. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure

Re: dynamic member-symbol in (.) form

2009-03-25 Thread Stuart Sierra
. It wouldn't be too hard to wrap that up in a macro. -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from

Re: Turning a non-standard iterator into a seq

2009-03-25 Thread Stuart Sierra
(.hasNext iterator) (cons (.nextSequence iterator) (bio-iterator-seq iterator) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: file io

2009-03-24 Thread Stuart Sierra
On Mar 24, 12:42 pm, Parth Malwankar parth.malwan...@gmail.com wrote: user= (with-open [f (writer (file test.txt))]          (binding [*out* f]            (println hello world !!!))) Or even more simply: (use 'clojure.contrib.duck-streams) (spit test.txt Hello, world!\n) -Stuart Sierra

Re: Information Hiding

2009-03-23 Thread Stuart Sierra
, but I want to understand the difference between :a and ::b. Keyword namespaces work like symbol namespaces. :a has no namespace. ::b expands to :user/b You can also write :user/b explicitly. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because

Re: Help with the dot operator special form

2009-03-22 Thread Stuart Sierra
On Mar 21, 10:23 pm, Timothy Pratley timothyprat...@gmail.com wrote: You may be able to achieve what you want by directly accessing Clojure's reflector class instead of using the special form: You could also call Java's reflection API directly. -Stuart Sierra

<    5   6   7   8   9   10   11   12   13   >