Re: Adding user-defined state to classes created with (proxy ...)

2009-01-04 Thread Chouser
It would also examine the the object > (presumably some Java object) at (akey amap) and proxy all the methods > it implements to it. Yeah, that is kind of sick. :-D --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: Slow nested subvecs (+ fix)

2009-01-04 Thread Chouser
00 10)] >(do (prn n) >(time (loop [n n s [-1]] > (if (zero? n) > s > (recur (dec n) (subvec (conj s n) 1))) Have you considered using clojure.lang.Persistent

Re: Questions & workaround regarding Clojure, true laziness, and nil-terminated sequences

2009-01-04 Thread Chouser
ally traverse trees, graphs, or other nested structures. But a function that returns a lazy seq over an mstk is pretty easy: (defn mstk-seq [mstk] (lazy-cons (single-peek mstk) (single-pop mstk))) I think you'll find this has the same laziness prof

Re: Functional Shuffle

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 10:17 PM, aria42 wrote: > > Hey all, I wanted to write a functional shuffle sequence (not lazy) > rather than call out to Java. See also: http://groups.google.com/group/clojure/browse_thread/thread/180842eb58c58370

Re: Suggestion: introduce (defn name attr-map? [params*] doc-string body) form.

2009-01-05 Thread Chouser
as been considered and rejected: http://clojure-log.n01se.net/date/2008-12-30.html#10:50 Thanks for your efforts, Christian! --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: why two list comprehensions are different?

2009-01-05 Thread Chouser
nd it's working as expected here. Thanks. I've created an issue for this: http://code.google.com/p/clojure/issues/detail?id=31 --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Updating website and Clojure files

2009-01-05 Thread Chouser
All the above are addressed with a patch at: http://code.google.com/p/clojure/issues/detail?id=32 --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: reduction

2009-01-05 Thread Chouser
On Mon, Jan 5, 2009 at 9:53 AM, Christophe Grand wrote: > > Chouser a écrit : >> On Dec 12 2008, 3:35 pm, Christophe Grand >> wrote: >> >>> I was sure it was a job for iterate: >>> >>> (defn reductions >>> "Returns a lazy seq

Re: yet another Clojure snake

2009-01-05 Thread Chouser
list, but is being used as a queue. Wouldn't a PersistentQueue be a better fit? --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: quote on side effects

2009-01-05 Thread Chouser
l-numbers) should yield A: a very warm computer http://clojure-log.n01se.net/date/2008-10-18.html#10:30a --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: why two list comprehensions are different?

2009-01-05 Thread Chouser
On Mon, Jan 5, 2009 at 7:03 PM, chris wrote: > > Perhaps the assert-args macro should be public? I chose to make it private for now to allow the API to morph as needed without making breaking changes. Of course Rich will be the final arbiter of all this. --C

Re: agent thread pool

2009-01-05 Thread Chouser
ction, because it can cause other agents to wait unnecessarily. In those cases you should instead use 'send-off'. Each agent will still only do one action at a time, but the soloExecutor pool will grow as needed to give a thread to every agent that has an action queued. --Chouser --~--

Re: (alength nil) => java.lang.IllegalArgumentException: More than one matching method found

2009-01-06 Thread Chouser
behavior? Please note I'm using revision 1195. > > user=> (alength nil) > java.lang.IllegalArgumentException: More than one matching method > found: alength (NO_SOURCE_FILE:146) The docs say "Works on arrays of all types" and last I checked, nil is not an array

Re: Clojure.contrib organization

2009-01-06 Thread Chouser
c", > like "src/clojure/contrib/mylib/tests.clj". Same for examples. I recently added code from Juergen Gmeiner.that put its tests in a clojure.contrib.test-contrib. Only after committing did I notice that other libs have their tests in clojure.contrib..tests. The the latter

Re: yet another Clojure snake

2009-01-06 Thread Chouser
nt habit is to use structmaps for anything that is similar to > a Java Bean where all the entries are used like attributes of a Java > object. The only benefit of structmaps (currently) is some space savings when you have lots of maps with the same keys but different values. This

Re: yet another Clojure snake

2009-01-06 Thread Chouser
On Tue, Jan 6, 2009 at 11:28 AM, Mark Volkmann wrote: > > On Tue, Jan 6, 2009 at 9:00 AM, Stuart Halloway > wrote: >> >> I like to use the *form* for names that might be dynamically rebound. >> Thinking about removing them from snake and apple as well. > > B

Re: terminating an app that uses agents

2009-01-06 Thread Chouser
eption (NO_SOURCE_FILE:0) > > I don't know why you're getting that error. The error is because you shut down the agent pools. Don't do that until you're done sending actions to agents! --Chouser --~--~-~--~~~---~--~~ You received this mess

Re: yet another Clojure snake

2009-01-06 Thread Chouser
nake", while the latter is specifically the one global snake support by the app. So perhaps the global could be called 'the-snake' or 'main-snake'. Another option would be to get rid of all global state. Perhaps like this: http://github.com/Chouser/programming-clojure

Cons.count overflows stack (with patch)

2009-01-06 Thread Chouser
imple loop as ASeq.count() does, at the cost of the efficient vector counting demonstrated above. If you have comments or questions, don't hesitate or I'll move this to the issues page! --Chouser --~--~-~--~~~---~--~~ You received this message because yo

Re: Clojure for configuration files like with emacs

2009-01-06 Thread Chouser
void having the configuration file effect the state of the main > running application. > > Does anyone have any tips of example code I could use. Something like this? (binding [*ns* (create-ns 'my-app.config)] (load-file "config.clj")) --Chouser --~--~-~--~~

Re: Cons.count overflows stack (with patch)

2009-01-07 Thread Chouser
On Wed, Jan 7, 2009 at 2:41 AM, Christian Vest Hansen wrote: > > On Wed, Jan 7, 2009 at 5:26 AM, Chouser wrote: >> Since I couldn't find any other class that uses this kind of >> recursion for count(), it may be impossible to build a seq that >> would still cause

Re: delimiter and capitalization for clojure-contrib?

2009-01-07 Thread Chouser
urse the namespace is "clojure.contrib" and the files are in "clojure/contrib" (in my case "clojure-contrib/src/clojure/contrib") I've never felt the urge to capitalize any of it. --Chouser --~--~-~--~~~---~--~~ You received this mes

Re: Adding user-defined state to classes created with (proxy ...)

2009-01-07 Thread Chouser
and changed it to: (ns my-ns.compiletest) (gen-interface :name my_ns.ICompileTest) (proxy [java.io.InputStream] []) ; Just to make sure proxy works by itself (line 3) (proxy [my_ns.ICompileTest] []) ; Line 4 Now compiling works fine for me: user=> (compile 

Re: yet another Clojure snake

2009-01-08 Thread Chouser
al part of the app that pushes the current state out to the GUI. Given that, it may be cleanest to keep the latest version of the game state in some clojure-managed mutable reference, like an agent or ref. --Chouser --~--~-~--~~~---~--~~ You received this message

Re: finding all vars starting with *

2009-01-08 Thread Chouser
) Not bad, though putting all the names into a single string before doing the regex is a bit startling. Here's another crack at it: (doseq [[sym vr] (mapcat ns-publics (all-ns)) :when (re-find #"^\*" (str sym))] (print-doc vr)) This highlights, though, how many

Re: sort behavior question

2009-01-09 Thread Chouser
76906 939962205 290318355 882332308) ; any of those are of course faster than converting each list to a vec ; each time it needs to be compared: user=> (time (last (sort-by vec test-grid))) "Elapsed time: 1744.390581 msecs" (2147476709 1551

Re: In core structure editor, anyone?

2009-01-09 Thread Chouser
On Fri, Jan 9, 2009 at 1:47 PM, Tom Ayerst wrote: > Time to bug Chouser again ;-) > > How's textjure coming along? Vaporware is such an ugly word. :-P I've definitely had less time to work on it over the last month or so than I was expecting. Discussion from yester

Re: REPL prints a ISeq as a list

2009-01-09 Thread Chouser
clojure.lang.PersistentTreeMap/create {:a 1, :b 2}) nil I hope that helps paint a more coherent picture of what's going on. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Reader metadata syntax vs. (with-meta ...)

2009-01-09 Thread Chouser
t; > > "not same" > > This behaviour is repeatable for empty lists, vectors and maps. Is > this intentional? Nonempty collections work as expected. Looks like a bug. I've created an issue to track it, thanks: http://code.google.com/p/clojure/issues/detail?id=39 --Chou

Re: Method overloading anomaly. (specifically ArrayList/remove)

2009-01-09 Thread Chouser
ethod is called. A type hint on the 'def' can work around the problem: user=> (def #^java.util.ArrayList temp (java.util.ArrayList. ["foo"])) #'user/temp user=> (.remove temp (int 0)) "foo" There's a new 'defhinted'

Re: Bug? overflow check in Numbers.minus

2009-01-09 Thread Chouser
UE Long/MIN_VALUE) > -1 > > The problem seems to be that negating MIN_VALUE yields MIN_VALUE > again, so it slips through the overflow check (see below). > > Shall I add that to the issues list? I think you should go ahead. I don't see how this could not be a bug. --Chouser

Re: Java interop question

2009-01-11 Thread Chouser
static final int FRAME_HEADER = 2; >public static final int FRAME_BODY = 3; > > [...skipped...] > } Probably com.rabbitmq.client.AMQP$PROTOCOL/PORT without parens since it's a field not a method. Documented at http://clojure.org/java_interop -- search for NestedClass --Chouser

Re: Why aren't lists callable?

2009-01-11 Thread Chouser
27;get' doesn't do anything useful for lists. So what should a list do when called? --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: How to create and read from a stream of random characters?

2009-01-11 Thread Chouser
there's not much value in passing in the size: (defn seq-of-rand-strings [maxlength] (repeatedly (fn [] (apply str (take (rand-int maxlength) (repeatedly #(char (+ (int \a) (rand-int 26) user=> (take 3 (seq-of-rand-strings 10)) ("kae" "xwuw

Re: YACS - Yes another one (Snake that is)

2009-01-12 Thread Chouser
ction commits before being sent. Maybe you didn't mean to say otherwise, but I thought I'd mention it in case. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Why aren't lists callable?

2009-01-12 Thread Chouser
'for' when I want destructuring and producing vectors. Combined with 'into' you get: (into {} (for [[k v] {:greet "hello" :farewell "goodbye"}] [k (str v " Mark")])) --Chouser --~--~-~--~~~---~--~~

Re: command-line in clojure.contrib suggestions

2009-01-12 Thread Chouser
size "The size of something" "99"]] (process-picture (load-picture picture) (Integer. size))) If each option provided a function, that function wouldn't have access to any of the other option values, right? How useful would that be? --Chouser --~--~-~--~-

Re: Utilities for clojure.contrib?

2009-01-12 Thread Chouser
te f x))) This one too. It raises a question, though -- how much functionality should a function provide to be worth making everyone who reads the code learn the new vocabulary? I've written each of these inline when I've needed them. Are

Re: Utilities for clojure.contrib?

2009-01-13 Thread Chouser
ed in > the core? Or 'random-element? 'chunk' is very similar to the built-in 'partition', the difference being how the last group is handled. user=> (partition 2 '[a b c d e]) ((a b) (c d)) --Chouser --~--~-~--~~~---~--~~

Re: Suggested functions for core: any? none?

2009-01-13 Thread Chouser
Returns false if (pred x) is logical true for any x in coll, else true. nil --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: How much Clojure source code is complicated?

2009-01-13 Thread Chouser
inning of the file, as the tools they need haven't been created yet. So don't take all of it as necessarily the best way to write your own Clojure code. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: Designing a Performance Vector Math library in Clojure.

2009-01-13 Thread Chouser
s: user=> (time (reduce (fn [n y] (+ n (:fred y))) 0 x)) "Elapsed time: 112.961087 msecs" 4950 user=> (time (reduce (fn [n y] (+ n (fred y))) 0 x)) "Elapsed time: 102.127459 msecs" 4950 --Chouser --~--~-~--~~~---~--~~ You received

Re: Designing a Performance Vector Math library in Clojure.

2009-01-13 Thread Chouser
array (but only if all the primitives are the same type, of course) or create a new Java class (gen-interface+proxy, gen-class, or .java). If the Java array is an option for you, you can build up an API of functions to keep things named and im

Re: Utilities for clojure.contrib?

2009-01-13 Thread Chouser
t to read than calls to the > utilities IMO. Yes, that's a mouthful. I'll need to study merge-reduce and map-map a bit more to see when to use them instead of merge, merge-with, and into. --Chouser --~--~-~--~~~---~--~~ You received this message be

Re: typo near http://clojure.org/API#toc248

2009-01-14 Thread Chouser
ut it makes the :state description harder to find. It's probably worth putting this sort of report directly on the issues page. It feels to me like this group's traffic just went up another notch, and this kind of report is even more likely to get

Re: Designing a Performance Vector Math library in Clojure.

2009-01-14 Thread Chouser
in the fast and hot mode (2500 MHz), resulting in almost unusably divergent timing results. So when I remember to do so, I switch the kernel to using the "performance" CPU frequency scaler before running my tests, and back to "on demand" afterwards. --Chouser --~--~-~-

Re: Observing namespace changes

2009-01-14 Thread Chouser
n" solution would be to have watchers on namespace objects, as there are now on agents, refs, etc, but I don't think that's planned. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clo

Re: Learning Clojure WikiBook

2009-01-14 Thread Chouser
ame as (concat (list myform)) ? I'm not sure that particular mechanism for explanation is simple enough to be worth including. > ``(~~a) Yikes, I've never tried to do that. > At this time, Clojure does not allow you to define your own reader > macros, but this may change in t

Re: detecting running as script

2009-01-14 Thread Chouser
on't know if it's elegant, and it's certainly not (yet) as powerful as many optparse tools in some other languages, but I've found it to be useful. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
es maps, reducing sets of values with same > key. Assumes nil value = not present. The first map entry must be a > real map, but the remaining arguments can be seqs of map entries/key- > value pairs." > ([f ] {}) > ([f m1 & maps] > (reduce (fn [m [k v]] >

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
2 3 ==> "Elapsed time: 11.290486 msecs" (seq? [1 2 3]))) ==> "Elapsed time: 19.127055 msecs" (seq [1 2 3]))) ==> "Elapsed time: 20.471575 msecs" --Chouser --~--~-~--~~~---~--~~ You received this message because

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Chouser
On Tue, Jan 13, 2009 at 8:08 PM, Perry Trolard wrote: > > Hi Chouser & list, > > I like clojure.contrib.command-line -- thanks for it! -- but I wanted > to be able to specify multiple forms for an option, e.g. --help, -h, > -?, etc. Here (in the Files section) > >

Re: when performance matters

2009-01-14 Thread Chouser
a primitive int, I'm not entirely sure -- might be worth trying (int (unchecked-add x line-offset)). Same thing on line-offset, not sure it's a primitive. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: question about understanding/exploring agents

2009-01-14 Thread Chouser
is that the fib is recursive, but I am not quite > sure why that would matter. On my 2-core laptop, I'm seeing loopmult pretty consistently taking between 2 and 2.7 times as long as loopfib, regardless of the number of threads. What exactly are you trying

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
> > user> (get *1 [1]) > true > > user> (hash-map '(1) true) > {(1) true} > > user> (get *1 [1]) > nil The different map types use different kinds of equality, and not all of these are even defined for all object types: Hash-maps use hash functions,

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
2) maps >> >> Maybe if it accepted the = function as a arg (like merge-with) it >> would be a little more general? > > Well, then which value would you use (if two values are my-equal but > not =)? Oh. Good point. I guess I was thinking it would be like '

Re: Why aren't lists callable?

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 10:23 PM, Ethan Herdrick wrote: > > By the way, I'd like to see map-map in the core. If you're referring to Jason Wolfe's suggested function, I think you may be pretty satisfied with (into {} (map ...)

Re: Accessing "this" in gen-class constructor

2009-01-15 Thread Chouser
#x27;ve posted a feature request: http://code.google.com/p/clojure/issues/detail?id=45 Now you can submit your CA, submit a patch, and nobody will ever have to suffer your pain again. :-) --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: command-line in clojure.contrib suggestions

2009-01-15 Thread Chouser
heavy than most people use, but I would > definitely find it useful. There are certainly plenty of features that could be added, and I'm not at all opposed to that. But every feature added to the API will be painful to change later as it might break

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Chouser
evelopment, when such issues probably could have been addressed more easily. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: command-line in clojure.contrib suggestions

2009-01-15 Thread Chouser
ecific as well. --Chouser --~--~-~--~~~---~--~~ 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+unsu

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Chouser
me, because in my startup .clj I had (left over from my old script): (when (= (System/getProperty "repl") "yes") (set! *print-length* 103) (use 'clojure.contrib.repl-utils)) Maybe I should always start a repl. Why did I think I somet

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Chouser
ven be in the classpath. Maybe a dynamically-bound variable *loading-main-script* that is bound to true when the main script is loaded and specifically re-bound to false during lib loading? --Chouser --~--~-~--~~~---~--~~ You received this message because you ar

Re: Macros in interaction with Functions

2009-01-16 Thread Chouser
is is possible without some sort of support for a > macro/function duality in core Clojure. Which is one way to describe what's provided by definline. It's marked experimental, has an unusual format and proviso's, but it's there get a blend of mac

Re: Changing State Pattern - Better Options?

2009-01-18 Thread Chouser
(map second (rest (reductions (fn [[state rtn] item] [(fn-state state item) (fn-item state item)]) [start-state nil] items I don't think that's a pattern I've ever needed, but th

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

2009-01-19 Thread Chouser
9 I don't know if the builtin 'deref' should do this -- it seems like it might make things more confusing rather then less. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: repl-utils show

2009-01-19 Thread Chouser
ent class names). At first I thought this was also good, but now I'm less sure. How often do you think you'd want to be able to search on a method's argument names, vs. how many unhelpful matches you'd get doing (show String "string") ? Opintions? --Chouser --~--~-

Re: function equivalents of macro characters

2009-01-19 Thread Chouser
ough 'with-meta' does something similar at runtime. > #' - var-quote 'var' That is, (var ensure) is the same as #'ensure > ` - syntax quote > ~@ - unquote splicing Those and ~ as well translate to a complex set of clojure data-structure-building functi

Re: is it type hint?

2009-01-19 Thread Chouser
ng.StringBuffer cannot be cast to java.lang.String (NO_SOURCE_FILE:0) If you remove the #^String type hint, you'll see that both String and StringBuffer work fine. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Newbie: What is the function of refer-clojure?

2009-01-20 Thread Chouser
version of 'slurp': (ns bar (:refer-clojure :exclude (slurp)) (:use [clojure.contrib.mmap :only (slurp)])) bar=> str # bar=> slurp # Note that 'ns' is meant to be used in .clj files, not at the REPL. --Chouser --~--~-~--~~~---~--~

Re: Utilities for clojure.contrib?

2009-01-20 Thread Chouser
On Tue, Jan 20, 2009 at 3:06 PM, Jason Wolfe wrote: > > Also, once again (Chouser?), is there anything I can do to help > implement the changes we've talked about? I'm sorry, Jason, I really thought I answered this the first time you asked. But I can't find any such an

Re: Utilities for clojure.contrib?

2009-01-20 Thread Chouser
tches aren't lost in archives. Hopefully Rich will clarify his wishes on this. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: repl-utils show

2009-01-20 Thread Chouser
On Mon, Jan 19, 2009 at 1:09 PM, Stuart Sierra wrote: > > On Jan 19, 11:59 am, Chouser wrote: >> But my version also only allows matches on the method name (not on >> return value or argument class names). At first I thought this was >> also good, but now I'm less

bug: bean returns the wrong kind of false

2009-01-20 Thread Chouser
"false") :true :false) ; correct :false user=> (Boolean. "false") ; don't do this, even though it looks ok false user=> (if (Boolean. "false") :true :false) ; see I told you :true So the only bug here is that

Re: clojure.contrib/repl-utils

2009-01-20 Thread Chouser
tributors to clojure.contrib. This is the best place to report any size bug or issue. Thanks for catching this one! It's fixed in clojure-contrib svn rev 399. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: repl-utils show

2009-01-21 Thread Chouser
On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote: > > The predicate takes a map based on the 'bean' of the member object, > but with :text and :member keys added. The :text is what will be > printed, the :member is the original member object itself. This means that (as of

Re: repl-utils show

2009-01-21 Thread Chouser
On Wed, Jan 21, 2009 at 9:52 AM, Mark Volkmann wrote: > > On Wed, Jan 21, 2009 at 7:44 AM, Chouser wrote: >> >> On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote: >>> >>> The predicate takes a map based on the 'bean' of the member object, >>&g

Re: repl-utils show

2009-01-21 Thread Chouser
pty : boolean () nil Oh, I wonder if that containsKey() method is public. It's marked as number [15], so: user=> (show (hash-map :a 1) 15) # Good, it *is* public... and so on... --Chouser --~--~-~--~~~---~--~~ You received this message because you are

Re: very simple javascript source using clojurescript?

2009-01-22 Thread Chouser
On Thu, Jan 22, 2009 at 12:33 AM, Allen Rohner wrote: > > Chouser, how usable is clojurescript to generate extremely simple > javascript calls? When creating HTML templates, I find myself using > ugly string interpolation to generate the .js. I would really love it > if I could do

Re: File, Line Number and Usage Info

2009-01-22 Thread Chouser
an n." [n coll] (when (and (pos? n) (seq coll)) (lazy-cons (first coll) (when (> n 1) (take (dec n) (rest coll)) nil --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Chouser
e handled in a way that would allow either Java lib to be used underneath. That way I would have no extra dependency now, or if I need Joda features could use that instead. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: why does this work?

2009-01-23 Thread Chouser
using any of the well-managed state mechanisms, such as 'ref', 'agent', 'atom', or Vars: http://clojure.org/concurrent_programming Also, CamelCase is discouraged unless required for interop with Java or something else. Clojure allows names like first-name and get-last-nam

Re: Any way we can get this in clojure-contrib?

2009-01-23 Thread Chouser
th Java. What Matt has posted strikes me as a good start down that road. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Joda Time library

2009-01-23 Thread Chouser
ttp://www.ociweb.com/mark/programming/JodaTime.pdf. That's a nice summary, thanks. Joda Time's API looks good enough it may not need any wrapper at all to work nicely in Clojure: Immutable types, low-ceremony interactions, etc. --Chouser --~--~-~--~~~---~--~-

Re: contains

2009-01-23 Thread Chouser
n the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a va

Re: contains

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 3:47 PM, Mark Volkmann wrote: > > (contains? "aeiou" letter) > > but that doesn't work either. user=> (some (set "aeiou") "dn'tndthsstinkngvwls") \i Or, if you must, user=> (cloju

Re: reader macros

2009-01-23 Thread Chouser
/browse/trunk/src/jvm/clojure/lang/LispReader.java?r=1202#64 Why does it matter if it's called a "reader macro" or not? --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojur

Re: contains

2009-01-23 Thread Chouser
hash-set and #{} expect several args, each of which becomes an item in the set: user=> (hash-set "aeiou") #{"aeiou"} --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojur

Re: contains

2009-01-23 Thread Chouser
uivering in fear when destructuring and regex join forces (defn pig-latin [word] (if-let [[_ a b] (re-find #"^([^aeiou])(.*)" word)] (str b a "ay") (str word "ay"))) --Chouser --~--~-~--~~~---~--~~ You received this message beca

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Chouser
On Fri, Jan 23, 2009 at 1:11 PM, Stephen C. Gilardi wrote: > > Please do enter it as an issue. I'd be interested in hearing from Chouser > before making the change. He added combinations to lazy-seqs. I did what now? My memory must be going. Here are some other implementation

Re: Regarding (.keySet {:a :map})

2009-01-23 Thread Chouser
On Sat, Jan 24, 2009 at 12:15 AM, e wrote: > > I wonder though if you can call instanceof from clojure to test Java types. user=> (instance? String "foo") true --Chouser --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: definline example?

2009-01-25 Thread Chouser
why the usages of it in core.clj don't cause errors at compile time, but they don't seem to work quite right. When used as a function, they work fine: user=> (apply ints [(into-array Integer/TYPE [1 2 3])]) # But when used as a macro, they return nil: user=> (ints (into-arr

Re: definline example?

2009-01-25 Thread Chouser
On Sun, Jan 25, 2009 at 8:01 AM, Chouser wrote: > On Sun, Jan 25, 2009 at 7:06 AM, Anand Patil > wrote: >> >> I'd like to repeat my request for an example of definline usage; I >> feel I've tried everything. > > I looked into this yesterday, and it seem

Re: scoping clojure.contrib.shell-out to a directory?

2009-01-25 Thread Chouser
te in the given directory. Thous would work like the :out, :in, and :bytes options already supported. > Chouser, would it be ok for me to make this change? What would you > suggest the macro be named? with-dir? chdir? Please do! :-) In naming both the Var and the macro, it may be worth some effo

Re: Ratio conversions to BigDecimal and floating point values.

2009-01-25 Thread Chouser
atches be attached to the email message rather than uploaded to the files area. Thanks, --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: zipper: missing root-loc

2009-01-25 Thread Chouser
second is nil) and attaches some metadata to that. So it's constant time and not very heavy. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: symbols, vars and namespaces

2009-01-27 Thread Chouser
', which is probably the most common case for symbols created by the reader: user=> (def expr (read (java.io.PushbackReader. (java.io.StringReader. "(+ 1 2)")))) user=> (first expr) + user=> (namespace (first expr)) nil Or even just: user=> (namespace 'zipmap) nil --Chouser --~--

Re: Thinking in Clojure - static fields?

2009-01-27 Thread Chouser
to a new object. It sounds to me like you don't plan to do this. On the other hand, Vars are created most often via 'defn', and generally their values never change and they are globally accessible. I think a Var would do very nicely in this case.

Re: Pretty printing a function's symbol

2009-01-27 Thread Chouser
er=> (defmacro form-and-val [x] `{:form '~x :val ~x}) user=> (form-and-val (+ 1 2)) {:form (+ 1 2), :val 3} No quote, no eval. Trying to avoid writing macros as much as possible is a great rule of thumb. But in this case I think it's justified. --Chouser --~--~-~--~~

Re: symbols, vars and namespaces

2009-01-27 Thread Chouser
On Tue, Jan 27, 2009 at 10:05 AM, Brian Doyle wrote: > > On Tue, Jan 27, 2009 at 7:43 AM, Chouser wrote: >> >> user=> (def expr (read (java.io.PushbackReader. (java.io.StringReader. >> "(+ 1 2)" >> user=> (first expr) >> + >> use

<    1   2   3   4   5   6   7   8   >