The call to (index) returns this vector
([0 \:] [1 \a] [2 \space] [3 \4] [4 \space] [5 \:] [6 \b] [7 \space] [8 \1]
[9 \space] [10 \:] [11 \c] [12 \space] [13 \3] [14 \space] [15 \:] [16 \d]
[17 \space] [18 \4])
And, 3 here is in the 13th position. Your (cond) in index function is
picking up the
Neat, so in your last solution are you trying to get rid of recur and solve
1 - (1/2)^x = time ?
On Thu, May 1, 2014 at 12:06 PM, Divyansh Prakash
divyanshprakas...@gmail.com wrote:
Hey!
I wrote a blog post discussing Thomson's Paradox, and simulated it in
Clojure-
Reduce is not lazy, correct? Will it ever return for drop-while to execute.
The problem here is not knowing how many iterations make up the sum, isnt?
On Thu, May 1, 2014 at 1:13 PM, James Reeves ja...@booleanknot.com wrote:
I'd suggest generating an intermediate seq with the summed time:
Another option is to explore concat
On Thu, Apr 24, 2014 at 8:46 AM, Jiacai Liu jiacai2...@gmail.com wrote:
Well,I understand you.
list only support front insert since it only takes O(1).
If insert in the back,it would require O(n) time.
Maybe clojure has its own reasons for having both
One point that makes me wonder is this: One of the points touted a lot is
the availability of immense ecosystem of Java. How does one balance
switching between immutable and mutable objects once Java objects are
brought into the mix. I have never used Java and Clojure together yet since
this
I would suggest 4clojure.com for the following reasons:
1. Problems are tuned towards learning idioms of Clojure
2. In many cases problems are tuned towards making you thinking
functionally.
3. Once you solve the problem, you get to compare it with some of the other
submitters. This point is
Sorry, I mixed up. I meant the second book to be 'Clojure in Action' :
http://manning.com/rathore/
On Fri, Jan 10, 2014 at 4:26 PM, Sean Corfield s...@corfield.org wrote:
On Jan 10, 2014, at 11:26 AM, Guru Devanla grd...@gmail.com wrote:
Another good book I thought you could get through
...@corfield.org wrote:
On Jan 11, 2014, at 10:05 AM, Guru Devanla grd...@gmail.com wrote:
Sorry, I mixed up. I meant the second book to be 'Clojure in Action' :
http://manning.com/rathore/
That book was already outdated when it was released (and many of the
examples won't work properly now
Hi Colin,
Clojure has a distinct function that does this. I may be missing some
context on what you what out of your new method that 'distinct' does not
provide. The distinct functions source code is a good reference.
Thanks
On Fri, Jan 10, 2014 at 6:59 AM, Colin Yates colin.ya...@gmail.com
Ok. My bad. Should not be reading and responding to such posts from the
phone. Somehow, I overlooked that part of the mail. I think as Alex stated,
a simple way of holding on to seen objects in the set and reducing the list
should be good.
On Fri, Jan 10, 2014 at 7:14 AM, Colin Yates
But, for the given problem this may not be directly helpful. This method
only returns the next unique name for the given list. The logic would have
to traverse the list n times for n elements (and some factor of no of
duplicates) to get the desired result, correct?
Thanks
Guru
On Fri, Jan 10,
Actually, you might have meant line 267?
On Fri, Jan 10, 2014 at 11:03 AM, Sean Corfield s...@corfield.org wrote:
java.jdbc does this for column names (in joins):
https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L257
Sean
On Jan 10, 2014, at 6:59
IMO there are 2 aspects of learning Clojure coming from an imperative
and/or OO background. One s the functional aspect of it and other the
idioms and the language itself. To learn the language a book like 'Clojure
Programming' would be a good start as others have suggested. It will help
you
Seconded on Error reporting.
I have been playing around with Clojure for sometime now and also completed
almost 150 of the 4clojure problems. What still scars me in terms of
incorporating Clojure as a language of choice in more complicated projects
I work on in my other life, is the error
Ok, wanted to be clear that I do support the Best part of language so far
has been the Language itself and community!
On Fri, Dec 27, 2013 at 5:48 PM, Guru Devanla grd...@gmail.com wrote:
Seconded on Error reporting.
I have been playing around with Clojure for sometime now and also
Hi Mark,
A few questions:
1. The point you raise regarding declaring case classes is inherent to the
typed nature of Scala, correct? Can that be pointed to as valid strength of
Clojure. Since, we are comparing static vs dynamic typing here.
2. I am not super familiar with Scale, but I am
Hi Dave,
I tried running your code. I did see a function being returned in both
cases. Am I doing something different?
Thanks
Guru
On Mon, Dec 9, 2013 at 12:09 PM, David Simmons shortlypor...@gmail.comwrote:
Hi
I have the following function:
(defn group
[ validators]
(fn [m]
Would this work?
(defn blah [coll]
(lazy-seq
(when-let [s (seq coll)]
(cons (first s) (blah (rest s
))
You can look up:
http://clojure.org/lazy
Thanks
Guru
On Thu, Dec 5, 2013 at 10:46 AM, David Simmons shortlypor...@gmail.comwrote:
Hi
I'd like to be able to
I like the way you use (partial list 'var).
On Thu, Nov 28, 2013 at 5:22 PM, juan.facorro juan.faco...@gmail.comwrote:
Hi Curtis,
The *apply* is unnecessary if you use *unquote-splice* (*~@*), also
instead of the *into* and *for* usage you could just *map* over the list
of symbols.
Hi,
This may not be the answer you are looking for. But, kooking at the example
you gave, you will need to execution environment of the function to
determine the binding of y. It could vary based on where it is invoked.
That is because, if the function call was wrapped inside a 'binding form
then
Hi Jamie,
Thats interesting. How do I not let the compiler not optimize away the fact
that y refers to the constant. When I run your program I have two constant
fields defined rather than 'y. Am I missing something.
Thanks
Guru
On Tue, Nov 26, 2013 at 6:16 AM, Jamie Brandon
The important caveat here is what do we label as data?. If we are okay
with just 'streams of bytes' that will make us understand and reason some
information about the function, then may be the bytecode itself could be
sufficient and could be considered to be data. But, I guess the original
Hi Andy,
Doesn't macroexpand do what you are looking for?
Thx
On Mon, Nov 25, 2013 at 4:55 AM, Andy Smith the4thamig...@googlemail.comwrote:
Hi,
I am new to clojure and I was wondering if there is a macro I can use to
fully expand all symbols and macros in a form, without performing the
Hi Andy,
Not sure what you need in terms of function calls being expanded. Can you
provide an example.
Here is an silly example, even though this kind of macro is not needed:
(def addone [v]
(+ v 1)
(defmacro testmacro [init]
(list 'addone init))
(macroexpand '(testmacro 10))
expands
Sean,
The case you listed is where let binding becomes important so as to not
perform duplicate evaluation. That is one place the utility of let stands
out along with its scope.
For example
Without let bindings:
(if (p (some-expression))
(f (some-expression))
(g (some-expression))
25 matches
Mail list logo