On Tue, Oct 27, 2009 at 2:33 PM, Emeka wrote:
> John,
>
> That is why I asked that question because I figured out that the problem
> has nothing to do with Vector but with #() read macro. I wanted to correct
> the impression that the problem was from Vector.
That was correct. I just wanted to a
Jeff Brown wrote:
> I can invoke a function using Java code that looks something like this...
>
> Reader reader = new FileReader("clj/demo.clj");
> Compiler.load(reader);
> Var var = RT.var("demo", "add_numbers");
> Object result = var.invoke(4, 7);
> System.out.println("Result: " + result);
>
If I have something like this...
(ns demo)
(defn add_numbers ([x] x)
([x & rest-args] (reduce + (cons x rest-args
(defmacro silly_adder [sum]
(let [addend# (for [i (range sum)] 1)]
`(add_numbers ~...@addend#)))
(defmacro even_sillier_adder [sum]
`(silly_adder ~(+ sum 5)))
I
The docs could use clarification, but it looks like take-nth is doing
what's advertised.
Is there ever a case (I can't think of one) where a programmer really
wants to feed this function a non-positive n? That is, should take-nth
crap out if (< n 1)?
--josh
On Oct 27, 5:26 pm, Timothy Pratley w
Oh that is confusing!
nth indexes from 0 where-as take-nth indexes from 1.
The doc string could be considered misleading, as it says that take-
nth makes a sequence of "nth" items, but clearly it does not:
clojure.core/take-nth
([n coll])
Returns a lazy seq of every nth item in coll.
user=> (ta
Hi,
Started tinkering with Clojure, and wonderring why (take-nth 0 (range
10)) returns an infinite sequence .. Is this really the expected
behaviour?
;
;code bellow is public domain
;
(defn take-nth-proposal
"Returns a lazy seq of every nth item in coll . Or nil if n less
than 1."
[n coll]
setLineNumber should not skip lines (at least officially - see
http://java.sun.com/j2se/1.4.2/docs/api/java/io/LineNumberReader.html).
If every line is of fixed size, in Java you could use a RandomAccessFile.
On Sun, Oct 25, 2009 at 3:30 AM, tommy c wrote:
>
> I have a huge file(>900MB) that I
John,
That is why I asked that question because I figured out that the problem has
nothing to do with Vector but with #() read macro. I wanted to correct the
impression that the problem was from Vector.
Regards,
Emeka
--~--~-~--~~~---~--~~
You received this messag
>
> (with-open [#^Reader r (reader "FILE")]
> (with-open [lr (java.io.LineNumberReader. r)]
> (.setLineNumber lr 5)
> ;; Your code here.
> )))
>
> Can't the below work?
(with-open [#^Reader r (reader "FILE")][lr (java.io.LineNumberReader. r)]
(
Regards,
Emeka
--~--~
On Tue, Oct 27, 2009 at 2:17 PM, Emeka wrote:
> John,
> On Tue, Oct 27, 2009 at 6:10 PM, John Harrop wrote:
>
>> On Tue, Oct 27, 2009 at 1:39 PM, Emeka wrote:
>>
>>> On Sun, Oct 25, 2009 at 4:57 PM, MarkSwanson
>>> wrote:
>>>
Hello,
Someone recently posed the question: (why
John,
On Tue, Oct 27, 2009 at 6:10 PM, John Harrop wrote:
> On Tue, Oct 27, 2009 at 1:39 PM, Emeka wrote:
>
>> On Sun, Oct 25, 2009 at 4:57 PM, MarkSwanson
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> Someone recently posed the question: (why doesn't this work)
>>> (into {} (map #([% (* % %)]) [1 2 3 4
On Tue, Oct 27, 2009 at 1:39 PM, Emeka wrote:
> On Sun, Oct 25, 2009 at 4:57 PM, MarkSwanson wrote:
>
>>
>> Hello,
>>
>> Someone recently posed the question: (why doesn't this work)
>> (into {} (map #([% (* % %)]) [1 2 3 4]))
>>
>>
> Is this actually a Vector problem or the limitation of the anon
Or you can stick (sku, quantity) pairs in a cookie. However,
personally I prefer sessions.
On Oct 27, 9:54 am, Robert Campbell wrote:
> Wow, thank you very much. That's definitely a lot simpler. I'm going
> to try reimplementing it via your suggestions and see how it goes.
>
> I like your idea
On Sun, Oct 25, 2009 at 4:57 PM, MarkSwanson wrote:
>
> Hello,
>
> Someone recently posed the question: (why doesn't this work)
> (into {} (map #([% (* % %)]) [1 2 3 4]))
>
>
Is this actually a Vector problem or the limitation of the anonymous
function?
Regards,
Emeka
> (reference:
> http://gro
Good question.
Let's see. Now, nested vectors ... I don't like them too much for
these things. Why? Because they're just that: nested vectors. They're
not truly multidimensional vectors, and the more I think about them,
the more they really suck from that point of view. For instance, first
of all
John Resig (the guy behind jQuery) thinks so:
http://ejohn.org/blog/google-groups-is-dead/
I've noticed some amount of spam creeping into this list ... the
question is how much effort is being put into moderating out that
spam. John notes that GG has some gaping holes in it ... very easy to
spo
On 27.10.2009, at 17:46, Rock wrote:
> What if we created a structmap (a sort of class), where we have a
> flattened out one-dimensional clojure vector containing all the data
> of our potentially multidimensional (rank n) array, together with its
> dimensions and possibly other info? I believe t
But then again ...
Thinking this over, one idea that comes to mind:
What if we created a structmap (a sort of class), where we have a
flattened out one-dimensional clojure vector containing all the data
of our potentially multidimensional (rank n) array, together with its
dimensions and possibly
On Oct 26, 5:18 pm, samppi wrote:
> Well, that's how the key itself is useful. What I'm wondering is why
> it is useful for the key to be passed to the watching function every
> time it's called.
I suppose you could use the same watching function with different keys
for different behavior.
-SS
Thx. That should work:)
--~--~-~--~~~---~--~~
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
Wow, thank you very much. That's definitely a lot simpler. I'm going
to try reimplementing it via your suggestions and see how it goes.
I like your idea about not maintaining cart state on the server,
because it would make my functions easier to test and debug (no need
to setup & teardown a fake
On Tue, Oct 27, 2009 at 1:01 AM, Cristian wrote:
>
> I tried overloading -init, but I get the same problem.
>
> java.lang.ClassFormatError: Duplicate field name&signature in class
> file test/gui/button (repl-1:2)
>
> e.g.:
>
> (ns test.gui.button
> (:gen-class
> :extends javax.swing.JButton
>
Hi,
Am 27.10.2009 um 04:18 schrieb Gorsal:
> I guess this is a very similar error to the one above mentioned. I
> guess i sort of nested ns again. Do you have any suggestions for
> preventing name clashing of the functions?
Use gensym:
(defmacro new-handler-class
[classname-sym event & body]
On Oct 27, 12:24 am, Meikel Brandmeyer wrote:
> Hi,
>
> Am 26.10.2009 um 18:55 schrieb Abhijith:
>
> > (defn foobar [arr--of-arr]
> > (let [ acc (transient {}) ]
> > (doseq [ [i e] (indexed arr-of-arr) word e ]
> > (assoc! acc word (if-let [v (acc word)] (conj v i) [i])))
> > (persist
I tried overloading -init, but I get the same problem.
java.lang.ClassFormatError: Duplicate field name&signature in class
file test/gui/button (repl-1:2)
e.g.:
(ns test.gui.button
(:gen-class
:extends javax.swing.JButton
:constructors {[] [String]}
:init init))
(defn -init
([] [[
> You nailed it. It's not about destructuring, it's using doseq to
> "bash in place" a transient collection. You won't get correct
> results unless you take the return value of 'assoc!' as your new
> collection. Even though most of the time it will return the same
> transient you passed in with
On Mon, Oct 26, 2009 at 6:09 PM, kyle smith wrote:
> Rather than the number of nodes in a tree, I think a better metric
> would be the number of edges in a graph. Variables that are
> referenced on many different lines should get double counted. I think
> this would explain why imperative spagh
On Mon, Oct 26, 2009 at 11:18 PM, Gorsal wrote:
> Again, there is compiled something like ns_name__154__auto__
> $init__162.class. I really wonder what these dollar signs signify!
Nested classes are indicated that way at the JVM level.
--~--~-~--~~~---~--~~
You
Hi Robert
On Oct 27, 9:48 pm, Robert Campbell wrote:
> Hey guys, I'm looking for _any_ feedback/thoughts on this Clojure code
> I wrote. I just feel like the entire thing is way too complex, but I'm
> not sure about how to simplify it. I wanted to try something "real
> world" so I made a simple
Hey guys, I'm looking for _any_ feedback/thoughts on this Clojure code
I wrote. I just feel like the entire thing is way too complex, but I'm
not sure about how to simplify it. I wanted to try something "real
world" so I made a simple shopping cart ref to put in a session:
(defstruct cart :line-
30 matches
Mail list logo