Re: Vector is only half associative?

2013-06-20 Thread Stephen Compall
(merge-with + [1 2 3] [4 5 6 7]) (merge-with + {6 7, 8 9} [1 2 3]) (merge-with + [1 2 3] {}) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: The order of lazy-seq

2013-05-01 Thread Stephen Compall
> All of the above program using lazy-seq As you have seen, lazy-seq is not a silver bullet. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Working with a huge graph - how can I make Clojure performant?

2013-03-27 Thread Stephen Compall
(G v)))] What happens if you do ^^^ *after* vvv? > (explored v) (recur vs explored lhalf rhalf (inc iter-cnt)) -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- -- You received this message because you are subscribed to the G

Re: defrecord and map

2013-03-24 Thread Stephen Compall
your-record)) -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: let-timed macro...any suggestions/corrections?

2013-03-23 Thread Stephen Compall
d evaluate to 12. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that

Re: Optimized code => now it's 4x slower. Why?

2013-03-01 Thread Stephen Compall
bugging such things: https://github.com/technomancy/leiningen/blob/2.0.0/sample.project.clj#L152 -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Clojure Performance For Expensive Algorithms

2013-02-20 Thread Stephen Compall
e's nature significantly. > (do >(assoc! curr (inc j) 0) >(recur (inc j) max-len))) Nor is it safe to discard the result of calling assoc!; see how assoc! is used in other online examples. -- Stephen Compall If anyone in th

Re: Looping and accumulation

2013-02-14 Thread Stephen Compall
that several library functions, like map, filter, iterate, and take-while are all lazy-friendly. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To p

Re: Why is there not much conversation on Spreadsheet like APIs in this group?

2013-02-03 Thread Stephen Compall
ed updates. Yes. Aside from the mutability issue, I also had other problems to which graphs were well-suited, but cells-ishs were not. For example, given the metadata to build a graph, "optimum conversion function" generalizes to "shortest path". -- Stephen Compall If any

Re: Why is there not much conversation on Spreadsheet like APIs in this group?

2013-02-03 Thread Stephen Compall
ation, I found more use for Jeff Straszheim's graph contrib library, now packaged with datalog, than the cells-ish stuff. This is probably because my Clojure style seeks immutable solutions, and cells-ishs don't fit in that category. -- Stephen Compall If anyone in the MSA is online, you

Re: Is there a better way to update a map atom?

2013-01-21 Thread Stephen Compall
On Jan 21, 2013 3:28 PM, "Jim - FooBar();" wrote: > ...or you can go all the way, skipping reset! completely: > > (swap! game-objects (fn [objects] (reduce-kv #(assoc % %2 (update-object %3)) {} objects) )) Which also has the benefit of being safe, unlike any reset!-based

Re: Associative extends Seqable?

2013-01-19 Thread Stephen Compall
ovides some hint about the name. Scala calls it PartialFunction, but I think this is somewhat confusing. Since constant functions can have their domains transformed forwards, unlike Kma, perhaps it would be useful to also encode that in a superinterface of wherever this hierarchy introduces Se

Re: Associative extends Seqable?

2013-01-19 Thread Stephen Compall
, assoc, and both valAts. Because such an isomorphism exists, the only reason to use this not-a-function is to exploit the extra operations and guarantees by law we get, and allowing domain transformation this way is a stronger claim than the ability to override particular mappings. -- Stephen Compall ^a

Re: Associative extends Seqable?

2013-01-18 Thread Stephen Compall
Once you're enumerating the domain, you can just apply the associative to produce the codomain, and thus, "enumerate the contents." The only way you can apply both transformations is if your domain is vacuous: that is, constant functions like yours are the only ones that permit do

Re: Associative extends Seqable?

2013-01-18 Thread Stephen Compall
of its superclasses are also implied. So I think inheriting Seqable is a positive statement of this law: anAssociative.entryAt(k) returning entry E, implies that (seq anAssociative) contains E. But I cannot be sure. Without this law, though, you are basically left with (pure) function. -- Step

Re: Better ways of documenting functions with type information?

2013-01-15 Thread Stephen Compall
ption (Seqable ...))) [1] https://github.com/frenchy64/typed-clojure/wiki -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Re: Unable to save the source file which loads repl

2013-01-06 Thread Stephen Compall
Windows works. You'll have to do something else, maybe wrap the repl call in (future ...), maybe put your actual app in a separate file. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you are subscribed to the Goo

Re: Extracting map values matching a pattern

2013-01-06 Thread Stephen Compall
u do not need to process them in numeric order, your suggested approach is fine. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: Issues with record and atom

2013-01-05 Thread Stephen Compall
rvices of the `clojure.zip' module, included with the standard distribution, to avoid mutable constructs and still be able to walk up and down your tree. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed t

Re: Are strings expensive for memory on the JVM?

2013-01-04 Thread Stephen Compall
On Jan 4, 2013 6:06 PM, "larry google groups" wrote: > (swap! recent-activity concat feed @recent-activity) This swap! replaces the value in recent-activity with (concat @recent-activity feed @recent-activity), approximately. -- Stephen Compall If anyone in the MSA i

Re: Different concrete type reported from macro

2013-01-03 Thread Stephen Compall
Yes. Last thread here: http://thread.gmane.org/gmane.comp.java.clojure.user/66294 ; search for further threads on the seq* trichotomy. tl;dr don't use 'list?'. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you a

Re: Will the JVM will always likely, remain the primary Clojure implementation ?

2012-12-28 Thread Stephen Compall
On Dec 27, 2012 11:55 PM, "Sukh Singh" wrote: > Is there any chance of clojure community abandoning the JVM as the > primary plaform in the future? Yes. Who knows what machines lurk in the hearts of programmers? -- Stephen Compall If anyone in the MSA is online, you s

Re: list* not returning a list

2012-12-26 Thread Stephen Compall
d be in favor of eliminating list?, really, in favor of seq?/sequential?/seqable?. > I think that this can be pretty confusing... Shouldn't it be fixed (at > least the docstring)? http://dev.clojure.org/jira/ -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is be

Re: ANN: stream-stream 0.2.0

2012-12-12 Thread Stephen Compall
here. clojure.core provides `line-seq', which, for line-buffered streams like stdin, would provide the functionality you want. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to t

Re: ANN: stream-stream 0.2.0

2012-12-12 Thread Stephen Compall
covers everyone :) > Would that make it easier to generate sha1's for example? > Is it useful for sound/video-like streams? In both cases, I imagine so. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this m

ANN: stream-stream 0.2.0

2012-12-12 Thread Stephen Compall
r-array-seq-sequence implements all of CharSequence. While this release doesn't have types, typed-clojure gave me the impetus to clean this up and finish the outstanding TODOs, so special thanks to Ambrose Bonnaire-Sergeant for providing that. -- Stephen Compall ^aCollection allSatisfy: [

Re: [ANN]First toy-project : CYASUS

2012-12-06 Thread Stephen Compall
is (string? (gen-key)) "Must return a string.") A comment that merely repeats the code may be elided. Unlike Python's unittest, c.test can tell you where the error is, the form that produced it, &c. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]":

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread Stephen Compall
e under GPL. If I am wrong, though, I encourage you to explore it further. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: An improvement to PersistentVector

2012-12-04 Thread Stephen Compall
dure for submitting patches. Shall I send it someone, put it somewhere? If you are willing, follow instructions on http://clojure.org/contributing. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you are subscribed to the Go

Re: Macro not being expanded?

2012-11-27 Thread Stephen Compall
oduce conses. Compare seq?, sequential?, and incubator's seqable? to find the predicate you want. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: Nested/inner classes with gen-class

2012-11-20 Thread Stephen Compall
ted Write it like (gen-class :name foo.bar$Baz) and you'll be fine. This works for me on Clojure 1.4. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google Groups "Clojur

Re: Java-to-Clojure source translation?

2012-11-04 Thread Stephen Compall
think the thesis of this thread is that, from the perspective of varying levels of Clojure expertise, such means would be more of a hindrance than a help in your goal. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message

Re: impossible to create classes for non-closure environment

2012-11-03 Thread Stephen Compall
~@(map (fn [name] `(defrecord ~name [~'x])) names))) ;; makes classes foo, bar, baz, qux, quux, all with the :x field. (defrefs foo bar baz qux quux) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to t

Re: monads

2012-10-27 Thread Stephen Compall
ume that Brian's original example involved such constraints, implicitly; i.e., a, b, c, d, e are metasyntactic variables in prose referring to values, not type variables. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this messag

Re: monads

2012-10-26 Thread Stephen Compall
n compose functions with different > input/output types without using monads. We can always write things out explicitly instead of exploiting existing abstractions. As for macros, the above samples use ordinary Haskell function calls. -- Stephen Compall "^aCollection allSatisfy: [:e

Re: what is the simplest user auth system possible?

2012-10-25 Thread Stephen Compall
MySql). > > I am curious what is the absolutely easiest way to do this? The easiest auth system to write is the one that's already written. https://github.com/cemerick/friend -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this

Re: clojure.java.jdbc create-table

2012-10-08 Thread Stephen Compall
hink can it be? It's difficult to tell without usable, minimized examples of succeeding and failing code. This exercise may even tell you what is wrong. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- You received this message because you are subscribed to

Re: CLR Reflection Laziness

2012-09-28 Thread Stephen Compall
the typical console user — is likely to be ill-served by a REPL exit. A counterexample demonstrates this: Squeak drops into a debugger on normal execution failure, as historical Smalltalk philosophy is that all computer users should learn programming. -- Stephen Compall Greetings from sunny A

Re: algo.monad state-m fetch-val bug and efficiency issue

2012-09-08 Thread Stephen Compall
bug, or a behavioral one? I would say the former; we are, after all, in a context in which functions have primacy over maps. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Goo

Re: algo.monad state-m fetch-val bug and efficiency issue

2012-09-08 Thread Stephen Compall
n using the abstractions. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- 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: redefining multimethods at the repl

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 17:31 -0500, Brian Marick wrote: > user=> (defmulti collide classify-colliding-things) If you're okay with a little handwaving, how about (defmulti collide #'classify-colliding-things) Now there is no need to rerun defmulti. -- Stephen Compall "^a

Re: using take-while with pred function that has state

2012-09-04 Thread Stephen Compall
On Tue, 2012-09-04 at 15:24 -0700, Sean Corfield wrote: > But that is a hypothetical, yes? You're not suggesting that take-while > actually does that, right? Right. As of right now. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than

Re: An instance of an abstract class in the repl?

2012-09-04 Thread Stephen Compall
er(cls.getResourceAsStream( > cls.getName.replaceFirst("^.*\\.", "") + ".class")) > } That assumes that this craziness doesn't get in the way. The trick here is that by putting your reify/deftype/proxy *once*, AOTing that, you'll reuse t

Re: using take-while with pred function that has state

2012-09-04 Thread Stephen Compall
yes. [1] I can, however, say that the documented invariant was added in Rich Hickey's a8307cc8, back in 2008. [2] Describing such examples would be rather esoteric for this thread, I feel. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than

Re: using take-while with pred function that has state

2012-09-03 Thread Stephen Compall
On Mon, 2012-09-03 at 01:12 -0700, Alan Malloy wrote: > (map #(do %2 %1) c1 c2) is a neat trick I hadn't seen in this context; > thanks for showing me! Perhaps you'd also like to advocate for the inclusion of `first-arg', which has several other uses, in core? :)

Re: using take-while with pred function that has state

2012-09-03 Thread Stephen Compall
(1 2 3 4))) 1nil There's some misinformation on the web about exactly how this works; I recommend reading the implementations of map, filter, and concat in core.clj to gain a better understanding of seq chunking. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better --

Re: Problems importing java classes

2012-09-02 Thread Stephen Compall
fore you try to reference it from gen-class. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: using take-while with pred function that has state

2012-09-02 Thread Stephen Compall
ons (partial apply merge) #{}), (take-while #(...)), (map #(do %2 %1) ss), last) Use of `atom' for this sort of thing is certainly an antipattern, so consider any alternative that suits you. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- Yo

Re: Possible to merge destructuring :or defaults with :as?

2012-09-02 Thread Stephen Compall
in a transparent way. When you want this, (let [{blah} (merge my-defaults kwargs)] -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: Lazily extract lines from large file

2012-08-22 Thread Stephen Compall
t. Omitting needless lets is a matter of style in this case. -- Stephen Compall If anyone in the MSA is online, you should watch this flythrough. -- 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: newbie question on namespaces and reference resources

2012-08-17 Thread Stephen Compall
his isn't universal, though. > 2. Is there a reference somewhere out there where I could consult these > kinds of questions? The best reference is existing project practice; there's a wealth of free software source code out there. -- Stephen Compall ^aCollection allSatisfy: [:

Re: Why is map not being lazy here?

2012-07-01 Thread Stephen Compall
(range 5 true Laziness and nondeterminism make an explosive mixture. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Need advice about XML parsing and exposing attributes to Java

2012-06-29 Thread Stephen Compall
ling to produce something less happy for Java, take a list of all possible whatevers and generate a big class with all of the getters. Maybe you could derive that list from an XML file of some kind. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received th

Re: IllegalStateException "I/O in transaction" in REPL

2012-06-14 Thread Stephen Compall
On Thu, 2012-06-14 at 13:33 -0700, dmirylenka wrote: > Could you please explain a bit more? > > I don't have any dosync in my code. Look through your backtrace for a call to clojure.lang.LockingTransaction.runInTransaction. Its caller is using dosync. -- Stephen Compal

Re: Using read-string and macros together

2012-06-14 Thread Stephen Compall
he IRC bots use. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new membe

Re: why String is not a collection (of Character)

2012-06-08 Thread Stephen Compall
On Jun 8, 2012 3:18 AM, "Cédric Pineau" wrote: > (defn seqable? More modernly, this function can be found in core.incubator. -- Stephen Compall Greetings from sunny Appleton! -- You received this message because you are subscribed to the Google Groups "Clojure" group

Re: hyphenate - imperative for

2012-06-06 Thread Stephen Compall
p you achieve greater simplicity, because they are strictly less powerful than their persistent counterparts. I suggest trying to find the simplest implementation, and worrying about efficiency once you have that. -- Stephen Compall Greetings from sunny Appleton! -- You received this me

Re: lazy-cat infinite realization on empty seq

2012-06-03 Thread Stephen Compall
ned termination condition. -- Stephen Compall Greetings from sunny Appleton! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please b

Re: maths, functions and solvers

2012-05-24 Thread Stephen Compall
though you perhaps have something else in mind. The real trouble is discriminating between bound and free vars. -- Stephen Compall Greetings from sunny Appleton! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: code as data vs. code injection vulnerability

2012-05-09 Thread Stephen Compall
lt to use just when you need it. -- Stephen Compall Greetings from sunny Appleton! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - pl

Re: Update an item from a list of maps in STM transaction

2012-04-02 Thread Stephen Compall
list of maps, you can't do that. > I tried using one FUTURE for a REF but is not working. Not sure what this means. Futures are IDerefs... -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Goog

Re: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-30 Thread Stephen Compall
e dance. It is worth considering that even for some uncounted sequences, the cost of a second traversal for "count" may be less than the bookkeeping cost of keeping a count as you traverse once. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You re

Re: into applied to transient vectors undocumented?

2012-03-22 Thread Stephen Compall
on that assoc and conj don't work on transients. Idempotence [interpreted as identity over transients] would be even worse; it would mean that 'into' is not a pure function. reduce conj! is a decent replacement. -- Stephen Compall Greetings from sunny Appleton! -- You receiv

Re: Returning Success

2012-03-20 Thread Stephen Compall
in C#. How F# treats those parameters is instructional: it converts any method using them into a method that simply returns the extra results in a tuple with the primary return value. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message

Re: Need opinions on arglists with optional arguments

2012-03-11 Thread Stephen Compall
heory that arglists are meant for humans, who can tell whether a boolean or optional arg is probably meant from context, and not autocompleters. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Gr

Re: Next vs. rest (and reduce)

2012-02-25 Thread Stephen Compall
d the same recur call be done using rest? Yes. > What is more idiomatic? Use `next' when you are definitely about to force it with `seq', `empty?', or something anyway, `rest' otherwise. `reduce' qualifies for the former. -- Stephen Compall ^aCollection allSatisfy

Re: clojure.data diff question

2012-01-13 Thread Stephen Compall
vectors. > In other words, diffing is key-sensitive, and seqs have keys 0, 1, ... Compare: user=> (diff ["a" "b" "c"] ['q 'q "c" "d"]) [["a" "b"] [q q nil "d"] [nil nil "c"]] (With nils becaus

Re: Help! Migrating to 1.3.0

2012-01-13 Thread Stephen Compall
re+Did+Clojure.Contrib+Go . In the selected example, duck-streams was replaced with the included clojure.java.io in Clojure 1.2. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google

Re: AoT Compilation fails

2012-01-08 Thread Stephen Compall
7;t tell you that AOT works in some context, because that SLIME function is implemented as a regular load on swank-clojure's side. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups &q

Re: Do you use Monads in your real clojure applications

2012-01-02 Thread Stephen Compall
n cleaner with the reader monad; https://github.com/straszheimjeffrey/The-Kiln will, I think, be a good use case for the reader monad when it's ready. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subsc

Re: Prefix tree creation in clojure

2012-01-02 Thread Stephen Compall
ot `not-empty'. See core.clj: (defn empty? "Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))" ...and several past discussions on this list not otherwise relevant to this thread. -- Stephen Compall ^aCollecti

Re: Prefix tree creation in clojure

2012-01-01 Thread Stephen Compall
n 1.3? There's one frequently-referenced page about the numerics > changes, but that's obviously not the full extent of 1.3's changes. http://dev.clojure.org/display/design/defrecord+improvements The mostly complete master list is changes.txt or changes.md in the source. -- Stephen Com

Re: Prefix tree creation in clojure

2012-01-01 Thread Stephen Compall
pty strings. > 63: (assoc node :edges (apply assoc (.edges node) (edge-entry label > child))) :edges is better than .edges here. Accordingly, the builtin `update-in' can simplify this. > 70: (Node. (conj (.strings node) string) edges))) It remains to be seen, but it see

Re: clj-http - how to use cookies in subsequent request

2012-01-01 Thread Stephen Compall
faultHttpClient from Apache httpcomponents-client can hold on to a stateful cookie jar for multiple requests. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

ANN: stream-stream 0.1.0

2011-12-18 Thread Stephen Compall
). -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please

Re: Error converting an example written in C++, TCL, python to clojure

2011-12-18 Thread Stephen Compall
isn't in java.lang, so you won't be able to refer to either of them without more stuff around this. Same with `volume'. > (-> (.GetActiveCamera) (.SetFocalPoint (.GetCenter volume 0 1 > 2))) And why so many args to GetCenter? -- Stephen Compall ^aCollect

Re: defrecord based on runtime metadata?

2011-12-18 Thread Stephen Compall
aluated when compiling, not the one evaluated when loading the compiled files later. In short, my-stuff should have deterministic, repeatable results, and should therefore only rely on deterministic features of (hey you!), e.g. gensyms will break. -- Stephen Compall ^aCollection allSatisfy: [:e

Re: lazy-seq and recursion.

2011-12-17 Thread Stephen Compall
resents (14 21 28 35), separating ;; lazy seqs from *both* odd and even streams ) (lazy-seq (prn "and this lazy seq has no first element to speak of") nil) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are su

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Stephen Compall
tely to yield (1 . more). It is the same problem with repeatedly concatting to the end, and with left-fold in a top-down evaluation scheme like Haskell: you can run out of stack if you must travel deep to get to the first element. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Stephen Compall
s as desired: > > (conr (conr (conr '( 1 2 3) 4) 6) 7) Though you should note that, despite the `lazy-seq' wrapper around the body, as soon as you force the outermost seq, you're forcing all the way down. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is

Re: multiple return values

2011-12-13 Thread Stephen Compall
't count that among them. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: Lazy-seq of a binary file

2011-12-12 Thread Stephen Compall
On Mon, 2011-12-12 at 20:03 -0800, Simone Mosciatti wrote: > Any suggest of how fix that ? In general, avoid loop. Specifically, try using letfn or (fn SOME-NAME-HERE [args...] ...) as your recursion target. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is bet

Re: multiple return values

2011-12-12 Thread Stephen Compall
two-return-values [...] (let [retval ...] (.put asides retval extra-data) retval)) (let [x (function-with-two-return-values ...)] (prn x) (prn (.get asides x))) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because yo

Re: Lazy-seq of a binary file

2011-12-12 Thread Stephen Compall
yields an infinite sequence. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new me

Re: Lazy-seq of a binary file

2011-12-11 Thread Stephen Compall
yte reading can be accomplished by writing a single iterate, a single take-while, and a single .read call. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Stephen Compall
On Wed, 2011-12-07 at 13:41 +0200, Matteo Moci wrote: > lein pom > > maybe setting up a fake simple lein project > you can watch how the generated pom is different from yours. Unfortunately, that pom is too fake to be useful as a comparison tool. -- Stephen Compall ^aCollectio

Re: let-else macro

2011-12-07 Thread Stephen Compall
> levels probably isn't near the top of the "to macro or not to macro?" > checklist. And may be anyway further generalized: (defmacro <<- [& forms] `(->> ~@(reverse forms))) (<<- (let [x (foo) y (bar)]) (when y) (let [ ]) (do ...

Re: on lisp and scheme macros

2011-12-06 Thread Stephen Compall
defmacro itself can be defined as a simple syntax-case macro. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Ending or closing malformed line in REPL

2011-12-05 Thread Stephen Compall
On Mon, 2011-12-05 at 09:51 -0800, jlhouchin wrote: > When I entered the closing " and then closing > paren. I was fine. You may also try backspace; unusually for a REPL, that works. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received t

Re: How would you model this data?

2011-12-03 Thread Stephen Compall
ponent (as your nested-maps example does), or add another map. One or the other is faster depending on how many values you have. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clo

Re: repl dodges ns :use :only ?

2011-11-19 Thread Stephen Compall
confines of an ns form; it implies the creation of another namespace (besides the one you are creating!) containing only bar, and aliasing that. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Grou

Re: Creating a var, functions from a macro

2011-11-19 Thread Stephen Compall
this pattern in defmacro fn in clojure/core.clj. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that pos

Re: Leiningen local dependencies?

2011-11-19 Thread Stephen Compall
path directories for a Leiningen project. It's best to get Leiningen to compile your Java sources for you. The :java-source-path and :javac-options project.clj settings will help here. If that is not feasible, try including the root of the class files in the :extra-classpath-dirs project.clj op

Re: Why no anonymous record types, or (defstruct, create-struct) vs (defrecord, ???)

2011-11-19 Thread Stephen Compall
eates a Java class, normally stuck in memory forever unless you mess with the GC settings. I can't remember the details, but each eval might make a class, too, depending on its complexity. Offset the savings you get with unboxed representations by these costs when evaluating records as your so

Re: Which autodoc dep for clojure 1.3 (and advice on how to solve such questions generally)

2011-11-07 Thread Stephen Compall
. This is perfectly workable, if you are careful. Liberal application of :exclusions [org.clojure/clojure] is advised. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: A question on deftest- macro.

2011-11-07 Thread Stephen Compall
test, only whether it's exported from the namespace. user> (doc deftest-) - clojure.test/deftest- ([name & body]) Macro Like deftest but creates a private var. nil user> (deftest- abc (is 42)) #'user/abc user> (meta #'abc) {, :priv

Re: Any reason why slingshot hasn't been updated to support 1.3

2011-10-30 Thread Stephen Compall
with Clojure 1.3; in what sense is 1.3 support "held off"? -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- 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: updating some values in map

2011-10-22 Thread Stephen Compall
that other map can fall away: (defn apply-map-fn [m f & ks] (into m (map (juxt identity (comp f m)) ks))) Perhaps not what you were looking for, but hope this helps anyway. More broadly, you might also want to think about what it means if one of ks isn't in m. -- Stephen Compall

Re: Clojure jar files.

2011-10-21 Thread Stephen Compall
, rather than reinventing that part of Leiningen. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- 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 N

Re: when quotes and when syntax-quotes?

2011-10-17 Thread Stephen Compall
-eval '{a (+), b (1 2)} '(concat a b)) to see the difference. (Hint: it should yield (+ 1 2), literally.) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group.

  1   2   >