On Wed, Oct 28, 2009 at 10:15 PM, Alex Osborne wrote:
>
> Tiago Antão wrote:
> > Again, the point here is to be able to construct method names (full
> > call signatures, really) on runtime.
> >
> > I am lost. As in newbie clueless :(
>
> As others have suggested you need to use either Java's refl
On Wed, Oct 28, 2009 at 9:35 PM, Alex Osborne wrote:
> John Harrop wrote:
> > Probably the seq .hashCode should consider only the first N elements
> > for some maximum N and if two longer (or even infinite) sequences
> > collide so be it.
>
> I strongly disagree. Choosing some arbitrary magic cu
youngblood.carl wrote:
> When I try and call createFile from clojure:
> (.createFile path)
>
> I get an exception that there is no field named createFile.
If I remember correctly variable argument Java methods, which is what
that "..." syntax means:
abstract Path createFile(FileAttribute...
David Powell wrote:
>
>> Under Linux I had to fix the paths in liverepl.sh to include the
>> build folder:
>>
>> java -cp "$LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar"
>> net.djpowell.liverepl.client.Main "$CLOJURE_JAR"
>> "$LIVEREPL_HOME/build/liverepl-agent.jar"
>> "$LIVEREPL_HOME/build/
Also you can substitute #^"[C" with the more legible #^chars.
On Oct 28, 7:27 pm, Alex Osborne wrote:
> Chick Corea wrote:
> > What is wrong with this code? I want to instantiate a Java String
> > from a Java character-array.
> > But I want it to be fast, hence the need to cast per the "warn o
Chick Corea wrote:
> What is wrong with this code? I want to instantiate a Java String
> from a Java character-array.
> But I want it to be fast, hence the need to cast per the "warn on
> reflection" message.
>
> user=> (set! *warn-on-reflection* true)
> true
> user=> (new String #^
Tiago Antão wrote:
> Again, the point here is to be able to construct method names (full
> call signatures, really) on runtime.
>
> I am lost. As in newbie clueless :(
As others have suggested you need to use either Java's reflection or
Clojure's eval. Here's some examples:
Using reflection:
John Harrop wrote:
> Probably the seq .hashCode should consider only the first N elements
> for some maximum N and if two longer (or even infinite) sequences
> collide so be it.
I strongly disagree. Choosing some arbitrary magic cutoff point just
seems cause for trouble and much confusion. Put
Howdy all,
I'm trying to call the createFile method from the Path class specified
here:
http://java.sun.com/javase/7/docs/api/java/nio/file/Path.html
The following text:
The following code snippet creates a file with default attributes:
Path file = ...;
try {
file.createFile(); //Create
On Oct 28, 4:33 pm, Richard Newman wrote:
> I think John's point is this:
>
> user=> (take 3 (repeatedly rand))
> (0.07020342855887218 0.590736243072285 0.04997104958104426)
> user=> (take 3 (repeatedly rand))
> (0.6445602419794128 0.12488917903865004 0.5784287452848529)
>
> Different sequences,
> Under Linux I had to fix the paths in liverepl.sh to include the build
> folder:
>
> java -cp "$LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar"
> net.djpowell.liverepl.client.Main "$CLOJURE_JAR"
> "$LIVEREPL_HOME/build/liverepl-agent.jar"
> "$LIVEREPL_HOME/build/liverepl-server.jar" "$@"
I thi
What is wrong with this code? I want to instantiate a Java String
from a Java character-array.
But I want it to be fast, hence the need to cast per the "warn on
reflection" message.
user=> (set! *warn-on-reflection* true)
true
user=> (new String #^"[C" (make-array Character/TYPE 3 \
Would love to see some examples usages of these
On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke wrote:
>
> so i was using haskell, and the pointfree stuff is fun, so naturally i
> had to implement some of it in clojure.
>
> this is what i have so far. library and examples within:
> http://github
Hello,
I've encountered a couple of issues with the cl-format function
included in contrib.pprint
(cl-format nil "~1,1$" -12.0) ;; => "12.0" the sign is lost
I think the problem is the following assignment in the dollar-float
function
add-sign (and (:at params) (not (neg? arg))) ;;
> So when the resulting lazy sequence has its hash code requested, it
> could return a value similar to the following:
>
> (+ (.hashCode rand) (* 37 (.hashCode repeatedly)))
I think John's point is this:
user=> (take 3 (repeatedly rand))
(0.07020342855887218 0.590736243072285 0.04997104958104426
On Oct 28, 1:34 pm, John Harrop wrote:
> This runs into problems with things like (repeatedly rand) though.
How so? The repeatedly function returns a lazy sequence that
(presumably) stores a reference to repeatedly as its generator
function. That instance of repeatedly would, in turn, have to
maps could also be an option.
you can use vectors of ints as keys. (and you can stick dimensions and
such in there with keywords)
i'm not sure how that compares to nested vectors for perforance. you
have the overhead of the hash function, but you don't have any
nesting.
it's also pretty handy if
Under Linux I had to fix the paths in liverepl.sh to include the build
folder:
java -cp "$LIVEREPL_HOME/build/*:$JDK_HOME/lib/tools.jar"
net.djpowell.liverepl.client.Main "$CLOJURE_JAR" "$LIVEREPL_HOME/build/
liverepl-agent.jar" "$LIVEREPL_HOME/build/liverepl-server.jar" "$@"
--~--~-~--~
you can always just construct the call as a string or as a
datastructure and pass it through read/eval
On Wed, Oct 28, 2009 at 2:04 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 28.10.2009 um 20:46 schrieb Tiago Antão:
>
>> But my point is to be able to construct the method name in runtime.
>
> You'
Your analysis is crystal clear and very helpful Konrad. But you
haven't addressed the issue of dealing with useful information
regarding the data structure itself. What if, for example, a function
wanted to know the rank and dimensions of a multidimensional array it
was being passed, and that arra
Hi,
Am 28.10.2009 um 20:46 schrieb Tiago Antão:
> But my point is to be able to construct the method name in runtime.
You'll need reflection for that. AFAIU method calls are wired in the
bytecode and hence the method name must be known at compile time.
Sincerely
Meikel
smime.p7s
Descriptio
2009/10/28 Tiago Antão :
[...]
> Again, the point here is to be able to construct method names (full
> call signatures, really) on runtime.
>
> I am lost. As in newbie clueless :(
I suspect you want reflection, but I don't know off hand how to do it.
--
Michael Wood
--~--~-~--~~--
I second Tim's comment regarding holding onto calculated values.
That's at best a performance optimization, and likely an unnecessary
one.
Also, by using the product itself as a key simplifies the case where
you try to "add" the same product as multiple line-items (though this
may be what you wan
2009/10/28 Kyle Schaffrick :
>
> Don't forget those of us who dislike web-forum software and prefer to
> interact with the group via email: I very seldom use the GG site itself.
> I find threaded email is a *very* good way of following discussions. I
> can have a "I didn't know that" moment delive
On Wed, Oct 28, 2009 at 3:56 PM, Tim Clemons wrote:
> How about having hashCode() on infinite sequences drill down into the
> composite infinite sequences until we arrive at the generative
> function? Given that values are generated on demand, the generators
> themselves can be compared.
This
How about having hashCode() on infinite sequences drill down into the
composite infinite sequences until we arrive at the generative
function? Given that values are generated on demand, the generators
themselves can be compared.
To take from your fibs example:
hashCode(iterate f x) = hashCode(x
On Wed, Oct 28, 2009 at 7:34 PM, Wilson MacGyver wrote:
>
> Is there a reason you don't want to use doto?
>
> http://clojure.org/java_interop#toc15
>
> ie (doto Bla (.setProperty "x" 1))
I really want to do something different:
(def x (new StringBuffer ""))
(doto x (.setLength 2))
But my p
On Wed, Oct 28, 2009 at 12:05 PM, Mark Engelberg
wrote:
> This is basically the behavior I would expect. I expect that when I
> put two sequences into a set, they are compared for equality, which is
> clearly impossible if they are infinite. I don't think I'd want some
> automatically truncated
2009/10/28 Tiago Antão
>
> Hi,
>
> Sorry for the newbie question, but I am trying to understand how to
> construct and call java dynamically from clojure.
> As an example, imagine that there is a bean property called "Bla" and
> one wants to set Bla to 1 on object x, which has that property.
> So
Is there a reason you don't want to use doto?
http://clojure.org/java_interop#toc15
ie (doto Bla (.setProperty "x" 1))
2009/10/28 Tiago Antão :
>
> Hi,
>
> Sorry for the newbie question, but I am trying to understand how to
> construct and call java dynamically from clojure.
> As an example, im
Hi,
Sorry for the newbie question, but I am trying to understand how to
construct and call java dynamically from clojure.
As an example, imagine that there is a bean property called "Bla" and
one wants to set Bla to 1 on object x, which has that property.
So, the objective would be to construct,
On 27.10.2009, at 18:07, Rock wrote:
> 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 they're not that safe to use (for t
Don't forget those of us who dislike web-forum software and prefer to
interact with the group via email: I very seldom use the GG site itself.
I find threaded email is a *very* good way of following discussions. I
can have a "I didn't know that" moment delivered to my inbox every day,
without havi
I think John made some very good points in that blog post.
I am running a Google Group and I am finding for smaller groups it is
possible to give a few people moderator rights so that any new members
are able to get their posts in at a reasonable time. Still, the points
that John raises are valid
Tom Hicks has just pointed me to an old thread which answers
questions about namespaces and isolation. Let me read and
absorb all that work first - I suspect it answers a lot of my
questions.
Cheers, Tony
On Oct 28, 11:43 am, Tony Butterfield wrote:
> Hi Everybody
>
> this is my first post to t
agreed, I'm not sure how meaningful it would be to compare two
infinite "things".
On Wed, Oct 28, 2009 at 12:05 PM, Mark Engelberg
wrote:
>
> This is basically the behavior I would expect. I expect that when I
> put two sequences into a set, they are compared for equality, which is
> clearly im
This is basically the behavior I would expect. I expect that when I
put two sequences into a set, they are compared for equality, which is
clearly impossible if they are infinite. I don't think I'd want some
automatically truncated comparison. If I really wanted truncated
comparison, there are
Hi Everybody
this is my first post to this group so please tell me If I'm posting
in the wrong place. I've been looking at integrating Clojure into
NetKernel as language runtime library but I'm struggling a bit for a
lack of examples. There are two things I'm trying to achieve:
1) start and stop
and it's not hard to guess, and then prove, why:
user=> (defn fibs [] (map first (iterate (fn [[a b]] [b (+ a b)]) [1 1])))
#'user/fibs
user=> (take 10 (fibs))
(1 1 2 3 5 8 13 21 34 55)
user=> (.hashCode 12)
12
user=> (.hashCode "foo")
101574
user=> (.hashCode (take 10 (fibs)))
-1796812414
user=>
Hi,
On Oct 28, 7:56 am, John Harrop wrote:
> That was correct. I just wanted to avoid any confusion between the #() read
> macro and anonymous functions; the read macro is one way of writing an
> anonymous function but it is not the only way so the two aren't quite
> interchangeable.
#() is in
On Wed, Oct 28, 2009 at 4:20 AM, Timothy Pratley
wrote:
> On Oct 28, 6:04 pm, John Harrop wrote:
> > It always starts with the zeroth item and skips ahead however many
> elements
> > were specified. The second argument is the n in
> > "every nth item". (You can think of it as the index of the SEC
On Oct 28, 6:04 pm, John Harrop wrote:
> It always starts with the zeroth item and skips ahead however many elements
> were specified. The second argument is the n in
> "every nth item". (You can think of it as the index of the SECOND item to
> take, so (take-nth 3 foo) takes index 0 of foo, then
On Tue, Oct 27, 2009 at 9:50 PM, Josh Daghlian wrote:
> The docs could use clarification, but it looks like take-nth is doing
> what's advertised.
>
I don't see anything odd about the behavior of take-nth in regards to
indexing:
user=> (take 10 (take-nth 1 (range 100)))
(0 1 2 3 4 5 6 7 8 9)
us
43 matches
Mail list logo