Re: What's a convenient way of calling super.method()?

2009-03-22 Thread Stuart Sierra
to rethink your design, perhaps by using different names for the super and sub methods. -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: capturing stdout

2009-03-22 Thread Stuart Sierra
On Mar 22, 10:34 am, Mark Volkmann r.mark.volkm...@gmail.com wrote: (defn get-output [fn]   (let [sw (StringWriter.)]     (binding [*out* sw] (fn))     (.toString sw))) This is what clojure.core/with-out-str does. -Stuart Sierra --~--~-~--~~~---~--~~ You

Re: Method overloading proxy method

2009-03-22 Thread Stuart Sierra
argument types. You need one method with a conditional: (defn create-visitor [] (proxy [VoidVisitorAdapter] [] (visit [arg1 arg2] (if (instance? MethodDeclaration arg1) ... You could also define a multimethod and call it from the proxy. -Stuart Sierra

Re: The unshared part of two mostly-shared structures

2009-03-22 Thread Stuart Sierra
equality would be difficult to impossible in Clojure, since it relies on Java's hash/pointer/equality semantics. But Enchilada looks interesting, and a hash-based data structure in Clojure would also be interesting. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: User contributed packages (Cabel, CPAN, etc)

2009-03-22 Thread Stuart Sierra
system is pretty popular and even supported by build tools other than Maven Maven is a big, complicated beast, but... it's there, it's widely deployed, and it's Java. That makes it a good choice in my book. The less new infrastructure Clojure requires, the better, I believe. -Stuart Sierra

Re: Behavior of clojure.set/union and hinting function arguments

2009-03-22 Thread Stuart Sierra
(NO_SOURCE_FILE:0) ; wants java.lang.Number, but I was hinting for java.lang.Double As above, the type tag is not a constraint. But + needs a number, and that *is* a constraint. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Stuart Sierra
On Mar 19, 8:22 am, Rich Hickey richhic...@gmail.com wrote: So far it seems like sequential let has proven a useful default, and   I'd rather have one let than two. Agreed - sequential let is a better default. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: test-is: new feature suggestion

2009-03-19 Thread Stuart Sierra
testing... -Stuart Sierra On Mar 19, 3:28 pm, Frantisek Sodomka fsodo...@gmail.com wrote: Hello Stuart all! As discussed in this thread: test-is: generating and processing testing datahttp://groups.google.com/group/clojure/browse_frm/thread/3e84efefd7c0... , sometimes it is necessary

Re: Which Java book(s) to order

2009-03-17 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: reload modified java class

2009-03-17 Thread Stuart Sierra
On Mar 17, 4:46 am, linh nguyenlinh.m...@gmail.com wrote: Is it possible to reload a modified Java class in REPL? You could write a custom ClassLoader to load (and then reload) your Java classes. Not impossible, but not trivial. -Stuart Sierra

Re: filter1 interesting?

2009-03-17 Thread Stuart Sierra
On Mar 16, 8:14 am, Rich Hickey richhic...@gmail.com wrote: Did anyone consider ffilter or find-first? I've changed it to find-first in seq-utils. That seems to be the least objectionable name, all things considered, and has the virtue of being easy to remember. -Stuart Sierra

Re: filter1 interesting?

2009-03-16 Thread Stuart Sierra
, especially in a proportional font. Others I considered: find1, filter1, select1, pick, detect, spot, hit, ... pick might be good. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Clojure Web Framework, what I want to add

2009-03-16 Thread Stuart Sierra
trouble than it was worth. -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

Re: filter1 interesting?

2009-03-15 Thread Stuart Sierra
consumes the entire sequence. In the case of an infinite sequence, it may never terminate! So overloading first would conflate two very different behaviors. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: filter1 interesting?

2009-03-14 Thread Stuart Sierra
coll))) -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: Clojure code: reserve lists (parens) for forms? (canonical ns)

2009-03-13 Thread Stuart Sierra
for key-value arguments: (ns com.example.foo :use [clojure.contrib.duck-streams] :import [[java.util Map ArrayList]]) But I don't think there's much to gain by changing it. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: mocking in clojure

2009-03-13 Thread Stuart Sierra
Hi Allen, Sorry I haven't kept up with this. I think, though, that it's best to have it as a standalone library in clojure-contrib, so that people can use it with other testing frameworks if they want to. -Stuart On Mar 13, 3:20 pm, Allen Rohner aroh...@gmail.com wrote: Any other options out

Re: Bytecode optimization

2009-03-12 Thread Stuart Sierra
generate bytecode that the JVM will optimize. -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: version of - short-circuiting on nil

2009-03-12 Thread Stuart Sierra
to successive instance members were null before continuing ... This has been discussed here: http://groups.google.com/group/clojure/browse_thread/thread/c4eb149248859a18/aab137e1d9363f67 -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you

Re: Request: Can clojure.contrib.walk provide a reduce type operation?

2009-03-11 Thread Stuart Sierra
be a useful feature. I'll look at implementing it, should be doable. -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: Enjoying test-is

2009-03-11 Thread Stuart Sierra
On Mar 11, 2:45 am, mikel mev...@mac.com wrote: I just wanted to say thanks to Stuart Sierra for test-is. On Mar 11, 9:15 am, stephaner stepha...@gmail.com wrote: I use test-is too, this is a very usefull test framework. You're both very welcome! -Stuart Sierra

Re: filter1 interesting?

2009-03-11 Thread Stuart Sierra
. Therefore, this form is not safe on infinite sequences! For example, (first (filter neg? (iterate inc 0))) never terminates. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: What is Clojure NOT good for?

2009-03-11 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: filter1 interesting?

2009-03-09 Thread Stuart Sierra
I do use this pattern, but if I were naming it I think I'd call it find-first. But that's scarcely shorter than (first (filter ...), which is why I've never actually defined it. -Stuart Sierra On Mar 8, 3:20 pm, André Thieme splendidl...@googlemail.com wrote: I regularily stumble upon

Re: How can I make the smallest structure possible?

2009-03-09 Thread Stuart Sierra
Java doesn't have a C-like structure type, so Java objects still have overhead. If you want the absolute minimum number of bytes in memory, you can create Java primitive arrays in Clojure: (make-array Integer/TYPE 100) Then access them with the aset... and aget functions. -Stuart Sierra

Re: Capitalize string

2009-03-08 Thread Stuart Sierra
On Mar 8, 9:39 am, David Sletten da...@bosatsu.net wrote: Is there a function to capitalize the first letter of a string or a   better way than this idiotic code? Once again, Apache Commons to the rescue: http://tinyurl.com/d38wwq (StringUtils/capitalize clojure) ;;= Clojure -Stuart Sierra

Re: On the importance of recognizing and using maps

2009-03-08 Thread Stuart Sierra
-need I don't even use struct-maps in Clojure, just plain 'ol maps, sets, vectors, and lists. They really do provide everything you need. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group

Re: clojure.contrib.stacktrace

2009-03-07 Thread Stuart Sierra
example, you probably want print-cause-trace instead of print-stack-trace. You probably also need a number much higher than 5 to get useful information. Someone else put a more elaborate stack trace library on github, you could search the list for it. -Stuart Sierra

Re: Workflow poll?

2009-03-07 Thread Stuart Sierra
file as the source code (using clojure.contrib.test-is, of course), except in cases where dependencies make that awkward. I'm trying to train myself to write a test for every bug I find, so I can prove that I've fixed it. -Stuart Sierra --~--~-~--~~~---~--~~ You

Re: What is Clojure NOT good for?

2009-03-07 Thread Stuart Sierra
combination. -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: Questions about nested associative structures

2009-03-05 Thread Stuart Sierra
, and write lookup and assoc functions that use i*columns+j as the index. I'm guessing (a) for small, non-sparse vectors, (b) for large, sparse vectors, and (c) for large, non-sparse vectors. Totally untested, unverified, and unsubstantiated. :) -Stuart Sierra

Re: Clojure's syntax design: macros vs functions

2009-03-04 Thread Stuart Sierra
(+ x y), a macro (and x y), or a special form (if x y z). The choice of function/macro is really just an implementation detail. What matters is what the form does, and what it returns. -Stuart Sierra On Mar 4, 8:03 pm, Elena egarr...@gmail.com wrote: I wonder if Clojure does employ the same

Re: So what do we want for a Cells-alike ?

2009-03-03 Thread Stuart Sierra
, is to build something that works alongside atoms/ agents/refs/vars, *not* something that adds a whole separate cells API. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

Re: Synchronous watches

2009-03-01 Thread Stuart Sierra
On Feb 27, 9:57 am, Rich Hickey richhic...@gmail.com wrote: I've added (back) synchronous watches (svn 1309+), which used to exist for agents, now for all reference types. Cool. I won't have much time to play with this until next week, but I look forward to experimenting with it. -Stuart

Re: Opinions on - macro? (was Re: Extensive use of let?)

2009-02-28 Thread Stuart Sierra
it? Definitely. When you're applying a bunch of functions to the same object, it can be clearer to use -. I don't use it often, but when I do, my code is much easier to read. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: The Application Context Pattern

2009-02-27 Thread Stuart Sierra
implementations so far. -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: Waterfront - The Clojure-based editor for Clojure

2009-02-25 Thread Stuart Sierra
for a Clojure in a Box type of download, filling the role that IDLE does for Python. One could easily package Waterfront, Clojure core, and contrib in a single JAR that runs with a simple java -jar, to help newcomers get started with the language quickly. I can help with the build files. -Stuart

Re: dorun and map

2009-02-24 Thread Stuart Sierra
I've occasionally thought of adding domap to clojure.contrib.seq- utils: (defn domap [f coll] (doall (map f coll))) -Stuart Sierra On Feb 24, 1:23 pm, Jason Wolfe jawo...@berkeley.edu wrote: You could use doseq? Now, if you want eager evalation *and* a result seq, I think you're stuck

Re: *features*-var

2009-02-23 Thread Stuart Sierra
I've always thought *features* was a nuisance in CL, since very few values were ever standardized. It ends up being used like browser- sniffing code in JavaScript. -Stuart Sierra On Feb 23, 12:16 pm, pmf phil.fr...@gmx.de wrote: Some (most, if not all) CL variants have a *features*-var

Re: alternate syntax

2009-02-23 Thread Stuart Sierra
. It's never caught on. For one thing, it's harder than you think when you get into all the edge-cases. For another, it usually doesn't offer any compelling advantages over the standard syntax. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because

Re: Would people be interested in extending test-is with random tests?

2009-02-23 Thread Stuart Sierra
where you can assert non-trivial properties that always hold. That's not to say there isn't a place for this in contrib. I'd be happy to have this available as an extension to test-is, but I'd prefer to have it in its own namespace so that test-is doesn't grow too much. -Stuart Sierra On Feb 23

Contrib tests on new Lazy Clojure

2009-02-21 Thread Stuart Sierra
Hi all, I added a file to contrib, load_all.clj, to help test which libraries don't work under the new, lazier, Clojure. It's just a script that requires every lib. I think I got them all; please add any that are missing. I deliberately left out test_clojure.clj and test_contrib.clj because

Re: General Question Clojure(Lisp) Idiom, cross cutting? What is the terminology

2009-02-20 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: test-is integration via SLIME

2009-02-18 Thread Stuart Sierra
That's really nifty, Phil! I'll have to check it out. -Stuart Sierra On Feb 18, 7:07 pm, Phil Hagelberg p...@hagelb.org wrote: I've been cooking up a little tool to help with running tests using test-is. It's a little cumbersome to need to switch back and forth between the test buffer

Re: Yet another how do I make gen-class work? thread

2009-02-18 Thread Stuart Sierra
that gen-class really only generates a stub class, which dynamically loads a Clojure namespace (from source or compiled) and uses the definitions from that namespace. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: clojure and embedded derby

2009-02-17 Thread Stuart Sierra
Is your Clojure app running in a REPL? I've run into situations where it seems like the Derby lock file doesn't go away until the Clojure process terminates. -Stuart Sierra On Feb 17, 10:28 am, BrianS bstephen...@enclojure.org wrote: Has anyone had experience creating clojure applications

New lazy branch of clojure-contrib

2009-02-16 Thread Stuart Sierra
checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure- contrib-lazy -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: New lazy branch of clojure-contrib

2009-02-16 Thread Stuart Sierra
On Feb 16, 3:52 pm, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: Isn't that second url just the normal one for contrib trunk? Oops, sorry. svn checkout http://clojure-contrib.googlecode.com/svn/branches/lazy/ clojure- contrib-lazy --~--~-~--~~~---~--~~

Re: terminology question re: binding

2009-02-16 Thread Stuart Sierra
. I await corrections. :) -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: run clojure on 5,832 cores?

2009-02-13 Thread Stuart Sierra
/news/2009/020509-sicortex.html says they use slower, cheaper processors that work best when you're doing lots of small computations in parallel. The part I get excited about is the 8 TB of memory. When can I get THAT on my desk? -Stuart Sierra

let and binding have different ordering behavior

2009-02-12 Thread Stuart Sierra
Whoops, this caught me today. Whereas let evaluates its bindings sequentially, binding does not! Observe: (def a a1) (def b b1) (let [a a2, b a] b) ;;= a2 (binding [a a2, b a] b) ;;= a1 I wouldn't call this a bug, but I think it's worth noting in the doc string for binding. -Stuart Sierra

Re: generated class with overloaded methods

2009-02-12 Thread Stuart Sierra
point of view. If you want different behavior, you have to check the type in your function or use a multimethod. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: stacktrace/print-cause-trace swallows exceptions

2009-02-10 Thread Stuart Sierra
Thanks, Chas. Fixed in SVN rev. 448. -Stuart Sierra On Feb 10, 4:36 pm, Chas Emerick cemer...@snowtide.com wrote: In the process of tracking down some failing test-is tests, I believe I discovered that it (via stacktrace) swallows exceptions. Specifically, when an error occurs, it uses

Re: Clojure Maps and Java Maps

2009-02-06 Thread Stuart Sierra
On Feb 6, 2:02 pm, Peter Wolf opus...@gmail.com wrote: How does one convert a Clojure Map to the equivalent Java Map?  I bet I could do it in one line if I knew the magic. To convert all keys to strings, there's clojure.contrib.walk/stringify- keys. -Stuart Sierra

Re: test-is: (is (thrown? ...)) exceptions REPL

2009-02-05 Thread Stuart Sierra
. Yes. In the current implementation of test-is, tests are compiled into functions when they are defined. So compile-time exceptions can't be caught. I assume these situations are fairly rare and easily corrected. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: test-is: (is (thrown? ...)) exceptions REPL

2009-02-05 Thread Stuart Sierra
: user= (map #(/ 10 %) [1 2 0 5]) java.lang.ArithmeticException: Divide by zero (10 5 user= -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

New York Hadoop User Group, Feb. 10

2009-02-05 Thread Stuart Sierra
Hello, New York! If you're interested, I'm presenting at the New York Hadoop User Group [1] next Tuesday, February 10, at 6:30. I'll talk about using Clojure with Hadoop, among other things. [1] http://www.meetup.com/Hadoop-NYC/ -Stuart Sierra

Re: Macro defining Macros issue.

2009-02-05 Thread Stuart Sierra
the result to each supplied case, evaluating whatever returns true or raising an error otherwise. Your basic ecase like macros. There's some code very similar to what you describe in clojure.contrib.fcase. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: New York Hadoop User Group, Feb. 10

2009-02-05 Thread Stuart Sierra
On Feb 5, 2:12 pm, Vincent Foley vfo...@gmail.com wrote: Do you have slides for those of us who cannot attend? I'll post a link when I finish them. :) But my slides tend to be images, not outlines. I don't think this meetup is recorded. -Stuart Sierra

Killing/interrupting agents?

2009-02-01 Thread Stuart Sierra
the action function? My use-case is a REPL-like utility that can run each expression the user types in a separate thread, and can kill off threads that are misbehaving or not terminating. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you

Re: Cells using agents and watchers

2009-01-30 Thread Stuart Sierra
that there are at least two other implementations of Cell-like libraries, so clearly there's a lot of interest in this topic. -Stuart Sierra On Jan 30, 8:53 am, Timothy Pratley timothyprat...@gmail.com wrote: Hi Stuart, On Jan 30, 1:43 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: I have put

Re: Indy .NET programmers discover parentheses

2009-01-29 Thread Stuart Sierra
A few people have gotten Clojure to run on .NET using bridges like IKVM. Check the list archives for details. -S On Jan 29, 10:50 am, Shawn Hoover shawn.hoo...@gmail.com wrote: Heartland Clojure Users, I'm giving a presentation on Clojure next month for the Indianapolis ALT.NETgroup. The

Re: Alternatives to contains?

2009-01-29 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

Cells using agents and watchers

2009-01-29 Thread Stuart Sierra
(an auto- agent) whose value is defined by an expression. Whenever one of the other variables (agent, atom, or ref) referenced in the expression changes its value, the expression is automatically reevaluated and the value of the auto-agent is updated. -Stuart Sierra

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Stuart Sierra
Hi Zak, I think this is a reasonable use of eval, since you're evaluating an expression that is generated at run-time. The alternatives are messy. -Stuart Sierra On Jan 23, 10:20 am, Zak Wilson zak.wil...@gmail.com wrote: I'm trying my hand at genetic programming. (Full post about why

Re: Clojure Web Libraries

2009-01-22 Thread Stuart Sierra
Hi Frank, I'd also recommend looking at Restlet http://www.restlet.org/ and the Java Servlets API. -Stuart Sierra On Jan 21, 4:39 pm, Frank ffai...@gmail.com wrote: Hi, I am interested in trying to use Clojure to develop web-based applications.  Can someone point me to any Clojure libraries

Re: Streams work

2009-01-22 Thread Stuart Sierra
they are emptied or go out of scope? -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

Re: what when (some identity maps) mean?

2009-01-22 Thread Stuart Sierra
Hi, It means that some of the maps can be nil, but at least one of them has to be non-nil. some requires a predicate, but since nil is logical false, we can just use identity. Here's the behavior: user (merge nil nil nil) nil user (merge {:a 1} nil {:b 2}) {:b 2, :a 1} -Stuart

Re: Calling Clojure from Java (again)

2009-01-22 Thread Stuart Sierra
a window and runs a process forever.   That's an unfortunate side effect of using Clojure as a scripting language like Perl or Python. Perhaps it would be more proper for the distributed file to define a function that will run the application. -Stuart Sierra

Re: doall vs. dorun

2009-01-20 Thread Stuart Sierra
-seq returns a lazy sequence, but you have to consume that sequence before with-open closes the file. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: repl-utils show

2009-01-19 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: Yet another html templating library

2009-01-19 Thread Stuart Sierra
Very interesting, Christophe. I've been playing with StringTemplate http://www.stringtemplate.org/ lately, but this separates design from code even further. Can it do conditionals, as in if this variable is true, includes this HTML element? -Stuart Sierra On Jan 19, 5:34 am, Christophe Grand

Re: is it type hint?

2009-01-19 Thread Stuart Sierra
of Java, that means you have to accept reflection-based method calls. -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: post on test-is and testing styles

2009-01-19 Thread Stuart Sierra
...))] (doseq [[x y] [ ...all your test values ...]] (my-predicate x y Peace, and happy testing. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: post on test-is and testing styles

2009-01-19 Thread Stuart Sierra
Thanks for the comments, Luke, glad we're thinking along the same lines! -Stuart Sierra On Jan 19, 1:24 pm, Luke Amdor luke.am...@gmail.com wrote: Thanks Stuart for the with-test macro. It will make my life much easier. I have been putting my tests in the :test metadata and running them

Re: #^ Reader Macro Issues was Re: function equivalents of macro characters

2009-01-19 Thread Stuart Sierra
! function, which works on anything: - clojure.core/alter-meta! ([iref f args]) Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects -Stuart Sierra

Re: Yet another html templating library

2009-01-19 Thread Stuart Sierra
On Jan 19, 2:18 pm, Christophe Grand christo...@cgrand.net wrote: In the only example, I use 'when-not to conditionally display an element. Got it, I didn't recognize at first what html/show was doing. -S --~--~-~--~~~---~--~~ You received this message because

Re: How to make function that derefs vars and refs?

2009-01-18 Thread Stuart Sierra
some complicated metaprogramming. -Stuart Sierra On Jan 18, 5:11 am, anand.prabhakar.patil anand.prabhakar.pa...@gmail.com wrote: Hi all, I'm new to Java, Lisp and Clojure, so please be patient. I'm trying to make a function that behaves as follows: (my-deref x) returns x if x is a var, or @x

post on test-is and testing styles

2009-01-18 Thread Stuart Sierra
or on the blog. -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: Changing State Pattern - Better Options?

2009-01-18 Thread Stuart Sierra
You might be able to write this using reduce, but I'm not sure exactly what you're trying to achieve here. Do you have a more concrete example? -S On Jan 18, 2:55 pm, DavidH davidh...@gmail.com wrote: In the code I'm writing, I seem to run into a certain pattern a lot. Often enough anyway

Re: Macros in interaction with Functions

2009-01-17 Thread Stuart Sierra
of. Some macros examine their arguments to decide what kind of code to produce, and some depend on lazy evaluation, like and or cond. These macros cannot simply be wrapped in functions. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you

Re: How to implement go to definition and find all references

2009-01-17 Thread Stuart Sierra
, not an interpreter. The compiler doesn't remember syntax. There is no running image in the Smalltalk sense. So the 100% perfect refactoring you have in mind may not be possible without reimplementing a large portion of Clojure itself. -Stuart Sierra

Re: Common backend project?

2009-01-17 Thread Stuart Sierra
(like show, source, javadoc) and just call them through SWANK. -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

Re: How to implement go to definition and find all references

2009-01-17 Thread Stuart Sierra
- clojure -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: Mysterious performance anomalies

2009-01-16 Thread Stuart Sierra
architecture. Java's just-in-time compiler generates optimized assembly for every architecture. It's not perfect, but steadily improving. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group

Re: test-is reporting problem

2009-01-16 Thread Stuart Sierra
Hello, fellow Stuarts, and others, Fixed now, SVN rev. 377. I've temporarily abandoned the fancier error reporting I had for functional predicates. I'm going to try to restore that without breaking anything else. :) Peace, love, and happy testing, -Stuart Sierra On Jan 16, 7:54 am, Stuart

Re: test-is reporting problem

2009-01-16 Thread Stuart Sierra
On Jan 16, 11:02 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: Fixed now, SVN rev. 377.  I've temporarily abandoned the fancier error reporting I had for functional predicates.  I'm going to try to restore that without breaking anything else. :) Ok, I figured out how to do it. Now

Re: test-is: set! *e

2009-01-15 Thread Stuart Sierra
Hi Allen, Good idea. But instead of setting *e I've modified report to print a brief stack trace for every error. See if that works. -Stuart Sierra On Jan 14, 11:30 pm, Allen Rohner aroh...@gmail.com wrote: Here's a trivial patch that I've found useful. After catching an uncaught exception

Re: How to reduce a list of booleans?

2009-01-15 Thread Stuart Sierra
simpler. -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: (newbie) running clojure app without repl

2009-01-15 Thread Stuart Sierra
There is a standalone compiler that runs without the REPL: clojure.lang.Compile. The best examples of using it are the Ant build.xml files for Clojure and clojure-contrib. If I have time tomorrow I'll try to post a more detailed how-to. -Stuart Sierra On Jan 15, 6:53 pm, linh nguyenlinh.m

Re: Macros in interaction with Functions

2009-01-15 Thread Stuart Sierra
of it this way -- macros only exist during compilation. Functions like apply get evaluated at run-time. A macro like and has no value at run-time, so you can't use it as an argument to a function. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message

Re: test-is reporting problem

2009-01-15 Thread Stuart Sierra
I was afraid that would happen. I'll fix it, probably tomorrow. -the other Stuart On Jan 15, 6:27 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The improved error reposting in test-is breaks some tests, e.g. from   the book: (deftest test-lazy-index-of-any-with-match   (is

Re: Utilities for clojure.contrib?

2009-01-13 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...@googlegroups.com

Re: Can't lookup java.lang.Long keys in a map using int literal

2009-01-13 Thread Stuart Sierra
map to ensure the keys are the correct type. -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: when performance matters

2009-01-12 Thread Stuart Sierra
to do is try it. -Stuart Sierra On Jan 12, 12:41 am, Mark P pierh...@gmail.com wrote: I have recently found out about Clojure and am rather impressed.  I am seriously considering whether Clojure is a viable language for use at work.  The main stumbling block would be if performance (both

Re: Why aren't lists callable?

2009-01-12 Thread Stuart Sierra
with map: (map #(* % 2) '(1 2 3)) ;;= (2 4 6) The second is a little more complicated, but still doable: (reduce (fn [m [k v]] (assoc m k (str v Mark))) {} {:greet hello :farewell goodbye}) ;;= {:farewell goodbye Mark, :greet hello Mark} -Stuart Sierra

Re: Why aren't lists callable?

2009-01-12 Thread Stuart Sierra
and maps are. There isn't a good way to conceptualize that as a function. I've probably just made this more confusing, but that's the best I could come up with. -Stuart Sierra On Jan 12, 6:51 pm, Ethan Herdrick herdr...@gmail.com wrote: Then why are sets callable?  Not that I'm complaining - I

Re: Newbie: Creating a macro that just calls a function but evaluates its arguments lazily

2009-01-11 Thread Stuart Sierra
some is already lazy, so you may not need to change anything at all. You might also be able to use filter, which will not do anything until you consume the output sequence. -Stuart Sierra On Jan 11, 4:44 pm, samppi rbysam...@gmail.com wrote: Let's say I have a function, alt: (defn alt

Re: Simple Data Structure Question

2009-01-10 Thread Stuart Sierra
Hi Patrick, Here's one way to do it: (defn new-person [name] (ref {:name name, :friends #{}})) (defn are-friends [a b] (dosync (commute a assoc :friends (conj (:friends @a) b)) (commute b assoc :friends (conj (:friends @b) a (def bill (new-person Bill)) (def bob (new-person

Re: (compile) also loads the lib ?

2009-01-09 Thread Stuart Sierra
My recommendation would be to not write scripts at all. Instead, write a -main function for your namespace and launch your application at the Java command line in the usual way. In general, I think distributed libraries should never have top-level side effects. -Stuart Sierra On Jan 9, 2:00 am

<    6   7   8   9   10   11   12   13   >