Re: Questions about a Clojure Datalog

2009-01-31 Thread Jeffrey Straszheim
I've been doing some more research on this. This article seems a good introduction: http://www.dcc.uchile.cl/~cgutierr/cursos/FDB/p16-bancilhon.pdf It turns out the naive implementation (a bottom-up fixed point iterator) is pretty easy to understand, and would not be hard to implement -- minus

Re: Request for feature: watchers on namespaces

2009-01-31 Thread Mibu
At this point I think maybe a broader more abstract view is in order. How about watchers for every mutable construct in Clojure? On Feb 1, 7:12 am, Mark Fredrickson wrote: > I know its been discussed before, but I would like to register a   > request for a feature: watchers on namespaces. My ne

Re: Request for feature: watchers on namespaces

2009-01-31 Thread falcon
+1 for this request. I have a question as well, aren't the namespace bindings stored in one of clojure's concurrency objects? Since the ability to interact with a running program is one of the features that sets clojure apart from most other mainstream programming languages, if more than one per

Re: Why Isn't This Working

2009-01-31 Thread Meikel Brandmeyer
Hi, Am 01.02.2009 um 03:26 schrieb Onorio Catenacci: (defn init-sheet #^{:doc "Initialize a worksheet with a particular month"} ([current-month] (if debugging (println "In init-sheet")) ) ) You don't need #^ to attach the docstring. In fact your version

Request for feature: watchers on namespaces

2009-01-31 Thread Mark Fredrickson
I know its been discussed before, but I would like to register a request for a feature: watchers on namespaces. My needs are simple, just a callback when something in the namespace changes. It does not matter to me what binding changed, if something was added, if something was deleted. My

Re: when performance matters

2009-01-31 Thread Isaac Gouy
On Jan 13, 10:07 am, cliffc wrote: -snip- > 5- The debianshootoutresults generally badly mis-represent Java. > Most of them have runtimes that are too small (<10sec) to show off the > JIT, and generally don't use any of the features which commonly appear > in large Java programs (heavy use of v

Re: what does -> mean?

2009-01-31 Thread Adrian Cuthbertson
Some examples... ; using -> (f1 (f2 (f3 (f4 x ; can be "flattened" to (-> x f4 f3 f2 f1) Useful for nested maps... user=> (def m {:one {:a 1 :b 2 :c {:x 10 :y 11}}} ) #'user/m user=> (-> m :one :c :x) 10 user=> (-> x :one :b) 2 On Sun, Feb 1, 2009 at 5:31 AM, Jason Wolfe wrote: > > On Jan

Re: what does -> mean?

2009-01-31 Thread Jason Wolfe
On Jan 31, 7:09 pm, wubbie wrote: > Hi, > > I saw in ants.clj a notation (->). > what is it? > For example, > (defn place [[x y]] >   (-> world (nth x) (nth y))) Did you check the docs? On the website: http://clojure.org/API#toc21 Within clojure itself: user> (doc ->)

Re: meaning of coll

2009-01-31 Thread Jason Wolfe
> I think it means any class that implements java.util.Collection. To be precise, I think "nil" is also always OK. Sometimes other seq-able things like Java arrays can be passed too, although I don't think this is ever promised to work (if it doesn't, you can always explicitly call seq on them

what does -> mean?

2009-01-31 Thread wubbie
Hi, I saw in ants.clj a notation (->). what is it? For example, (defn place [[x y]] (-> world (nth x) (nth y))) thanks in advance. -sun --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: meaning of coll

2009-01-31 Thread James Reeves
On Feb 1, 2:42 am, Mark Volkmann wrote: > When a function parameter is named "coll", does that generally mean it > can be any kind of collection except a map? > For example, the some function takes a predicate function and a > "coll", but it can't be a map. I thought all functions with coll took

Re: That Zipper thing

2009-01-31 Thread James Reeves
In Feb 1, 2:32 am, e wrote: > I don't understand this: (def z (zip/zipper rest rest cons t)) >From the API docs on zipper: (zipper branch? children make-node root) The branch? predicate is rest, because if a node has children, then rest will not be nil, and therefore true. The children pr

Re: meaning of coll

2009-01-31 Thread Jason Wolfe
On Jan 31, 6:42 pm, Mark Volkmann wrote: > When a function parameter is named "coll", does that generally mean it > can be any kind of collection except a map? > For example, the some function takes a predicate function and a > "coll", but it can't be a map. I think it means any class that imple

Re: Why Isn't This Working

2009-01-31 Thread Jason Wolfe
> ;For my own reference--this is an example of a Clojure sequence > comprehension > (for [current-month [months]] >         (let [current-sheet (init-sheet current-month)]) > ) Two things: - I think you want (for [current-month months] ... As-is, this will loop a single time, binding current-

Re: Why Isn't This Working

2009-01-31 Thread Mark Volkmann
On Sat, Jan 31, 2009 at 8:26 PM, Onorio Catenacci wrote: > > Hi all, > > I feel like a bloody noob for having to ask this (I've been coding C++ > for years but Clojure, Lisp and Java are all new territory for me) but > I'm missing something obvious and basic here and I'm still struggling > with t

Re: into vs. clojure.set/union

2009-01-31 Thread Jason Wolfe
Hmm, that's an interesting question. It looks to me like into could be implemented exactly like clojure.set/union, e.g., (reduce conj to from), so I'm not sure why it's written the way it is ... I must be missing something. Anyway, I think clojure.set/union is just a special case of into, at lea

meaning of coll

2009-01-31 Thread Mark Volkmann
When a function parameter is named "coll", does that generally mean it can be any kind of collection except a map? For example, the some function takes a predicate function and a "coll", but it can't be a map. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~-

Re: That Zipper thing

2009-01-31 Thread e
I don't understand this: (def z (zip/zipper rest rest cons t)) Also, it didn't make sense why down arbitrarily brought you to the left child. Why wouldn't you have to say, "down-left"? Thanks. On Sat, Jan 31, 2009 at 10:03 AM, James Reeves wrote: > > On Jan 31, 3:06 am, Jeffrey Straszheim > w

Why Isn't This Working

2009-01-31 Thread Onorio Catenacci
Hi all, I feel like a bloody noob for having to ask this (I've been coding C++ for years but Clojure, Lisp and Java are all new territory for me) but I'm missing something obvious and basic here and I'm still struggling with the syntax a bit. I'm trying to learn clojure by simply translating an

into vs. clojure.set/union

2009-01-31 Thread Mark Volkmann
What's the difference between into and clojure.set/union? While their source code is quite different, they seem to do the same thing to me. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: pmap not parallel for me...

2009-01-31 Thread Conrad
Yup, that fixed it. Thanks! -Conrad --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to cloj

Re: Got a Clojure library?

2009-01-31 Thread John D. Hume
clj-record http://github.com/duelinmarkers/clj-record Author: John Hume Category: db License: MIT Dependencies: clojure-contrib Inspired by Rails' ActiveRecord, a convenient persistence API with support for declarative validations, callbacks, and associations. --~--~-~--~~---

Re: improvement: make main.clj not die when exception in --init

2009-01-31 Thread Allen Rohner
> Patch welcome. > > Rich http://code.google.com/p/clojure/issues/detail?id=62&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: android app development with clojure

2009-01-31 Thread Remco van 't Veer
Some naive caching code does speed up my sample by 4 times. Will investigate further later this week, need to take my flu to bed now.. diff --git a/src/jvm/clojure/lang/Reflector.java b/src/jvm/clojure/lang/Reflector.java index f530b78..eccebb8 100644 --- a/src/jvm/clojure/lang/Reflector.java +

Re: That Zipper thing

2009-01-31 Thread Jeffrey Straszheim
That seems simple enough. Thanks. On Jan 31, 10:03 am, James Reeves wrote: > On Jan 31, 3:06 am, Jeffrey Straszheim > wrote: > > > Does anyone know of a gentle introduction to the Zipper stuff, and how > > it is used in Clojure? > > My understanding of zippers is that they are a way of efficie

Re: Clojure is "not a serious language"

2009-01-31 Thread Mark H.
On Jan 30, 8:40 pm, Jon Harrop wrote: > Apologies if you've seen this before but I just thought it was absolutely > hillarious: > > http://www.3ofcoins.net/2009/01/30/common-lisp-clojure-and-seriousness/ Hey, I have to admit, I was scared when I saw you show up here, but now I think I understand

Re: Questions about a Clojure Datalog

2009-01-31 Thread Jeffrey Straszheim
Iris looks really good. They seem to have put a lot of work into multiple, efficient evaluation strategies, and various levels of expressivity versus safety. That kind of work is priceless. However, I'm not sure if you can built your own predicates in Java code (and therefore in Clojure code).

Re: RFC: new clojure.set functions

2009-01-31 Thread Jason Wolfe
> I'm must be missing something obvious for the [s1 s2] case of union: > > Is it only that you've measured (conj s1 s2) to be faster when s2 is > the smallest ? Yes, that's it. "conj" iterates through the second argument, and since count is O(1) for sets, it makes sense to always iterate thro

Re: pmap not parallel for me...

2009-01-31 Thread Rich Hickey
On Jan 31, 11:41 am, Conrad wrote: > Hi everyone- I'm a new Clojurist trying to understand how to make use > of Clojure parallelism... I wrote this simple program that calculates > the number of prime numbers in a number range. It is purposely > inefficient: > > (defn prime [a] > (not-any? #(

pmap not parallel for me...

2009-01-31 Thread Conrad
Hi everyone- I'm a new Clojurist trying to understand how to make use of Clojure parallelism... I wrote this simple program that calculates the number of prime numbers in a number range. It is purposely inefficient: (defn prime [a] (not-any? #(integer? (/ a %)) (range 2 a))) (defn primes [a b]

pmap not parallel for me...

2009-01-31 Thread Conrad
Hi everyone- I'm a new Clojurist trying to understand how to make use of Clojure parallelism... I wrote this simple program that calculates the number of prime numbers in a number range. It is purposely inefficient: (defn prime [a] (not-any? #(integer? (/ a %)) (range 2 a))) (defn primes [a b]

Re: How do *you* use Compojure?

2009-01-31 Thread James Reeves
On Jan 30, 4:00 pm, eyeris wrote: > While testing Compojure, I've been using the embedded Jetty API. This > has been convenient for getting up and running quickly. However I > don't like having to restart my script each time I need to test a > change. I'd advise moving the code that starts the J

Re: Got a Clojure library?

2009-01-31 Thread fyuryu
Name: Roland Sadowski (fyuryu on IRC). Library name: Clojure+Processing Library home page URL: http://github.com/rosado/clj-processing/tree/master Category: visualization, graphics, wrapper License: Common Public License Version 1.0 Dependencies: a recent version of Processing (processing.org) De

Re: Documentation of lazy-cat should contain a warning

2009-01-31 Thread Meikel Brandmeyer
Hi, Am 31.01.2009 um 15:55 schrieb André Thieme: On 31 Jan., 02:47, Jason Wolfe wrote: I think this behavior is as-intended, although I agree that it is confusing. I am worried that you could be right. That’s why I suggested to modify the doc string of lazy-cat. In my opinion the real step

Re: How do *you* use Compojure?

2009-01-31 Thread Daniel Renfer
Personally, I AOT compile a stub servlet class and load my webapp into Tomcat. This will require that you set up your directory structure following the Servlet API spec. I also have some code in same file that my servlet is defined in that will start a swank server only if the code is not being c

Re: That Zipper thing

2009-01-31 Thread James Reeves
On Jan 31, 3:06 am, Jeffrey Straszheim wrote: > Does anyone know of a gentle introduction to the Zipper stuff, and how > it is used in Clojure? My understanding of zippers is that they are a way of efficiently navigating a tree data structure in a functional manner. So if we have the tree:

android app development with clojure

2009-01-31 Thread Remco van 't Veer
I've been playing around with clojure on the android platform. To my surprise it was pretty easy to get running, after removing the bean method from the clojure.jar as hinted by Rich somewhere. Of course clojure code needs to be compiled AOT and eval doesn't work, as was to be expected, but all

Re: Documentation of lazy-cat should contain a warning

2009-01-31 Thread André Thieme
On 31 Jan., 02:47, Jason Wolfe wrote: > I think this behavior is as-intended, although I agree that it is > confusing. I am worried that you could be right. That’s why I suggested to modify the doc string of lazy-cat. In my opinion the real step that needs to be done is to go away from making ni

Re: Documentation of lazy-cat should contain a warning

2009-01-31 Thread Daniel Renfer
Ok, I take it back. (no pun intended) I know that this used to be a problem, but looking through my email history, it appears that the over-eager take was reported by Chouser, and subsequently fixed by Rhickey. On Sat, Jan 31, 2009 at 9:47 AM, André Thieme wrote: > > On 31 Jan., 02:44, Daniel R

Re: Documentation of lazy-cat should contain a warning

2009-01-31 Thread André Thieme
On 31 Jan., 02:44, Daniel Renfer wrote: > user=> (take 0 (lazy-cat [(println 10)] [(println 20)])) > 10 > nil > > What you see here is not an issue with lazy-cat, but rather an issue > with take. The current implementation of take evaluates one more than > the n passed to it. I don’t think so:

How do *you* use Compojure?

2009-01-31 Thread eyeris
I'm considering implementing a small web app using Compojure. I don't have much experience with Jetty or any other web server save Apache. While testing Compojure, I've been using the embedded Jetty API. This has been convenient for getting up and running quickly. However I don't like having to r

Re: improvement: make main.clj not die when exception in --init

2009-01-31 Thread Rich Hickey
On Jan 30, 2009, at 6:16 PM, Stephen C. Gilardi wrote: >> A minor annoyance of mine is that clojure.main exits if there is an >> exception in an --init file, even if you ask for a repl. i.e. > > > +1 in favor of fixing this. > Patch welcome. Rich --~--~-~--~~~---~

Re: RFC: new clojure.set functions

2009-01-31 Thread verec
I'm must be missing something obvious for the [s1 s2] case of union: Is it only that you've measured (conj s1 s2) to be faster when s2 is the smallest ? (defn un ([s1 s2] (reduce conj s1 s2)) ... ) user=> (def a #{1 2 3}) user=> (def b #{4 5 6 7}) user

newbie Q: can I optimize away like this?

2009-01-31 Thread wubbie
Hello, I'd like to separate dosync and other funcs as follows. Any comment? Essentially I want to allow more concurrency. (if true (do (dosync (ref-set r1 1)) (non-ref setting fun)) (else-fun)) Instead of (if true (dosync (ref-set r1 1) (non-ref setting fun))

Re: Clojure is "not a serious language"

2009-01-31 Thread Mibu
Check out the comment left by Blue Phil. Priceless. On Jan 31, 6:40 am, Jon Harrop wrote: > Apologies if you've seen this before but I just thought it was absolutely > hillarious: > > http://www.3ofcoins.net/2009/01/30/common-lisp-clojure-and-seriousness/ > > -- > Dr Jon Harrop, Flying Frog Con

Re: Object system for Clojure?

2009-01-31 Thread Meikel Brandmeyer
Hi, Am 31.01.2009 um 12:44 schrieb Jan Rychter: Phrased differently, I don't understand the utility of StructMaps. At the moment struct-maps are an optimisation for the case that you have a lot of maps of the same type. struct-maps share there key information. No more, no less. Sincerely Mei

Re: Documenting Clojure Code

2009-01-31 Thread Mark McGranaghan
Daniel, Last night I updated clj-doc so that it should run without problems: if you're willing to try it out I'd be willing to fix any problems that you come up against and let me know about. At this point there are still rough edges that I want to fix and features that I want to add (see the TOD

Basic clojure working in OSGi

2009-01-31 Thread Mark Derricutt
'lo, Well I just got a very very basic clojure program working from OSGi (Apache Felix), although its not yet as I'm still seeing some weirdness, but hopefully I should have something to write about in the morning, anyway, I had to patch clojure's RT class slightly in order to get it to work: dif

Re: Object system for Clojure?

2009-01-31 Thread Jan Rychter
David Nolen writes: > At this point you have to roll your own, I have an experimental thing I plan > on fleshing out temporarily called CLJOS. I've implemented field > inheritance, type inheritance, basic multiple inheritance, basic > introspection. Search the mailing list for CLJOS and you'll s

Re: Object system for Clojure?

2009-01-31 Thread Jan Rychter
Stuart Sierra writes: > On Jan 30, 1:09 pm, Jan Rychter wrote: >> From what I read, the reasoning is that Clojure provides extremely >> general multimethods where you have to define a dispatch function. On >> the object side, there is metadata and you can do with it whatever you >> want. But thi

Re: Loading two namespaces that :use each other.

2009-01-31 Thread Meikel Brandmeyer
Hi, Am 31.01.2009 um 02:19 schrieb CuppoJava: (defn new_sprite_engine [] ... (add_sprite (new_cursor_sprite)) ...) So, my code (I think) is pretty well separated in terms of responsibility. But as it's structured right now, I can't load the file. Is there an elegant way of going about this?