On 14 Oct 2010, at 21:52, clwham...@gmail.com wrote:
I need a function that produces the 'next' value from a lazy-seq --
something like a Python generator. I imagine it would have to be some
sort of closure like:
(def next-sine
(let [sines (atom (cycle (map sin (range 0 6.28 0.01]
On Fri, Oct 15, 2010 at 04:13, David Jacobs
wrote:
> I've just started learning Clojure and I'm excited about what I see. The
> combination of power and sophistication in the language is refreshing, and
> I've started to dive into the source code to understand it better.
>
> One meta-observation
IMHO if it is not broken, dont fix it. I am sure the original authors are
aware and are very much around. Probably they would be the best people to do
it anyway.
On Fri, Oct 15, 2010 at 7:43 AM, David Jacobs <
develo...@allthingsprogress.com> wrote:
> I've just started learning Clojure and I'm ex
I've just started learning Clojure and I'm excited about what I see. The
combination of power and sophistication in the language is refreshing, and I've
started to dive into the source code to understand it better.
One meta-observation has come out of my scouring.
The indentation used for the p
Thanks Kyle. Looks useful!
On 15 October 2010 09:25, Saul Hazledine wrote:
> On Oct 14, 9:16 pm, "Kyle R. Burton" wrote:
> > I've written some sql helper functions that will do things like list
> > the objects in the database and describe a table. I've found these
> > handy when doing interact
I've been having trouble with congomongo for the reasons you
specified, and a few more (doesn't sort, ran into a bug where limit
was working properly with large datasets).
I recently switched to the "karras" clojure wrapper for mongodb
(http://github.com/wilkes/karras), and found it to be much mor
I wouldn't say it has *nothing* to do with dotimes. If dotimes were
lazy rather than eager, then his form would do nothing despite the
eagerness of into, because into is not being called:
(for [i (range 100)]
(into [] (some-expensive-calc)))
On Oct 14, 3:34 pm, Meikel Brandmeyer wrote:
> H
Yes, it would be. But it's "wildly unlikely" that you need to do it.
You don't say what you're using next-sine! for, but I'll imagine
you're doing something like printing it. Maybe your code looks like:
(dotimes [n num-iters]
(let [s current-sine]
(next-sine!)
(println s)))
This can eas
Hi,
Am 14.10.2010 um 23:07 schrieb Henk:
> Does dotimes force evaluation?,
At a different level. (dotimes [n 1] (for ...)) does evaluate the for form.
But it returns a seq which is never realised. So you do effectively … nothing.
(dotimes [n 1] (into [] (for ...))) as in your example d
On Oct 14, 9:16 pm, "Kyle R. Burton" wrote:
> I've written some sql helper functions that will do things like list
> the objects in the database and describe a table. I've found these
> handy when doing interactive development as I don't have to jump over
> to another app to see what the make up
I have recently looked at mongodb and liked the idea of a schema less
database. I found somnium.congomongo and played with that for a while,
but ran into some issues
- it doesnt work with the current release 2.2 of mongo java driver
- lots of reflection warnings
- perhaps lacking some finish...
A
On Thu, Oct 14, 2010 at 4:54 PM, Henk wrote:
> Thanx!,
>
> That is exactly what I was looking for!,
>
> Being a clojure newbie and a non-native speaker it is hard to find
> the correct function among many in clojure core API :-)
> If only the documentation would provide simple examples like you
>
On Oct 14, 2010, at 12:07 PM, cej38 wrote:
> I am kinda sorry that I started this whole thing. I don't need
> another lesson in limits. The simple fact of the matter is that, in
> my code, I run into a place where I have a comparison (= some-value
> (some-function some-data)), the function, dat
Does dotimes force evaluation?,
if so, then the Clojure version is about twice as fast for me...
which would be nice to finally find a good dynamic programming
language that is also
nice and fast :-)
the code I tested is this:
(def HHQ [{:id 1956, :firstname "Piet", :lastname
"Puk", :programming
I originally thought of calling nth on the seq but isn't that pretty
wildly inefficient?
On Oct 14, 1:38 pm, Moritz Ulrich
wrote:
> Are you sure you need to capture the state in next-sine? It's not very
> clojure-ly to have functions with state. I would capture the state in
> the caller as an int
Thanx!,
That is exactly what I was looking for!,
Being a clojure newbie and a non-native speaker it is hard to find
the correct function among many in clojure core API :-)
If only the documentation would provide simple examples like you
provided...
On 14 okt, 18:20, liebke wrote:
> Here's one a
(defn iterate [s]
(let [a (atom s)]
(fn []
(let [s @a]
(reset! a (next s))
(first s))
but it's not very idiomatic in clojure.
(In Lisp it is traditional to hide a state in a closure. A lot of toy
object language work like that)
On Thu, Oct 14, 2010 at 9:38
> This is fantastic! Does it work reliably for most JDBC drivers? Some
> drivers may not implement meta data API very well, and some drivers
> may have their own idiosyncrasies. You can perhaps setup a GitHub
> project and push to Clojars if this doesn't get into contrib any time
> soon.
I have ma
Are you sure you need to capture the state in next-sine? It's not very
clojure-ly to have functions with state. I would capture the state in
the caller as an integer and just use get or nth on the lazy seq.
If you want to stick to your impure function, please mark it with a !
at the end: next-sine!
+1 Sounds good.
Regards,
Shantanu
On Oct 14, 11:58 pm, Mark Engelberg wrote:
> Since no one chimed in with support or reasoning for resultset-seq's
> current lower-casing behavior, can we discuss changing it to
> case-maintaining behavior, or at least make it something you can set
> with an opti
This is fantastic! Does it work reliably for most JDBC drivers? Some
drivers may not implement meta data API very well, and some drivers
may have their own idiosyncrasies. You can perhaps setup a GitHub
project and push to Clojars if this doesn't get into contrib any time
soon.
Regards,
Shantanu
Maybe something like this. Those calls polymorphic on the returrn
value of the anynimous function, so this is more powerful than
overloading.
(defmulti load-page (fn [p n] (:id p)))
(defmethod load-page :db [loader name] (println "db provider for page"
name))
(defmethod load-page :fs [loader name]
I need a function that produces the 'next' value from a lazy-seq --
something like a Python generator. I imagine it would have to be some
sort of closure like:
(def next-sine
(let [sines (atom (cycle (map sin (range 0 6.28 0.01]
#(swap! sines rest)))
Is there a more idomatic way o
On Thu, Oct 14, 2010 at 08:02, Ralph wrote:
> First, how do I submit a request for enhancement?
>
>
I believe the process is:
a) register on assembla,
b) submit ticket (
http://www.assembla.com/spaces/clojure/tickets/custom_report/2729 )
If you intend to provide the change via a pull request on
I've written some sql helper functions that will do things like list
the objects in the database and describe a table. I've found these
handy when doing interactive development as I don't have to jump over
to another app to see what the make up of tables are. I've also used
it in some scenarios w
Since no one chimed in with support or reasoning for resultset-seq's
current lower-casing behavior, can we discuss changing it to
case-maintaining behavior, or at least make it something you can set
with an optional flag?
On Sun, Oct 10, 2010 at 8:41 PM, Mark Engelberg
wrote:
> Why does resultset
On Oct 14, 11:54 am, Henk wrote:
> (I did some small benchmarks on this), while the list comprehension
> itself is much faster than python...
Not an answer to your question, but: depending on what you mean by
"much faster", there is a good chance that you measured the clojure
for expression doing
On Thu, Oct 14, 2010 at 12:07 PM, cej38 wrote:
> I am kinda sorry that I started this whole thing. I don't need
> another lesson in limits. The simple fact of the matter is that, in
> my code, I run into a place where I have a comparison (= some-value
> (some-function some-data)), the function,
Here's one approach:
(into {} [[:a 1] [:b 2] [:c 3]])
=> {:a 1, :b 2, :c 3}
On Oct 14, 11:54 am, Henk wrote:
> Hi All,
>
> In Python I was used to be able to easily create dictionaries from
> lists of key value 'pairs' (tuples or list), e.g. like this:
>
> dict([(10, 20), (30, 40)]) #using the
Hi All,
In Python I was used to be able to easily create dictionaries from
lists of key value 'pairs' (tuples or list), e.g. like this:
dict([(10, 20), (30, 40)]) #using the dict constructor
=>
{10:20, 30:40}
What would be the equivalent in Clojure?, e.g. the normal Clojure hash-
map function ta
I am kinda sorry that I started this whole thing. I don't need
another lesson in limits. The simple fact of the matter is that, in
my code, I run into a place where I have a comparison (= some-value
(some-function some-data)), the function, data, and value can change.
In a use case that I am inte
> Maybe you could use a parent map.
> You have a normal tree, and then you have a map where
> you can get the parent for a given node. I don't know if this
> will be too slow for your problem - it's just an idea.
I haven't thought about it, thank you. I'm going to try different
options and decid
First, how do I submit a request for enhancement?
Second, the documentation for "assoc" in clojure.core should probably
include "(assoc vector index val)" and "(assoc vector index val &
ivs)" in the usage line.
--
You received this message because you are subscribed to the Google
Groups "Clojure
Maybe you could use a parent map.
You have a normal tree, and then you have a map where
you can get the parent for a given node. I don't know if this
will be too slow for your problem - it's just an idea.
Kind regards Sune
On Oct 13, 6:45 pm, andrei wrote:
> How can I override print-method for a
For the sake of comparison with other LISPs - some Scheme
implementations have an exact? function for dealing with non-precise
numbers.
This seems not to have come across to Clojure. (Although we do have
ratios and BigInteger).
JG
--
You received this message because you are subscribed to the G
Oh, I think I missed your suggestion of multimethods. They do in fact
look pretty interesting, but I wasn't able to figure out how that would
solve my problem - they look more like overloading than polymorphism to
me. Would you mind posting a variant of my example that uses multimethods?
On 14/10/
Interesting approach. I'll keep it in mind, but for this particular
project I actually have to have mutable objects - both parents and
children must be modifyable. Also I really want to see them as
collections: closures where used everywhere in the previous version of
program, and it was very hard
Another proof:
Let study the sequence sn = 0....9 , with n 9s.
Or s0= 0 and s(n+1) = sn + 9 / 10 ^n
lim sn = 0.9...
and lim sn = 1.
so
If I remember my meth correctly,
the number 0... does not exist.
This not a legal decimal sequence.
(Any decimal sequence finishing b
38 matches
Mail list logo