On Tue, Nov 17, 2009 at 2:31 PM, Chouser wrote:
> On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski
> wrote:
> >
> > I'm wondering what part is missing in "which provides a means for
> > nested contexts to communicate with code before it the call stack." at
> > http://clojure.org/vars? I think th
On Tue, Nov 17, 2009 at 3:59 PM, nchubrich wrote:
> How do you def a symbol that you make using (symbol)? I.E. if I try
> to do (def (symbol "x") 2) I get:
> java.lang.Exception: Second argument to def must be a Symbol. (And
> why does it say the \second argument must be a symbol?)
>
Special fo
On Tue, Nov 17, 2009 at 4:22 PM, Chouser wrote:
> On Tue, Nov 17, 2009 at 4:11 PM, John Harrop wrote:
> > On Tue, Nov 17, 2009 at 3:59 PM, nchubrich
> > wrote:
> >>
> >> How do you def a symbol that you make using (symbol)? I.E. if I try
>
On Tue, Nov 17, 2009 at 5:06 PM, Sean Devlin wrote:
> Heh. Learn something new every day.
>
> This also works
>
> (into {} (System/getProperties))
And I'd much prefer it. Passing a mutable Java map around to functions that
expect a map but assume it will never change out from under them creates
On Tue, Nov 17, 2009 at 6:24 PM, Richard Newman wrote:
> > I wonder if perhaps (into {} a-java-map) should work but no other
> > substitutions of a potentially-mutable map for a Clojure map.
>
> Baby, bathwater. Making a persistent map out of a Java map is
> expensive. Not everything that impleme
On Thu, Nov 19, 2009 at 4:31 AM, Lauri Pesonen wrote:
> (clojure.walk/macroexpand-all '(cond (even? 2) :foo (odd? 2) :bar :else
> :baz))
> (if (even? 2) :foo (if (odd? 2) :bar (if :else :baz nil)))
Eeeuw. Perhaps the cond macro should check if the last condition is
self-evaluating and, if it is
On Thu, Nov 19, 2009 at 1:23 PM, Sean Devlin wrote:
> Try clojure.contrib.seq-utils :)
>
> As a learning exercise, I'd recommend re-writing it to be lazy. Your
> version is eager because it uses loop. In order to make it lazy,
> you'd want to construct a lazy-seq. See the macro w/ the same name
On Thu, Nov 19, 2009 at 2:39 PM, Timothy McDowell wrote:
> unsubscribe
Interesting. Most mailing lists I subscribe to get one of these a week, or
even a day. This is the first missent unsubscribe the clojure list's had in
months.
--
You received this message because you are subscribed to the G
On Thu, Nov 19, 2009 at 7:00 PM, Sean Devlin wrote:
> That's why there are two separate functions do do what you suggest
>
> user=>(interleave [1 2 3 4] [1 2 3 4])
> (1 1 2 2 3 3 4 4)
>
> user=> (concat [1 2 3 4] [1 2 3 4])
> (1 2 3 4 1 2 3 4)
>
Poor choice of example. I think he meant even if he
On Thu, Nov 19, 2009 at 7:15 PM, Alex Osborne wrote:
> John Harrop wrote:
> > On Thu, Nov 19, 2009 at 7:00 PM, Sean Devlin > <mailto:francoisdev...@gmail.com>> wrote:
> >
> > That's why there are two separate functions do do what you suggest
> >
On Thu, Nov 19, 2009 at 7:51 PM, Alex Osborne wrote:
> John Harrop wrote:
> > This is just (sort (concat [1 2 3 4 5 6 7] [3 2 7])) though.
> >
> >
> > I think he also wants the original order of the first input coll to be
> > preserved, though. Sort woul
On Thu, Nov 19, 2009 at 9:17 PM, Mark Triggs wrote:
> A good example is:
>
> (take 10 (repeatedly #(rand-int 100)))
>
> to get a bunch of random integers. I actually quite like this idiom,
> even if there's a bit of ascii involved :)
>
Why not abstract it some, though?
(defn rand-seq [range]
On Fri, Nov 20, 2009 at 2:28 PM, Richard Newman wrote:
> > But I should be able to know, through class inspection, whether my
> > 'main' program depends on a class which uses, say, the clojure.zip
> > namespace, and decide whether or not to include it. Or so I am
> > wondering.
>
> There are impe
On Fri, Nov 20, 2009 at 5:16 PM, Raoul Duke wrote:
> > Try with a 1.6 JVM...
>
> wow. it actually got worse than when i was using 1.5. ... so much for
> hallowed write-once-run-the-same-anywhere-ish of the jvm, d'oh.
>
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (load-file "/tmp/test.clj")
> #'user/v
One place where interop needs improvement: imports.
This is ridiculous:
#
sandbox=>
#
sandbox=>
#
sandbox=>
#
sandbox=>
#
sandbox=>
I shouldn't have to play guessing games or keep reaching for reference
materials. We need at least two improvements here.
1: Improvements to the ns macro, such as
On Sat, Nov 21, 2009 at 8:30 PM, David Brown wrote:
> On Fri, Nov 20, 2009 at 06:37:18PM +, Jim Downing wrote:
>
> >I might have misunderstood, but isn't the problem the same as in Java;
> >you can't know from a static analysis which classes are going to be
> >loaded?
>
> Except that Clojure
On Sat, Nov 21, 2009 at 8:47 PM, David Brown wrote:
> On Fri, Nov 20, 2009 at 03:54:45PM -0800, Mike Hinchey wrote:
> >It's the . special form that makes the difference. In (. System
> >(getProperty)), the dot interprets System as a class and looks for a
> static
> >method (at read/compile time)
On Sat, Nov 21, 2009 at 8:57 PM, David Brown wrote:
> On Sat, Nov 21, 2009 at 08:42:26PM -0500, John Harrop wrote:
>
> >Are you talking about binding things like String.class to vars referenced
> by
> >symbols like String?
>
> Not just String.class, every single
On Sat, Nov 21, 2009 at 9:03 PM, Alex Osborne wrote:
> John Harrop wrote:
>
> > 1: Improvements to the ns macro, such as described in a previous thread.
> > Particularly I'd like to see
> >
> > (:import package class class class)
> >
> > work. Thi
On Sat, Nov 21, 2009 at 11:21 PM, David Brown wrote:
> On Sat, Nov 21, 2009 at 11:14:52PM -0500, John Harrop wrote:
>
> >1 second instead of 1/6 of a second. Yeah, like users will notice that
> >difference in startup times. :)
>
> I'm not actually complaining, but I
On Sat, Nov 21, 2009 at 11:43 PM, Alex Osborne wrote:
> John Harrop wrote:
> > On Sat, Nov 21, 2009 at 9:03 PM, Alex Osborne >
> > (:import package1 class class class) (:import package2 class class)
> >
> >
> > I am. Especially since the latter already works.
On Sun, Nov 22, 2009 at 6:05 AM, Michael Wood wrote:
> > You've got some kind of system problem confounding your results, I'll
> bet.
> > It got slower? One test actually hung?
> > My suspicion, of course, lies with the emacs environment you've just
> > confessed to using. Half the traffic on thi
On Sun, Nov 22, 2009 at 7:54 AM, Emeka wrote:
> John,
>
> You should have added that you code came from Programming Clojure.
>
It didn't. If it's the same as, or closely similar to, code from there, it's
entirely coincidental.
In Clojure there's usually several ways to do something, but often o
How is it pronounced anyway, at the start? LINE... or LANE...?
--
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 be patient with your
On Sun, Nov 22, 2009 at 12:55 PM, David Brown wrote:
> java.nio.channels.FileChannel contains some .write methods:
>
> [27] write : int (ByteBuffer)
> [28] write : int (ByteBuffer,long)
> [29] write : long (ByteBuffer[])
> [30] write : long (ByteBuffer[],int,int)
>
> I have an array of ByteBufers
Is there an explanation of monads out there that doesn't require the reader
to know Haskell to understand it? One that's generic to any FP-capable
language?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@g
On Sun, Nov 22, 2009 at 4:32 PM, samppi wrote:
> Does a function that does this:
> (vary coll :x fn-x, :y fn-y)
> ; Equivalent to (assoc coll :x (fn-x (:x coll)), :y (fn-y (:y
> coll)))
> exist in the core or contrib APIs?
>
> I'm surprised that I can't find any. It's a very natural extension o
On Sun, Nov 22, 2009 at 4:25 PM, Martin DeMello wrote:
> On Mon, Nov 23, 2009 at 2:40 AM, John Harrop wrote:
> > Is there an explanation of monads out there that doesn't require the
> reader
> > to know Haskell to understand it? One that's generic to any FP-capable
&g
On Mon, Nov 23, 2009 at 2:26 PM, Sean Devlin wrote:
> * Back to Multimethods *
>
> The power of the individual closures can be amplified when wrapped in
> a multimethod. Consider our String/Symbol/Keyword group.
>
> (defmulti visit-string (fn [& args] (second args))
>
> (defmethod visit-string cl
On Mon, Nov 23, 2009 at 4:34 PM, Sergey Didenko wrote:
> Hi,
>
> Andre, Danny's first approach is about "syncing" only on the root
> object, so that every piece of data is behind one deref:
>
> (def root (ref {:persons [ ... no other refs here... ]))
>
> This approach is simpler to code but can le
On Mon, Nov 23, 2009 at 8:35 PM, Phlex wrote:
>
> > i'd be interested to hear who has successfully used clojure in
> > production.
>
> Hello,
>
> 1- We have this license server, used to control the use of a
> professional software (this one written using delphi).
What are the ethics of using an
On Mon, Nov 23, 2009 at 9:47 PM, Richard Newman wrote:
> 1- We have this license server, used to control the use of a
>> professional software (this one written using delphi).
>
>
> What are the ethics of using an open source product like Clojure to
> implement DRM restrictions for some other pro
On Tue, Nov 24, 2009 at 1:04 AM, Meikel Brandmeyer wrote:
> Hi,
>
> On Nov 24, 6:06 am, John Harrop wrote:
>
> > Oh, I have no problem with making money by using open source software,
> when
> > it's done in the manner that companies like Red Hat do it. It
On Tue, Nov 24, 2009 at 6:01 AM, kony wrote:
> Hi,
>
> I found that resolve does not work correctly (I guess) when it is
> called from other thread than main:
>
> e.g.
>
> let define
>
> (def zz 123)
>
> and afterwords call:
>
> (.start (new Thread #(println (resolve 'zz
>
> for me it does no
On Wed, Nov 25, 2009 at 12:40 PM, Gabi wrote:
> Very interesting indeed. I am not sure I understand completely, but by
> intuition I presume that the recursive call actually creates a new
> heap allocated LazySeq (with the function definition inside) .
Not quite; it creates a Java object one me
On Thu, Nov 26, 2009 at 2:11 AM, Christophe Grand wrote:
> On Thu, Nov 26, 2009 at 8:05 AM, Robert Campbell wrote:
>
>> If you have this:
>>
>> user> (def f (future (Thread/sleep 2) :done))
>> #'user/f
>> user> @f ; this immediate deref blocks for 20 sec, finally returning
>> :block
>> :done
On Thu, Nov 26, 2009 at 4:37 AM, Chris Jenkins wrote:
>
> (defn flip-cell [b x y]
> (let [row (nth b y)
> cell (nth row x)
> new-cell (- 1 cell)
> new-row (assoc row x new-cell)]
> (assoc b y new-row)))
>
(defn flip-cell [b x y]
(update-in b [y x] #(- 1 %)))
:)
--
You receive
On Fri, Nov 27, 2009 at 8:45 AM, Stefan Kamphausen
wrote:
> > Why? Well because #^ attaches the metadata to the next read form.
> > What's the next read form? It's 'greet. But in fact 'greet is just
> > sugar for (quote greet). So we're actually affixing the metadata to a
> > list containing t
We're maintaining a large database of tagged images and had a need to
perform "fuzzy search" of the database. The existing search tool takes exact
queries only. So it was necessary to hack up a little tool to sit between
the query source and the engine and transform the query into a "fuzzy
query".
On Fri, Nov 27, 2009 at 12:46 PM, Richard Newman wrote:
> > Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo
> > it applies the metadata to foo first, then quotes it, resulting in
> > the same thing as (quote #^{meta} foo).
>
> Why introduce that special case, when you can sim
On Fri, Nov 27, 2009 at 1:23 PM, John Harrop wrote:
> On Fri, Nov 27, 2009 at 12:46 PM, Richard Newman wrote:
>
>> > Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo
>> > it applies the metadata to foo first, then quotes it, resulting in
>>
On Fri, Nov 27, 2009 at 7:48 PM, André Thieme
wrote:
> Let‘s say we have the functions A, B, C, D, E, F and G.
> A is calling B, B is calling C, C is calling D, and so on.
> Now a request R1 comes in, function A is called and this chain
> continues to,
> say, E.
> Now a reload happens. Some functi
One benefit of having a REPL: it makes regular expressions usable. So easy
to test and tweak your RE compared to the traditional compile/test/debug
cycle! I never even bothered with the java.util.regex package before Clojure
as it was too painful to use.
--
You received this message because you a
On Mon, Nov 30, 2009 at 12:22 AM, Joseph Smith wrote:
> What you want is to set the 'scale' of the BigDecimal.
>
> There doesn't seem to be a nice clojure macro for it, but this works:
>user=> (.setScale (reduce + [15.00M 15.01M 3.00M 3.01M]) 3)
>36.020M
>
That's what with-precision does
On Mon, Nov 30, 2009 at 7:07 AM, Joseph Smith wrote:
> setScale returns a new BigDecimal with a given scale, it does not change
> the original value.
>
I did not claim otherwise. The effect of with-precision is like an implicit
(.setScale foo) around every BigDecimal "foo", only more efficient s
On Mon, Nov 30, 2009 at 9:57 PM, Base wrote:
> Hi
>
> I have a database that has a table with complex java objects stored in
> a binary field.
>
> In java i would do something like:
>
> protected Object read(byte[] buf){
> Object obj = null;
> if (buf==null) return obj;
> try {
>
>
> So, Clojure programmers, am I wrong? Should I pass on Clojure in favor
> of another langauge? Or learn Common Lisp or Scheme first, then try my
> hand at Clojure? Am I mistaken for a different reason? Or perhaps
> there are some criteria I should consider before diving in?
>
I, for one, think
On Tue, Dec 1, 2009 at 11:10 AM, Ivan Sagalaev
wrote:
> Hello!
>
> I'm looking at Clojure for a couple of days, having watched two of
> Rich's video presentations. So I'm not yet familiar with Clojure's
> practical patterns but I can read the code :-).
>
> My question is how to model a non-blockin
On Tue, Dec 1, 2009 at 8:30 PM, Alex Osborne wrote:
> Clojure would be challenging language to start with, as (all?) the books
> and documentation are aimed at people who are already programmers. But
> if you like a challenge then perhaps that's even a good thing. If
> you're already a techie t
On Wed, Dec 2, 2009 at 5:43 PM, Don wrote:
> I am having difficulty approaching this problem. I'm not sure if it
> can be done in one swoop, or requires a few steps.
>
> I have 5 vectors as such:
>
> a [2 4 6 7]
> b [1 3 9 2]
> c [2 4 5 6]
> d [6 1 3 8]
> e [4 8 2 1]
>
> And I want to take the m
On Wed, Dec 2, 2009 at 7:59 PM, Don wrote:
> I still can't figure it out. If have this set.
>
> a [2 4 6 7]
> b [1 3 9 2]
> c [2 4 5 6]
> d [6 1 3 8]
> e [4 8 2 1]
>
> If I do (reduce min (map #(get % 0) (list a b c d e)))
>
> It grabs the min value from index 0 of the five vectors and retu
On Thu, Dec 3, 2009 at 10:41 AM, Stephen C. Gilardi wrote:
>
> On Dec 3, 2009, at 10:31 AM, Roman Roelofsen wrote:
>
> Are there any plans to add -$> to core or contrib?
>
> The rules on contrib are that the work must be original to the author. Even
> with Andrew's disclaimer that it be considered
On Thu, Dec 3, 2009 at 6:31 PM, Sergey Didenko wrote:
> Well, I'm not fluent with git yet. I'll create the github project, that can
> not be hard.
>
> In comparison with Prevayler, the persister does not block the reads,
> because it relies on Clojure STM. However it blocks the writes as
> Prevay
On Fri, Dec 4, 2009 at 4:41 AM, Lauri Pesonen wrote:
> 2009/12/2 Matthew Williams :
> > Using the Cocoa build of Emacs 23 (http://www.emacsformacosx.com) I
> > was able to get up and running extremely quickly with Technomancy's
> > swank-clojure install.
>
> This is very much off-topic, but...
>
On Fri, Dec 4, 2009 at 6:50 AM, Sergey Didenko wrote:
> Without the global transaction counter another problem arises.
>
> Suppose transaction B depends on ( results of ) transaction A. And they are
> executed from different threads. However they have the right order when
> executing the first tim
On Fri, Dec 4, 2009 at 6:51 AM, Meikel Brandmeyer wrote:
> Hi,
>
> On 4 Dez., 05:17, John Harrop wrote:
> > > The rules on contrib are that the work must be original to the author.
> Even
> > > with Andrew's disclaimer that it be considered public do
On Fri, Dec 4, 2009 at 8:57 AM, Miron Brezuleanu wrote:
> On Fri, Dec 4, 2009 at 2:33 PM, John Harrop wrote:
> > The problem is that it is an unreasonably high barrier to entry. There
> MUST
> > be an electronic-only way (and it must not require a cell phone, CC#,
>
On Fri, Dec 4, 2009 at 7:40 PM, Luc Préfontaine wrote:
> I was about to say that. There's no need for the id's to be "contiguous",
> only to get them to grow to preserve ordering.
> If you can find a way in your design to increment the atom each time a
> transaction is retried then you would
> p
On Fri, Dec 4, 2009 at 2:49 PM, Richard Newman wrote:
> > The problem is that it is an unreasonably high barrier to entry.
> > There MUST be an electronic-only way (and it must not require a cell
> > phone, CC#, &c.) if the full potential of this community is to be
> > unleashed upon clojure-cont
301 - 359 of 359 matches
Mail list logo