2009/7/22 Meikel Brandmeyer :
> Hi,
>
> Am 22.07.2009 um 18:42 schrieb Paul Mooser:
>
>> Is it safe to assume that you can extract the key ordering from the
>> literal map the user specified ? Or am I misunderstanding ?
>
> Up to eight elements in a literal map are stored
> as array-map. An array-
> On Jul 21, 5:51 am, Jan Rychter wrote:
>> Is there a way to get the size of a data structure in Clojure?
>>
>> I've been wondering how much more space-efficient vectors are than
>> lists, but I don't know how to measure it.
Stuart Sierra writes:
> Short answer: no, because Java has no sizeof
On Jul 24, 12:23 am, Jeremy Gailor wrote:
> Hi David,
>
> I would say that this is a problem in any programming language that makes
> use of an external library. If the public API of a library changes, you're
> going
> to need to update the code that acts as a consumer of that library.
I under
Hello,
I've been reading this list for a while. Suppose it's time to delurk. :-)
On Thu, Jul 23, 2009 at 10:58 AM, pcda...@gmail.com wrote:
> The kind of scenario I'm worrying about is this:
> - Alice writes library foo and use a particular way to encode values
> (say simple vectors).
> She pub
On Jul 23, 10:15 pm, Richard Newman wrote:
> > Coming from an OO background which puts a strong focus on data
> > encapsulation,
> > this makes me a little nervous.
>
> The same problem exists with OO.
Not to the same extent, unless you expose all the internals of your
classes (including field
> > Up to eight elements in a literal map are stored
> > as array-map. An array-map keeps the key ordering.
> > For more elements the map becomes a hash-map,
> > which does not keep the key ordering.
>
> I assume that's an implementation detail that one could not rely on,
> though, right?
Yeah,
Sometimes (or maybe always?) it is mentioned in the doc. In my
opinion, this is one of the cases where dynamic languages do not
excel. If we had typing, that would be solved by implementing Lazy
"interface".
Or maybe this is an use case for metadata? Each function could have a
tag :lazy? with poss
On Fri, Jul 24, 2009 at 5:04 AM, Jan Rychter wrote:
>
>> On Jul 21, 5:51 am, Jan Rychter wrote:
>>> Is there a way to get the size of a data structure in Clojure?
>>>
>>> I've been wondering how much more space-efficient vectors are than
>>> lists, but I don't know how to measure it.
>
> Stuart S
Hi,
2009/7/24 pcda...@gmail.com
>
> On Jul 23, 10:15 pm, Richard Newman wrote:
> > > Coming from an OO background which puts a strong focus on data
> > > encapsulation,
> > > this makes me a little nervous.
> >
> > The same problem exists with OO.
>
> Not to the same extent, unless you expose a
Hi,
On Jul 24, 2:03 pm, Laurent PETIT wrote:
> But you should consider that everything you cannot find in the (doc) of
> functions is not public API.
+1
And if you don't care for docstrings... Well. It's your software which
blows up, not mine. If there is something unclear from the docstrings
Hi,
Everything returning a seq is lazy: take, drop, iterate, map, ...
Everything (maybe) returning something else is not: reduce, loop, ...
Not 100% accurate, but this heuristic should get you very far.
Sincerely
Meikel
--~--~-~--~~~---~--~~
You received this me
On Jul 24, 6:17 am, Dragan Djuric wrote:
> Sometimes (or maybe always?) it is mentioned in the doc. In my
> opinion, this is one of the cases where dynamic languages do not
> excel. If we had typing, that would be solved by implementing Lazy
> "interface".
We do have types and we do have a lazy
I am a very new clojure user but I believe I have found a bug when
using the clojure.contrib.duck-streams library.
My attempt to stream process a very big file blows up with
"java.lang.OutOfMemoryError: Java heap space".
I can reproduce the problem with the following simple code which I
think ru
I have scoured the online documentation for instructions on how to
compile clojure source files from the command line. I would like to
create a simple "hello, world!" program, place it in a file, and
compile it. Is this documented or do we need to look at examples
somewhere? I have seen referen
On Jul 24, 10:30 am, Deklan wrote:
> I have scoured the online documentation for instructions on how to
> compile clojure source files from the command line.
It's not often used, but you can run the class clojure.lang.Compile.
You have to set the Java system property "clojure.compile.path" to a
I'm afraid I can't reproduce this error, Alexander. I can run
(write-lines "/tmp/out" (line-seq (reader "/tmp/bigfile")))
on a 4.5 GB file with no problem, and I don't have that much memory.
Out-of-memory errors like this usually occur when your code is
"holding on to the head" of the sequ
FWIW (i.e. IMO the previous two functional solutions are better
examples) here is a more imperative style solution done sort of to
prove to myself that I could do such a thing in Clojure w/o too much
(arguable) fanfare. Maybe it will be interesting to others who are
learning Clojure too
(defn sc
I should admit that there may be something else I'm missing here.
write-lines is not a lazy sequence function, so it may be responsible
for holding the head of the sequence. I can't reproduce the error,
though.
-SS
On Jul 24, 11:29 am, Stuart Sierra
wrote:
> I'm afraid I can't reproduce this e
Is there an automatic way to discover such error? These types of
errors could be discovered by the compiler. How am I going to see if I
get an ISeq in my clojure code? I would have to dig...
On Jul 24, 3:37 pm, eyeris wrote:
> On Jul 24, 6:17 am, Dragan Djuric wrote:
>
> > Sometimes (or maybe a
Are there ways to override functions so that if you have different
parameters, you get different logic?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@goog
yes there is a way: http://clojure.org/multimethods
On Fri, Jul 24, 2009 at 11:44 AM, BerlinBrown wrote:
>
> Are there ways to override functions so that if you have different
> parameters, you get different logic?
> >
>
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone
I'm pretty familiar with scheme programming, so functional programming isn't
new to me, but I rarely turn to it for solving problems during my day to day
work. In learning Clojure, I've been going through problems on project
euler, and one question I have is that while it's straigh-forward to
impl
> yes there is a way: http://clojure.org/multimethods
And also plain ol' arity overriding:
(defn foo
"Do something."
([x] (println x))
([x y] (println (+ x y
For something similar to Java, where a particular method is selected
purely on the type of the arguments, a multimethod l
Jeremy,
On Jul 24, 1:20 pm, Jeremy Gailor wrote:
> I'm just looking for general optimizations that I should be aware of, the
> nature of the function itself isn't really important. I could turn to
> number theory to get some performance improvement, but from a Clojure
> oriented perspective, wh
Passing a collection to a function that expects a lazy seq is not
always an error. The seq library encourages it by calling (seq) on
those collections for you. I suppose all lazy functions could emit a
warning when they have to call (seq) on their arguments, based on some
global variable like *war
Hi
Are there any fundamental reasons why the Keyword class shouldn't be
serializable? I've been playing around with Clojure and Wicket and
it's not possible to use maps containing Keywords in Wicket page
classes. Wicket pages are serialized and stored in the session
between requests and this fa
Laurent PETIT writes:
> 2009/7/24 pcda...@gmail.com
>
> On Jul 23, 10:15 pm, Richard Newman wrote:
> > > Coming from an OO background which puts a strong focus on data
> > > encapsulation,
> > > this makes me a little nervous.
> >
> > The same problem exists with OO.
Well, that's what I am talking about. It can be controlled, but it
requires good grasp of all the concepts and high concentration + there
is still a chance to miss something. Now it may not be such a problem
since the majority of people who use clojure are usually highly
motivated enthusiasts, but
28 matches
Mail list logo