How to: reduce boolean operations?
OK long time lurker here. I've been growing in my Clojure strength for a while now. For the most part I think I get it and I have no problem getting programs to do what I want. However, sometimes I get stumped. I have one function that produces a list of booleans like '(false false true). It seemed to me that this should be legal: (reduce and '(false false true)) However that is not legal with the complaint being something about and being a macro. :-/ I did get it to work with: (eval (conj '(false false true) 'and)) It works but is it correct? Is it what you would do? I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Using a lambda seems to be a sane approach - (reduce #(and %1 %2) '(false false true)) ;= false On Wed, May 22, 2013 at 5:36 AM, Peter Mancini pe...@cicayda.com wrote: OK long time lurker here. I've been growing in my Clojure strength for a while now. For the most part I think I get it and I have no problem getting programs to do what I want. However, sometimes I get stumped. I have one function that produces a list of booleans like '(false false true). It seemed to me that this should be legal: (reduce and '(false false true)) However that is not legal with the complaint being something about and being a macro. :-/ I did get it to work with: (eval (conj '(false false true) 'and)) It works but is it correct? Is it what you would do? I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Using eval should be a rarity. I'd use (every? identity [false false true]) to do a reduce-and, and I'd use (some identity [false false true]) to do a reduce-or (keeping in mind the latter actually returns nil rather than false). -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
ClassNotfound Exception while loading JAR files in Clojure 1.2
Hi, We have built a web application using grails framework and we use Groovy, Java and Clojure programming languages. We use Clojure 1.2. The clojure files include classes from HTMLUnit. Recently HTMLUnit released a new version of JAR file and we were trying to migrate the web app to new version of HTMLUnit. When we deploy the web app under Jetty (comes with Grails), during the deployment the Clojure code which uses HTMLUnit fails with ClassNotFound Exception. What is the reason for this error and any help or pointers to solve this issue is greatly appreciated. Looking forward to your reply. Regards Vasu -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
The reason and is a macro is that it's designed to short-circuit - ie if the first result is false the rest shouldn't even be evaluated. Using it on raw booleans works, because booleans evaluate to themselves, but it's really designed to be given forms. The absence of a pure function for conjunction is an interesting omission, but BG's lambda fn does the trick. On 22 May 2013 09:16, Mark Engelberg mark.engelb...@gmail.com wrote: Using eval should be a rarity. I'd use (every? identity [false false true]) to do a reduce-and, and I'd use (some identity [false false true]) to do a reduce-or (keeping in mind the latter actually returns nil rather than false). -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Design/structure for a game loop in clojure
Thanks everyone for your replies, in particular: Mikera: Glad to hear we're along the right lines, and thanks for the extra advice. I've found your blog series on Alchemy very helpful while considering this stuff. This game is a little different, and I'm mainly concerned with what's going on server-side, but a lot of the fundamental structure is going to be quite similar I think. Definitely going to take a look at Ironclad too. Gary: Thanks for the link. Funnily enough I spent some time at a previous job putting a component/entity system into the game I was working on at the time with great success, don't know why I didn't think of it this time! I can see how it would work even better with Clojure -- a lot of the problems I had to deal with last time involved each component having mutable state, and what happened when that state was modified out of order... all of which will hopefully go away in Clojure-land. Thanks again, will keep the list posted if I come across anything interesting! -Dani. Mikera (Mon, May 20, 2013 at 08:04:41PM -0700) You've described almost exactly the state update model used in Ironclad: https://github.com/mikera/ironclad I'd strongly suggest taking a look at the Ironclad source if your game is anything vaguely turn-based / strategic. Some comments: - A big, single immutable data structure for the entire game state is the best way to go if you can make it work. I managed this for Ironclad and Alchemy, it might be hard for a FPS though. - For performance, you may need specialised persistent data structures (e.g. Ironclad uses a custom PersistentTreeGrid for maps and unit locations etc.). As part of this, I implemented things like efficient area searches (for nearby entity detection). - You'll need to maintain indexes as part of your immutable data structure (e.g. a map of entity ID to entity location). This is the only real way to avoid expensive traversal of the whole data structure. This is also the way to efficiently process events targeted at a specific entity. - The model of message - [collection of atomic updates] is good. - Keeping a queue of incoming events is also a good idea (probably essential if your game is networked / multiplayer) - I would suggest *decoupling* screen redraw from the game event update loop. One of the big advantages of immutable game state is that it is easy to put rendering on another thread! Same can also apply for AI. - If you want fluid animations resulting from discrete game events, consider doing the animations outside the main game state, e.g. by managing sprites within the rendering engine. It's a bit of a hack, but massively reduces the number of game state updates required for every little position update. Finally, beware of unnecessarily creating/realising sequences - this results in a lot of GC overhead. A common culprit is running a map over a vector for example. Don't do this unless you have to - I ended up writing a bunch of non-allocating data structure traversal functions to avoid this problem (some of these are in https://github.com/mikera/clojure-utils) On Monday, 20 May 2013 09:02:23 UTC+8, Daniel Wright wrote: Hello, I am trying to structure the game loop for a simple game in clojure, trying to keep things pure as far as possible to get a feel for how this would work in a functional environment. Currently, I am working with a message-based system, whereby various events create messages which I then act on to change state. For example: 1. Read keypresses, generate a message for each keypress and add to the queue. 2. Read from the network; add any incoming messages to the queue. 3. Add an update message to the queue which can be used for generic update processing: AI, physics, whatever 4. Go through the entities in my world delivering these messages as appropriate. Keypress and update messages will be processed by any entity that implements a handler for them; network messages may be directed so that they only get sent to a specific entity. (The return value of the functions processing these messages is itself a vector of messages, such as update-state to replace the current state of an entity (position, etc) with a new state, or perhaps a message to send information over the network.) 5. Send any outgoing network messages, perform any state updates, etc. 6. Draw the screen, return to 1 and begin the next game loop. The issue I'm having is that this system results in rather a lot of looping through every entity in the world. There are two full loops, delivering the messages in step 4 and updating the state in step 5. Originally I had the message handlers in step 4 return a new state rather than new messages, so I just updated the entities in-place during the first loop, but I found sometimes I wanted to do
Re: Design/structure for a game loop in clojure
On Wednesday, 22 May 2013 16:46:54 UTC+8, Daniel Wright wrote: Thanks everyone for your replies, in particular: Mikera: Glad to hear we're along the right lines, and thanks for the extra advice. I've found your blog series on Alchemy very helpful while considering this stuff. This game is a little different, and I'm mainly concerned with what's going on server-side, but a lot of the fundamental structure is going to be quite similar I think. Definitely going to take a look at Ironclad too. No worries. Ironclad is much more useful to look at from the server perspective: although it's currently set up as single player, it's been designed to allow multiplayer operation in the future. e.g. map updates have visibility filters so that you only send updates to players that can see the area under consideration. This is one of the advantages of the message - [collection of updates] model. I didn't bother with this extra layer of complexity for Alchemy since it's intrinsically single-player, but my long term plan is to make a split between the Ironclad client and server so it works as a multiplayer strategy game. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: confused on set!
Ah, okay, I see the idea. I'm not sure why it doesn't work. For now, I think, using an atom and reset! seems to do the job! Phil atkaaz atk...@gmail.com writes: The following idea came to me in the shower, sort of out of the blue, and I don't know why I didn't think of it before(I'm disappointed with myself) so, why not use the same thing as clojure does? even though it does it in java, you can do it in clojure, the only thing is that you have to do it once, probably where you define the var, such as(well unfortunately it doesn't work O_o maybe someone can explain?): (I was gonna try java interop but I notice there's * clojure.core/push-thread-bindings*) =* (def ^:dynamic *test4* false)* #'cgws.notcore/*test4* = *(push-thread-bindings {#'*test4* true})* nil = **test4** *false* = (pop-thread-bindings) nil = *test4* false = (def ^:dynamic a 1) #'cgws.notcore/a = (push-thread-bindings {#'a 2}) nil = a 1 = (set! a 3) IllegalStateException Can't change/establish root binding of: a with set clojure.lang.Var.set (Var.java:233) (defn *push-thread-bindings* WARNING: This is a low-level function. Prefer high-level macros like binding where ever possible. Takes a map of Var/value pairs. Binds each Var to the associated value for the current thread. Each call *MUST* be accompanied by a matching call to pop-thread-bindings wrapped in a try-finally! (push-thread-bindings bindings) (try ... (finally (pop-thread-bindings))) {:added 1.1 :static true} [bindings] (clojure.lang.Var/pushThreadBindings bindings)) nil =* *clojure-version** {:interim true, :major 1, :minor* 6*, :incremental 0, :qualifier master} so if this worked as I expected then the following two statements would be in the same place: = (def ^:dynamic *test1*) #'cgws.notcore/*test1* = (push-thread-bindings {#'test1 default value here}) nil ;and the third could be anywhere (in current thread, 'cause just as clojure's *warn-on-reflection* when on a different thread you still can't set! it) = (set! test1 user value) IllegalStateException Can't change/establish root binding of: test1 with set clojure.lang.Var.set (Var.java:233) *So, is **push-thread-bindings broken(unlikely) or am I missing something(most certainly so) ?* On Fri, May 17, 2013 at 6:49 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: Jim jimpil1...@gmail.com writes: On 17/05/13 11:00, Phillip Lord wrote: It's a nice language, I think. It inherits however the some of the nastiness of Java, in particular it doesn't integrate at all into the OS; the makes it not a good fit for little scripting, one-off jobs which form the basis of a lot of scientific computing. aaa yes indeed...the jvm is indeed very heavy-weight for such scripting tasks...on the other hand have you looked at clojure-py? I'm not up-to-date with its current state/features but it should be viable for little scripting jobs... :) Well, I an proficient in python, so it's probably easier just to use python. Even if the documentation sucks. Which gives me the dynamic scoped behaviour, but not the global resetting behaviour. I quickly wrote the following but I get an exception which I don't have the time to sort at the moment...maybe later this evening... :) It's okay! I have a workable solution now, even if it still seems a little unfair that I cannot take the same approach that clojure.core does under the same circumstances! Phil -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For
Re: Design/structure for a game loop in clojure
concurrency-wise, you might find useful Rich Hickey's ants simulation https://github.com/juliangamble/clojure-ants-simulation/ the relevant video where he explains it: https://www.youtube.com/watch?v=dGVqrGmwOAw (if you want the slides too, see in the comments: someone suggested google for Must watch: Clojure concurrency) On Mon, May 20, 2013 at 4:02 AM, Daniel P. Wright d...@dpwright.com wrote: Hello, I am trying to structure the game loop for a simple game in clojure, trying to keep things pure as far as possible to get a feel for how this would work in a functional environment. Currently, I am working with a message-based system, whereby various events create messages which I then act on to change state. For example: 1. Read keypresses, generate a message for each keypress and add to the queue. 2. Read from the network; add any incoming messages to the queue. 3. Add an update message to the queue which can be used for generic update processing: AI, physics, whatever 4. Go through the entities in my world delivering these messages as appropriate. Keypress and update messages will be processed by any entity that implements a handler for them; network messages may be directed so that they only get sent to a specific entity. (The return value of the functions processing these messages is itself a vector of messages, such as update-state to replace the current state of an entity (position, etc) with a new state, or perhaps a message to send information over the network.) 5. Send any outgoing network messages, perform any state updates, etc. 6. Draw the screen, return to 1 and begin the next game loop. The issue I'm having is that this system results in rather a lot of looping through every entity in the world. There are two full loops, delivering the messages in step 4 and updating the state in step 5. Originally I had the message handlers in step 4 return a new state rather than new messages, so I just updated the entities in-place during the first loop, but I found sometimes I wanted to do other things than just update state -- for example send messages over the network, or to another entity in the world. So it seemed more flexible to return messages, even if some of those messages are directed toward the entity sending it. My other issue is that with messages intended to be processed by a particular entity, I can either check that while looping through the whole list of entities (which means for every entity it's not intended for I'm running a wasteful check on the id of a message), or I can put the entities in a map instead of a vector and look them up by some id instead (in which case I'm doing a search for every directed message, on top of the loop I'm already doing through all the entities). I've come from a mostly C++ background, so my sense of when I'm doing something really bad isn't very well-tuned in functional languages at the moment. I write something that feels nice and looks pretty, and then I step back and think about what it's actually *doing* and I can't help but think in C++ this would be unforgivably vile. It seems the more I try to push function purity the more I have to loop through some monolithic data structure holding all of my state, since I can't just pass references around and modify them in-place. Writing the code for the entities themselves is going quite well -- I am keeping their functions pure, not referring to anything outside of the parameters they're passed in, and thus always returning the same result given the same input, and limiting their input to the information they need without giving them access to the entire state of everything -- all of which is great for testing, parallelisation, and all the rest. It's at the higher level of managing the collection of these entities and their relationships that I wonder whether I am working along the right lines or whether I am in some sense doing it wrong. As an aside, right now I am avoiding storing entity state as atoms and having the update functions modify those atoms because although clojure helps update their values safely it still means the function has side effects, and I'm trying to keep functions as pure as possible at least until I can understand the limitations of doing that and see the necessity for using global constructs. I have a feeling this is only going to get more complex as I start wanting to make smaller sub-lists that refer to the same entities. For example my entities may be stored in some tree format in the world state, but I might want to have a list of all enemies within a certain radius or whatever just as a convenience for quick access to those entities I'm interested in. Right now if I updated an entity in this list it would remain not updated in the global state tree... I'm guessing there's no way around holding an atom or similar in both lists and
Re: How to: reduce boolean operations?
On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote: I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? What about the other edge? user= (reduce #(and %1 %2) '(1 true 2)) 2 user= (eval (conj '(1 true 3) 'and)) 3 user= (doc and) - clojure.core/and ([] [x] [x next]) Macro Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true. nil Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
I find the wording of this confusing otherwise it returns the value of the last expr. (and) returns true. I mean, I know it returns the last true value, but that's because I've tested it not because the doc is trying(failing) to tell me so with that phrase. On Wed, May 22, 2013 at 1:28 PM, atkaaz atk...@gmail.com wrote: On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote: I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? What about the other edge? user= (reduce #(and %1 %2) '(1 true 2)) 2 user= (eval (conj '(1 true 3) 'and)) 3 user= (doc and) - clojure.core/and ([] [x] [x next]) Macro Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true. nil Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
On May 22, 2013 5:35 AM, atkaaz atk...@gmail.com wrote: I find the wording of this confusing otherwise it returns the value of the last expr. (and) returns true. I mean, I know it returns the last true value, but that's because I've tested it not because the doc is trying(failing) to tell me so with that phrase. The next-to-last sentence describes the behavior you're talking about. The last sentence is addressing the no-args case. Starting a sentence with a parenthesized form makes it hard to read. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[ANN] tawny-owl 0.11
I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Oh i see now, thank you! so it's like this: otherwise it returns the value of the last expression. (and) returns true. i though expr. is the short for of the word expression which requires a dot, but the dot was in fact an end of sentence. On Wed, May 22, 2013 at 2:40 PM, John D. Hume duelin.mark...@gmail.comwrote: On May 22, 2013 5:35 AM, atkaaz atk...@gmail.com wrote: I find the wording of this confusing otherwise it returns the value of the last expr. (and) returns true. I mean, I know it returns the last true value, but that's because I've tested it not because the doc is trying(failing) to tell me so with that phrase. The next-to-last sentence describes the behavior you're talking about. The last sentence is addressing the no-args case. Starting a sentence with a parenthesized form makes it hard to read. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases everything that can be done ? though that might be too much to ask, or perhaps suggest a link url to something that might help (me) understand ? Thanks. On Wed, May 22, 2013 at 2:41 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: asm-based clojure yet?
One more thought on the broader ideas of LISPy languages and ASM. One of the versions of Crash Bandicoot was developed in Game Oriented Assembly LISP (GOAL) - which was a common LISP DSL that generated assembler. I recalled this today because Michael Fogus tweeted about it: https://twitter.com/fogus/status/336865798628966400 If you're a hobbyist dabbling in this space then you might find reading about it interesting and inspiring: http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp http://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9/ JG On Sunday, 19 May 2013 01:49:43 UTC+10, Gary Trakhman wrote: It's hard to really appreciate java and clojure until you actually write some C/C++ or ASM.. I have some minor experience with that stuff, and it still haunts me from time to time. Sometimes we make tradeoffs without knowing we did. By choosing a language, or having the choice made for us, we accept a set of abstractions as our bottom level of thinking for a problem-space. Only old-timers and people that make a point to care about low-level stuff will notice the implications of what they're doing along the abstraction stack. People with ingrained habits just won't find it easy to think functionally, but I'm young and irreverent, so it doesn't bother me :-). C++ is fun because of all the bolted-on kludges that 'mitigate' these problems. You can use operator-overloading on pointer operations to perform automatic reference counting, deallocating objects when things that point to them go out of scope, but I think implementing a PersistentHashMap this way would be very difficult. Also, pretty sure it can't handle cycles. I guess the point is, I appreciate any effort to understand such issues, it's been a useful thing for me to know in the 0.05% of time that knowledge is needed. But, people who don't know just won't be able to get past those problems. And, you generally can't easily find a _really_ full-stack guy to glance at it for you when it would be useful to have one. On Sat, May 18, 2013 at 11:24 AM, atkaaz atk...@gmail.com javascript:wrote: your comment caused me to be reading this http://prog21.dadgum.com/134.html (at least) On Sat, May 18, 2013 at 6:17 PM, Gary Trakhman gary.t...@gmail.comjavascript: wrote: Immutability, persistence, closures without a serious garbage collector sounds hard. On Sat, May 18, 2013 at 1:09 AM, atkaaz atk...@gmail.com javascript:wrote: Thanks very much everyone! I'm looking into all of those, but currently planning to read Julian's pdf. I didn't want to say anything until I had something definite, but just letting y'all know that I'm considering each recommendation. On Sat, May 18, 2013 at 7:12 AM, Julian julian...@gmail.comjavascript: wrote: If you had a hobbyist interest in representing S-expressions in assembler - then you could take a look at the tutorial written by Abdulaziz Ghuloum called Compilers: Backend to Frontend and Back to Front Again. It used to be available here: http://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-09-16.pdf I don't know if it available anywhere else on the internet - but I grabbed another copy and put it here: https://sites.google.com/site/juliangamble/Home/Compilers%20Tutorial%202006-09-16.pdf?attredirects=0d=1 For a more serious representation of Clojure's persistent data structures, I don't recommend trying to implement them in ASM. Cheers Julian On Friday, 17 May 2013 22:06:45 UTC+10, Alan D. Salewski wrote: On Fri, May 17, 2013 at 02:10:02PM +0300, atkaaz spake thus: Ok, weird question: is there some clojure port on assembler yet? Even if(/especially if) it doesn't have jvm/java/javalibs support Or should I just check https://github.com/clojure/**clojure-clrhttps://github.com/clojure/clojure-clr? I'm mainly interested in low memory footprint and fast startup times (does clojure-clr have that?) You may want to check out ClojureScript, too. ClojureScript programs leveraging nodejs for host interop have fast startup times: https://github.com/clojure/**clojurescript/wikihttps://github.com/clojure/clojurescript/wiki -- --**--**- a l a n d. s a l e w s k i sale...@att.net 1024D/FA2C3588 EDFA 195F EDF1 0933 1002 6396 7C92 5CB3 FA2C 3588 --**--**- -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Compiling the Android version of Clojure
My aim is to enable Clojure programming directly on an Android device.. so, as I understand, I can use lein-droid to make the pre-compiled JAR to work on the device? I seen Clojure 1.4.0 REPL for Android and I wanted to get the compiler itself, preferably for 1.5.1, so that I can integrate it into my program... I dont't know, though, how well will Clojure's dynamic bytecode generation work with Dalvik... среда, 22 мая 2013 г., 1:39:43 UTC+4 пользователь Daniel Solano Gómez написал: Hello, I use Maven to build the Clojure/Android port, so I don't know whethter the Ant build instructions work or how to adapt them to Windows. Is there a reason you need to build from source? If not, then using lein-droid or getting the JAR directly from Clojars is probably an easier way to go. Sincerely, Daniel On Wed May 22 05:25 2013, Kelker Ryan wrote: What's wrong with the lein-droid plugin? https://github.com/clojure-android/lein-droid � 22.05.2013, 05:21, Alex Fowler alex.m...@gmail.com javascript:: Nope, I am on Windows :D.. I guess I could re-write this one into a *.bat file... �looking inside the file, however, does not give me a clue on how it will help me aside from that maybe maven will somehow manage to reolve the deps... On Wed, May 22, 2013 at 12:18 AM, Kelker Ryan [1]thein...@yandex.com javascript: wrote: Did you run ./antsetup.sh before trying to build with ant? � 22.05.2013, 05:01, Alex Fowler [2]alex.m...@gmail.comjavascript:: Nope, the installation instruction in the readme of the project says nothing about this one (i'm a newb to android development). So if I download it, where I put it? On Tue, May 21, 2013 at 11:59 PM, Kelker Ryan [3]thein...@yandex.com javascript: wrote: Did you download the Android JAR? [4]http://www.java2s.com/Code/Jar/a/Downloadandroid32jar.htm 22.05.2013, 04:52, Alex Fowler [5]alex.m...@gmail.comjavascript:: I'm trying to build this project:�[6]https://github.com/clojure-android/clojure�with ant command. It sarts working, but I get this output with errors: Buildfile: C:\Users\Admin\Downloads\clojure-android\clojure-android\build.xml clean: � �[delete] Deleting directory C:\Users\Admin\Downloads\clojure-android\clojure- android\target init: � � [mkdir] Created dir: C:\Users\Admin\Downloads\clojure-android\clojure-androi d\target\classes � � [mkdir] Created dir: C:\Users\Admin\Downloads\clojure-android\clojure-androi d\target\classes\clojure compile-java: � � [javac] Compiling 483 source files to C:\Users\Admin\Downloads\clojure-andro id\clojure-android\target\classes � � [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5 � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:13: error: package android.util does not �exist � � [javac] import android.util.Log; � � [javac] � � � � � � � � � �^ � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:17: error: package dalvik.system does no t exist � � [javac] import dalvik.system.DexFile; � � [javac] � � � � � � � � � � ^ � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:45: error: package android.os.Build does �not exist � � [javac] � � DEX_OPTIONS.targetApiLevel = android.os.Build.VERSION.SDK_INT; � � [javac] � � � � � � � � � � � � � � � � � � � � � � � � �^ � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:99: error: cannot find symbol � � [javac] � � � � � � final DexFile inDexFile = DexFile.loadDex(jarPath, dexPa th, 0); � � [javac] � � � � � � � � � ^ � � [javac] � symbol: � class DexFile � � [javac] � location: class DalvikDynamicClassLoader � � [javac]
Re: asm-based clojure yet?
thank you very much, my search has lead me to seeking a lisp that could compile to machine code (mainly because i cannot accept the 20-22 sec `lein repl` startup time and eclipse/ccw memory consumptions - so I was hoping for something fast even though the cost is portability and all else) On Wed, May 22, 2013 at 3:10 PM, Julian juliangam...@gmail.com wrote: One more thought on the broader ideas of LISPy languages and ASM. One of the versions of Crash Bandicoot was developed in Game Oriented Assembly LISP (GOAL) - which was a common LISP DSL that generated assembler. I recalled this today because Michael Fogus tweeted about it: https://twitter.com/fogus/status/336865798628966400 If you're a hobbyist dabbling in this space then you might find reading about it interesting and inspiring: http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp http://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9/ JG On Sunday, 19 May 2013 01:49:43 UTC+10, Gary Trakhman wrote: It's hard to really appreciate java and clojure until you actually write some C/C++ or ASM.. I have some minor experience with that stuff, and it still haunts me from time to time. Sometimes we make tradeoffs without knowing we did. By choosing a language, or having the choice made for us, we accept a set of abstractions as our bottom level of thinking for a problem-space. Only old-timers and people that make a point to care about low-level stuff will notice the implications of what they're doing along the abstraction stack. People with ingrained habits just won't find it easy to think functionally, but I'm young and irreverent, so it doesn't bother me :-). C++ is fun because of all the bolted-on kludges that 'mitigate' these problems. You can use operator-overloading on pointer operations to perform automatic reference counting, deallocating objects when things that point to them go out of scope, but I think implementing a PersistentHashMap this way would be very difficult. Also, pretty sure it can't handle cycles. I guess the point is, I appreciate any effort to understand such issues, it's been a useful thing for me to know in the 0.05% of time that knowledge is needed. But, people who don't know just won't be able to get past those problems. And, you generally can't easily find a _really_ full-stack guy to glance at it for you when it would be useful to have one. On Sat, May 18, 2013 at 11:24 AM, atkaaz atk...@gmail.com wrote: your comment caused me to be reading this http://prog21.dadgum.com/134.* *html http://prog21.dadgum.com/134.html (at least) On Sat, May 18, 2013 at 6:17 PM, Gary Trakhman gary.t...@gmail.comwrote: Immutability, persistence, closures without a serious garbage collector sounds hard. On Sat, May 18, 2013 at 1:09 AM, atkaaz atk...@gmail.com wrote: Thanks very much everyone! I'm looking into all of those, but currently planning to read Julian's pdf. I didn't want to say anything until I had something definite, but just letting y'all know that I'm considering each recommendation. On Sat, May 18, 2013 at 7:12 AM, Julian julian...@gmail.com wrote: If you had a hobbyist interest in representing S-expressions in assembler - then you could take a look at the tutorial written by Abdulaziz Ghuloum called Compilers: Backend to Frontend and Back to Front Again. It used to be available here: http://www.cs.indiana.** edu/~aghuloum/compilers-**tutorial-2006-09-16.pdfhttp://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-09-16.pdf I don't know if it available anywhere else on the internet - but I grabbed another copy and put it here: https://sites.google.** com/site/juliangamble/Home/**Compilers%20Tutorial%202006-** 09-16.pdf?attredirects=0d=1https://sites.google.com/site/juliangamble/Home/Compilers%20Tutorial%202006-09-16.pdf?attredirects=0d=1 For a more serious representation of Clojure's persistent data structures, I don't recommend trying to implement them in ASM. Cheers Julian On Friday, 17 May 2013 22:06:45 UTC+10, Alan D. Salewski wrote: On Fri, May 17, 2013 at 02:10:02PM +0300, atkaaz spake thus: Ok, weird question: is there some clojure port on assembler yet? Even if(/especially if) it doesn't have jvm/java/javalibs support Or should I just check https://github.com/clojure/**clo**jure-clrhttps://github.com/clojure/clojure-clr? I'm mainly interested in low memory footprint and fast startup times (does clojure-clr have that?) You may want to check out ClojureScript, too. ClojureScript programs leveraging nodejs for host interop have fast startup times: https://github.com/clojure/**clo**jurescript/wikihttps://github.com/clojure/clojurescript/wiki -- ----- a l a n d. s a l e w s k i sale...@att.net 1024D/FA2C3588 EDFA 195F EDF1 0933 1002 6396 7C92 5CB3 FA2C 3588
Re: How to: reduce boolean operations?
On 22 May 2013 08:09, Baishampayan Ghose b.gh...@gmail.com wrote: Using a lambda seems to be a sane approach - (reduce #(and %1 %2) '(false false true)) ;= false Note that this will always traverse the entire input collection, whereas every? stops at the first false value. Same thing goes for reducing with #(or %1 %2) vs. using some. Cheers, Michał On Wed, May 22, 2013 at 5:36 AM, Peter Mancini pe...@cicayda.com wrote: OK long time lurker here. I've been growing in my Clojure strength for a while now. For the most part I think I get it and I have no problem getting programs to do what I want. However, sometimes I get stumped. I have one function that produces a list of booleans like '(false false true). It seemed to me that this should be legal: (reduce and '(false false true)) However that is not legal with the complaint being something about and being a macro. :-/ I did get it to work with: (eval (conj '(false false true) 'and)) It works but is it correct? Is it what you would do? I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
I went looking for the same thing. There are a few partial examples in the docs directory that might be worth looking at. On Wed, May 22, 2013 at 8:06 AM, atkaaz atk...@gmail.com wrote: For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases everything that can be done ? though that might be too much to ask, or perhaps suggest a link url to something that might help (me) understand ? Thanks. On Wed, May 22, 2013 at 2:41 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. In this setting, an ontology is essentially a set of facts, that you can test with a computational reasoner; so, it's something like logic programming. I don't implement the reasoner -- someone else has done that (in fact there are several). These reasoners can scale up to 100'000s of terms. My example Pizza ontology shows it in use. https://github.com/phillord/tawny-pizza So, you can make statements like (defclass CheesyPizza :equivalent (owland Pizza (owlsome hasTopping CheeseTopping))) and (defclass MozzarellaTopping :subclass CheeseTopping) and finally, (defclass MargheritaPizza :subclass (someonly hasTopping CheeseTopping TomatoTopping)) and the reasoner will work out that MargheritaPizza is a CheesyPizza. In itself, this is simple, but you can build up more complex classes like so. (defclass VegetarianPizza :equivalent (owland Pizza (owlnot (owlsome hasTopping MeatTopping)) (owlnot (owlsome hasTopping FishTopping (defclass NonVegetarianPizza :equivalent (owland Pizza (owlnot VegetarianPizza))) Of course, really takes flight when you have large ontologies. FMA which models human anatomy, has I think, about 100,000 terms. SNOMED (ways you can get ill) has millions. Now there are lots of tools for building these; the novelty with tawny is that the raw syntax is relatively simple (most of tawny-pizza does not look like a programming language), but it is entirely programmatic; so, it is possible to automate, build patterns, and integrate with external infrastructure all in one place. I think that this is going to be very useful, but we shall see! While I am interested in biomedical and scientific ontologies, there are lots of other applications. Probably the most famous one at the moment is Siri (the iphone thingy) which is ontological powered underneath. There are quite a few articles, varying in scope on ontologies on ontogenesis http://ontogenesis.knowledgeblog.org. It is a very valid point, though. I should write some documentation on ontologies for programmers. I shall work on it! Phil atkaaz atk...@gmail.com writes: For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases everything that can be done ? though that might be too much to ask, or perhaps suggest a link url to something that might help (me) understand ? Thanks. On Wed, May 22, 2013 at 2:41 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- -- You received this message because you are subscribed to the Google
Re: [ANN] tawny-owl 0.11
Thank you very much for this! I find it very interesting, I shall keep reading On Wed, May 22, 2013 at 4:24 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. In this setting, an ontology is essentially a set of facts, that you can test with a computational reasoner; so, it's something like logic programming. I don't implement the reasoner -- someone else has done that (in fact there are several). These reasoners can scale up to 100'000s of terms. My example Pizza ontology shows it in use. https://github.com/phillord/tawny-pizza So, you can make statements like (defclass CheesyPizza :equivalent (owland Pizza (owlsome hasTopping CheeseTopping))) and (defclass MozzarellaTopping :subclass CheeseTopping) and finally, (defclass MargheritaPizza :subclass (someonly hasTopping CheeseTopping TomatoTopping)) and the reasoner will work out that MargheritaPizza is a CheesyPizza. In itself, this is simple, but you can build up more complex classes like so. (defclass VegetarianPizza :equivalent (owland Pizza (owlnot (owlsome hasTopping MeatTopping)) (owlnot (owlsome hasTopping FishTopping (defclass NonVegetarianPizza :equivalent (owland Pizza (owlnot VegetarianPizza))) Of course, really takes flight when you have large ontologies. FMA which models human anatomy, has I think, about 100,000 terms. SNOMED (ways you can get ill) has millions. Now there are lots of tools for building these; the novelty with tawny is that the raw syntax is relatively simple (most of tawny-pizza does not look like a programming language), but it is entirely programmatic; so, it is possible to automate, build patterns, and integrate with external infrastructure all in one place. I think that this is going to be very useful, but we shall see! While I am interested in biomedical and scientific ontologies, there are lots of other applications. Probably the most famous one at the moment is Siri (the iphone thingy) which is ontological powered underneath. There are quite a few articles, varying in scope on ontologies on ontogenesis http://ontogenesis.knowledgeblog.org. It is a very valid point, though. I should write some documentation on ontologies for programmers. I shall work on it! Phil atkaaz atk...@gmail.com writes: For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases everything that can be done ? though that might be too much to ask, or perhaps suggest a link url to something that might help (me) understand ? Thanks. On Wed, May 22, 2013 at 2:41 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing
Time complexity of operations on collections
I'm studying for an interview and thought it might be nice to know the time complexity of primitive operations on collections in Clojure. A quick googling didn't turn up a definitive resource. I would be happy to put one together. What I had in mind was something like: Collections: strings, sets, maps, Java arrays, lists, vectors Operations: peek, pop, conj, cons, assoc/dissoc, get, nth, count What I have in mind is to fill out this table with the appropriate average big-O (my *guesses* from googling/experimenting/thinking are entered, and may be completely wrong!; sorry for any formatting problems due to varying type styles, perhaps I should have used s-expressions :-) - should be OK with fixed width font): Collection getnth cons conj assoc pop peek count List 1? 1? 1 1 X 11 1 Vector 11? n 1 1?11 1 Set 1X 11X XX 1? Map 1X 1 1? 1?XX 1? String1 1 n X X XX 1 Java Array1 1 n X X XX 1 Where O(1) is really O(log_{32}(n)), effectively constant time as opposed to true O(1). X obviously means you can't do the operation on that type. Some operations involve casting e.g. a string to a seq; I assume O(n) in that case (?). (It's probably obvious to everyone else, but it's cool that there are so few 'n's in the table.) Any corrections, operations to add, data structures to add? I imagine between all the readers of the list, correcting this table will be trivial. I am happy to post the resulting table on my blog or anywhere else. Thanks! John -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
Would you say that ontologies can be modeled on top of graphs? so in a way they can be seen as a specific use case for graphs? (maybe directed acyclic graphs), that's what I am getting the sense of so far On Wed, May 22, 2013 at 4:47 PM, atkaaz atk...@gmail.com wrote: Thank you very much for this! I find it very interesting, I shall keep reading On Wed, May 22, 2013 at 4:24 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. In this setting, an ontology is essentially a set of facts, that you can test with a computational reasoner; so, it's something like logic programming. I don't implement the reasoner -- someone else has done that (in fact there are several). These reasoners can scale up to 100'000s of terms. My example Pizza ontology shows it in use. https://github.com/phillord/tawny-pizza So, you can make statements like (defclass CheesyPizza :equivalent (owland Pizza (owlsome hasTopping CheeseTopping))) and (defclass MozzarellaTopping :subclass CheeseTopping) and finally, (defclass MargheritaPizza :subclass (someonly hasTopping CheeseTopping TomatoTopping)) and the reasoner will work out that MargheritaPizza is a CheesyPizza. In itself, this is simple, but you can build up more complex classes like so. (defclass VegetarianPizza :equivalent (owland Pizza (owlnot (owlsome hasTopping MeatTopping)) (owlnot (owlsome hasTopping FishTopping (defclass NonVegetarianPizza :equivalent (owland Pizza (owlnot VegetarianPizza))) Of course, really takes flight when you have large ontologies. FMA which models human anatomy, has I think, about 100,000 terms. SNOMED (ways you can get ill) has millions. Now there are lots of tools for building these; the novelty with tawny is that the raw syntax is relatively simple (most of tawny-pizza does not look like a programming language), but it is entirely programmatic; so, it is possible to automate, build patterns, and integrate with external infrastructure all in one place. I think that this is going to be very useful, but we shall see! While I am interested in biomedical and scientific ontologies, there are lots of other applications. Probably the most famous one at the moment is Siri (the iphone thingy) which is ontological powered underneath. There are quite a few articles, varying in scope on ontologies on ontogenesis http://ontogenesis.knowledgeblog.org. It is a very valid point, though. I should write some documentation on ontologies for programmers. I shall work on it! Phil atkaaz atk...@gmail.com writes: For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases everything that can be done ? though that might be too much to ask, or perhaps suggest a link url to something that might help (me) understand ? Thanks. On Wed, May 22, 2013 at 2:41 PM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies in a fully programmatic environment, namely Clojure. This means the user can take advantage of programmatic language to automate and abstract the ontology over the development process; also, rather than requiring the creation of ontology specific development environments, a normal programming IDE can be used; finally, a human readable text format means that we can integrate with the standard tooling for versioning and distributed development. Changes === # 0.11 ## New features - facts on individual are now supported - documentation has been greatly extended - OWL API 3.4.4 A new paper on the motivation and use cases for tawny-owl is also available at http://www.russet.org.uk/blog/2366 https://github.com/phillord/tawny-owl Feedback welcome! -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to
Re: Time complexity of operations on collections
A few corrections: Lists are single linked lists, so nth on them (as well as last) is O(n). Get on lists is unsupported. Cons on a vector is O(1) since cons converts things to seqs (O(1)) before constructing the cons. Count on everything but Cons and LazySeq is O(1). For those two it's O(n) until it hits something in the list that implements Counted (normally PersistentList), then it's O(1) from there on. You might want to list Cons/LazySeq separate from PersistentList for this reason. So, cons on a String. That's a interesting question. Cons on anything is O(1). For a string it's the cost of creating a StringSeq on the Java String, then creating a Cons cell who's next pointer references the StringSeq. So that's O(1). But you're now left with a seq, not a string. If you're looking for something like this (str c bar) then yes, that is O(n). Timothy On Wed, May 22, 2013 at 8:05 AM, John Jacobsen eigenhom...@gmail.comwrote: I'm studying for an interview and thought it might be nice to know the time complexity of primitive operations on collections in Clojure. A quick googling didn't turn up a definitive resource. I would be happy to put one together. What I had in mind was something like: Collections: strings, sets, maps, Java arrays, lists, vectors Operations: peek, pop, conj, cons, assoc/dissoc, get, nth, count What I have in mind is to fill out this table with the appropriate average big-O (my *guesses* from googling/experimenting/thinking are entered, and may be completely wrong!; sorry for any formatting problems due to varying type styles, perhaps I should have used s-expressions :-) - should be OK with fixed width font): Collection getnth cons conj assoc pop peek count List 1? 1? 1 1 X 11 1 Vector 11? n 1 1?11 1 Set 1X 11X XX 1? Map 1X 1 1? 1?XX 1? String1 1 n X X XX 1 Java Array1 1 n X X XX 1 Where O(1) is really O(log_{32}(n)), effectively constant time as opposed to true O(1). X obviously means you can't do the operation on that type. Some operations involve casting e.g. a string to a seq; I assume O(n) in that case (?). (It's probably obvious to everyone else, but it's cool that there are so few 'n's in the table.) Any corrections, operations to add, data structures to add? I imagine between all the readers of the list, correcting this table will be trivial. I am happy to post the resulting table on my blog or anywhere else. Thanks! John -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Time complexity of operations on collections
I should probably also have added sorted-map to the table, though the complexity for each operation is less clear to me. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
On 22/05/13 15:11, atkaaz wrote: Would you say that ontologies can be modeled on top of graphs? so in a way they can be seen as a specific use case for graphs? (maybe directed acyclic graphs), that's what I am getting the sense of so far I am certainly not an ontology guru but I can confirm that what you describe is sort of valid...Ontologies will indeed help you find predicate-argument structures of the form subject-predicate-object (i.e John likes pizza), but in order to do that you have to build the domain-specific ontology first! But there is another way to get the same information via deep-parsing. A syntactic parser like stanford's or enju will give you back the nodes (tokens) and their dependencies (relations). You can shove that into a (directed acyclic) graph structure and you're ready to query/navigate it as you like... Jim -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Thanks everyone for the help. The nil behavior of the 'or' version breaks what I wanted, but I may create functions that return just true or false though the odd edge case where and will return a value will mean I'll have to handle that. My preference would be to throw an exception but thats another cultural question about the language. What is prefered - throwing the last value or failing when not given correct input? Ok now on to implementation. Thanks! On Wednesday, May 22, 2013 7:38:17 AM UTC-5, Michał Marczyk wrote: On 22 May 2013 08:09, Baishampayan Ghose b.g...@gmail.com javascript: wrote: Using a lambda seems to be a sane approach - (reduce #(and %1 %2) '(false false true)) ;= false Note that this will always traverse the entire input collection, whereas every? stops at the first false value. Same thing goes for reducing with #(or %1 %2) vs. using some. Cheers, Michał On Wed, May 22, 2013 at 5:36 AM, Peter Mancini pe...@cicayda.comjavascript: wrote: OK long time lurker here. I've been growing in my Clojure strength for a while now. For the most part I think I get it and I have no problem getting programs to do what I want. However, sometimes I get stumped. I have one function that produces a list of booleans like '(false false true). It seemed to me that this should be legal: (reduce and '(false false true)) However that is not legal with the complaint being something about and being a macro. :-/ I did get it to work with: (eval (conj '(false false true) 'and)) It works but is it correct? Is it what you would do? I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
On 22/05/13 15:54, Peter Mancini wrote: The nil behavior of the 'or' version breaks what I wanted, but I may create functions that return just true or false though the odd edge case where and will return a value will mean I'll have to handle that. wrap that call in a 'boolean' call (e.g. (boolean (or ...))) and you got your true/false result :) Jim -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: ClassNotfound Exception while loading JAR files in Clojure 1.2
You'll need to provide more details about exactly which Clojure JARs you use and the stack trace for the exception (at least telling us which class is not found and enough of the stack trace for us to see where the reference is coming from). My suspicion is you're using the Clojure 1.2 contrib library and something in there refers to a now defunct class from HTMLUnit? It's worth noting that the monolithic contrib library is no longer maintained so you won't get any updates to that. Instead, as part of the move to Clojure 1.3 (a couple of years back), the parts of contrib that actually had maintainers were moved into new libraries, updated individually. Many of them are still compatible with Clojure 1.2 but a lot of the parts of the original contrib were abandoned for a number of reasons. Sean On Tue, May 21, 2013 at 11:25 PM, vcoman...@gmail.com wrote: Hi, We have built a web application using grails framework and we use Groovy, Java and Clojure programming languages. We use Clojure 1.2. The clojure files include classes from HTMLUnit. Recently HTMLUnit released a new version of JAR file and we were trying to migrate the web app to new version of HTMLUnit. When we deploy the web app under Jetty (comes with Grails), during the deployment the Clojure code which uses HTMLUnit fails with ClassNotFound Exception. What is the reason for this error and any help or pointers to solve this issue is greatly appreciated. Looking forward to your reply. Regards Vasu -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Time complexity of operations on collections
You might also want to switch cons to conj. This is a super ugly part of the Java api that no one really ever sees. PersistentVector.cons is actually called by clojure.core/conj. clojure.core/cons is something else completely. When talking about how the java code performs it might be best to specify which one you mean. Yes it's confusing, I'm sure there is a historical reason for it. Timothy On Wed, May 22, 2013 at 8:24 AM, John Jacobsen eigenhom...@gmail.comwrote: I should probably also have added sorted-map to the table, though the complexity for each operation is less clear to me. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: ClassNotfound Exception while loading JAR files in Clojure 1.2
Hi Sean, Thanks for your reply. I use Clojure.Jar version 1.2.0 and the contrib.jar is also the same version. Copied below is the stack trace of the Error: Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement (agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4800) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:544) at clojure.core$use.doInvoke(core.clj:4880) at clojure.lang.RestFn.invoke(RestFn.java:458) at nlplabs.webfetch.lib.dgeneral$eval780$loading__4410__auto781.invoke(dgeneral.clj:1) at nlplabs.webfetch.lib.dgeneral$eval780.invoke(dgeneral.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4804) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:542) at clojure.core$require.doInvoke(core.clj:4869) at clojure.lang.RestFn.invoke(RestFn.java:409) at nlplabs.webfetch.lib$eval776.invoke(lib.clj:35) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5414) at clojure.lang.Compiler.load(Compiler.java:5857) at com.nlplabs.util.GClojure.load(GClojure.java:41) at com.nlplabs.util.GClojure.loadExtractorLib(GClojure.java:32) at com.nlplabs.util.GClojure$loadExtractorLib.call(Unknown Source) at com.nlplabs.lf.protocols.WEBProtocol.clinit(WEBProtocol.groovy:19) ... 27 more Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at nlplabs.webfetch.agent$eval786$loading__4410__auto787.invoke(agent.clj:1) at nlplabs.webfetch.agent$eval786.invoke(agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) ... 74 more Caused by: java.lang.ClassNotFoundException: com.gargoylesoftware.htmlunit.html.BaseFrameElement at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 79 more Server running. Browse to http://localhost:8080/jlfr Copied below is the code snippet of agent.clj which has the import statement. *** (ns nlplabs.webfetch.agent (:refer-clojure) (:use nlplabs.lib nlplabs.webfetch.scheduler nlplabs.webfetch.util clojure.contrib.str-utils) (:import (com.gargoylesoftware.htmlunit BrowserVersion Page JavaScriptPage UnexpectedPage TextPage WebClient MockWebConnection History) .. )) The error comes when it tries to load WebClient Class. WebClient.java imports
Re: ClassNotfound Exception while loading JAR files in Clojure 1.2
I'll be more blunt than Sean was :-) Is there a reason why you *must* use Clojure 1.2? If so, what is it? If there isn't such a reason, you will likely get much better support from other Clojure users if you use Clojure 1.4 or 1.5.1 (1.5.1 was released a couple of months ago, so many are still using Clojure 1.4, and relatively few are using 1.3). Andy On Wed, May 22, 2013 at 8:20 AM, vcoman...@gmail.com wrote: Hi Sean, Thanks for your reply. I use Clojure.Jar version 1.2.0 and the contrib.jar is also the same version. Copied below is the stack trace of the Error: Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement (agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4800) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:544) at clojure.core$use.doInvoke(core.clj:4880) at clojure.lang.RestFn.invoke(RestFn.java:458) at nlplabs.webfetch.lib.dgeneral$eval780$loading__4410__auto781.invoke(dgeneral.clj:1) at nlplabs.webfetch.lib.dgeneral$eval780.invoke(dgeneral.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4804) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:542) at clojure.core$require.doInvoke(core.clj:4869) at clojure.lang.RestFn.invoke(RestFn.java:409) at nlplabs.webfetch.lib$eval776.invoke(lib.clj:35) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5414) at clojure.lang.Compiler.load(Compiler.java:5857) at com.nlplabs.util.GClojure.load(GClojure.java:41) at com.nlplabs.util.GClojure.loadExtractorLib(GClojure.java:32) at com.nlplabs.util.GClojure$loadExtractorLib.call(Unknown Source) at com.nlplabs.lf.protocols.WEBProtocol.clinit(WEBProtocol.groovy:19) ... 27 more Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at nlplabs.webfetch.agent$eval786$loading__4410__auto787.invoke(agent.clj:1) at nlplabs.webfetch.agent$eval786.invoke(agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) ... 74 more Caused by: java.lang.ClassNotFoundException: com.gargoylesoftware.htmlunit.html.BaseFrameElement at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 79 more Server running. Browse to http://localhost:8080/jlfr Copied below is the code snippet of agent.clj which has the import statement. *** (ns nlplabs.webfetch.agent (:refer-clojure) (:use nlplabs.lib nlplabs.webfetch.scheduler nlplabs.webfetch.util clojure.contrib.str-utils) (:import (com.gargoylesoftware.htmlunit BrowserVersion
Re: ClassNotfound Exception while loading JAR files in Clojure 1.2
Hi Andy, I inherited the code written by some one who is no longer with us. First, I would like to migrate to new version of HTMLUnit and then look at migrating the clojure to the new version. Regards Vasu On Wednesday, May 22, 2013 9:03:03 PM UTC+5:30, Andy Fingerhut wrote: I'll be more blunt than Sean was :-) Is there a reason why you *must* use Clojure 1.2? If so, what is it? If there isn't such a reason, you will likely get much better support from other Clojure users if you use Clojure 1.4 or 1.5.1 (1.5.1 was released a couple of months ago, so many are still using Clojure 1.4, and relatively few are using 1.3). Andy On Wed, May 22, 2013 at 8:20 AM, vcom...@gmail.com javascript: wrote: Hi Sean, Thanks for your reply. I use Clojure.Jar version 1.2.0 and the contrib.jar is also the same version. Copied below is the stack trace of the Error: Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement (agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4800) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:544) at clojure.core$use.doInvoke(core.clj:4880) at clojure.lang.RestFn.invoke(RestFn.java:458) at nlplabs.webfetch.lib.dgeneral$eval780$loading__4410__auto781.invoke(dgeneral.clj:1) at nlplabs.webfetch.lib.dgeneral$eval780.invoke(dgeneral.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.load(Compiler.java:5857) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lang.RT.load(RT.java:409) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4804) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:542) at clojure.core$require.doInvoke(core.clj:4869) at clojure.lang.RestFn.invoke(RestFn.java:409) at nlplabs.webfetch.lib$eval776.invoke(lib.clj:35) at clojure.lang.Compiler.eval(Compiler.java:5424) at clojure.lang.Compiler.eval(Compiler.java:5414) at clojure.lang.Compiler.load(Compiler.java:5857) at com.nlplabs.util.GClojure.load(GClojure.java:41) at com.nlplabs.util.GClojure.loadExtractorLib(GClojure.java:32) at com.nlplabs.util.GClojure$loadExtractorLib.call(Unknown Source) at com.nlplabs.lf.protocols.WEBProtocol.clinit(WEBProtocol.groovy:19) ... 27 more Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/html/BaseFrameElement at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at nlplabs.webfetch.agent$eval786$loading__4410__auto787.invoke(agent.clj:1) at nlplabs.webfetch.agent$eval786.invoke(agent.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5424) ... 74 more Caused by: java.lang.ClassNotFoundException: com.gargoylesoftware.htmlunit.html.BaseFrameElement at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 79 more Server running. Browse to http://localhost:8080/jlfr Copied below is the code
Re: asm-based clojure yet?
On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote: thank you very much, my search has lead me to seeking a lisp that could compile to machine code (mainly because i cannot accept the 20-22 sec `lein repl` startup time and eclipse/ccw memory consumptions - so I was hoping for something fast even though the cost is portability and all else) The above strikes me as a slightly odd statement. Eclipse/CCW or lein repl startup times should be irrelevant because you should only be incurring them once, when starting a development session. Sure, Eclipse eats memory too, but again this is only a development time issue and your dev machine should have plenty, right? In production, running the packaged .jar file should be pretty quick and much more lightweight. JVM startup is less than 0.1sec nowadays, so you can get a splash screen or basic GUI up in front of a user almost immediately. That only leaves the time required to compile and initialise Clojure itself and your application code - maybe 5 secs or so for a reasonably sized app. If you are smart you can do quite a lot of work lazily / in the background so the user doesn't even notice I can certainly see some uses for a Clojure-to-assembler compiler, but only in very specialised areas (embedded devices, realtime systems etc.). For general purpose application development I think it's probably going to be more trouble than it is worth. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Well, excepts that it is not correct. It will return false when really there was a faulty collection handed to it. I'd rather catch an error like that than to pretend it didn't happen and give a result that isn't correct while also being hard to detect. If you can guarantee it won't get a bad collection then the test and exception aren't needed. Its an interesting problem - especially when you are writing mission critical code. On Wednesday, May 22, 2013 9:55:38 AM UTC-5, Jim foo.bar wrote: On 22/05/13 15:54, Peter Mancini wrote: The nil behavior of the 'or' version breaks what I wanted, but I may create functions that return just true or false though the odd edge case where and will return a value will mean I'll have to handle that. wrap that call in a 'boolean' call (e.g. (boolean (or ...))) and you got your true/false result :) Jim -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
On Wed, May 22, 2013 at 12:14 AM, Chris Ford christophertf...@gmail.comwrote: The reason and is a macro is that it's designed to short-circuit - ie if the first result is false the rest shouldn't even be evaluated. Using it on raw booleans works, because booleans evaluate to themselves, but it's really designed to be given forms. The fact that booleans evaluate to themselves is irrelevant, and if it were relevant, and wouldn't work on forms in general. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Time complexity of operations on collections
I am indeed confused. I have both cons and conj operations in my table. Are you saying (conj coll item) and (cons item coll) are implemented the same way under the hood? That wasn't my understanding. Can you clarify? On Wednesday, May 22, 2013 10:05:22 AM UTC-5, tbc++ wrote: You might also want to switch cons to conj. This is a super ugly part of the Java api that no one really ever sees. PersistentVector.cons is actually called by clojure.core/conj. clojure.core/cons is something else completely. When talking about how the java code performs it might be best to specify which one you mean. Yes it's confusing, I'm sure there is a historical reason for it. Timothy On Wed, May 22, 2013 at 8:24 AM, John Jacobsen eigen...@gmail.comjavascript: wrote: I should probably also have added sorted-map to the table, though the complexity for each operation is less clear to me. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Time complexity of operations on collections
Updated draft of table in more readable form here: http://bit.ly/big-o-clojure Thanks to Timothy for corrections/additions! Will keep updating as other replies come in. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Time complexity of operations on collections
No, what I'm saying is that in each persistent collection there is a method called cons: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L167 However, this is the function called by clojure.core/conj: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L75 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L562 Compare this to what clojure.core/cons calls: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L22 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L565 Basically, clojure.core/cons always converts the collection to a seq, then creates a Cons cell. Conj dispatches to coll.cons and runs whatever code the collection considers best. Timothy On Wed, May 22, 2013 at 10:00 AM, John Jacobsen eigenhom...@gmail.comwrote: I am indeed confused. I have both cons and conj operations in my table. Are you saying (conj coll item) and (cons item coll) are implemented the same way under the hood? That wasn't my understanding. Can you clarify? On Wednesday, May 22, 2013 10:05:22 AM UTC-5, tbc++ wrote: You might also want to switch cons to conj. This is a super ugly part of the Java api that no one really ever sees. PersistentVector.cons is actually called by clojure.core/conj. clojure.core/cons is something else completely. When talking about how the java code performs it might be best to specify which one you mean. Yes it's confusing, I'm sure there is a historical reason for it. Timothy On Wed, May 22, 2013 at 8:24 AM, John Jacobsen eigen...@gmail.comwrote: I should probably also have added sorted-map to the table, though the complexity for each operation is less clear to me. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
= (type identity) clojure.core$identity On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.comwrote: So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
On Wed, May 22, 2013 at 9:24 AM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. This message originally confused me. For some reason I found that my email filters had put a message for public-owl-dev into my folder for Clojure emails. It was a pleasant surprise to see that there was no mistake. :-) I'm wondering about the file formats. I see that RDF/XML (:rdf) and Manchester (:omn) are supported, as well as OWL/XML (:owl - which I don't really know). I don't see Turtle though, which is the main interchange format I try to use. Am I missing it? Thanks! Regards, Paul Gearon -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Try: user= (every? #(= Boolean (type %)) [true false false]) true user= (every? #(= Boolean (type %)) [true false false 1]) false On 22 May 2013 18:20, atkaaz atk...@gmail.com wrote: = (type identity) clojure.core$identity On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.comwrote: So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Michael Wood esiot...@gmail.com -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Duh never mind - simplified it and it works like a charm now. (defn all-true? [coll] (every? (fn [x] (= x true)) coll)) (all-true? '(true true true)) (all-true? '(true true false)) (all-true? '(true true 3)) (all-true? '(3 \# !)) No exception on bad input data but if I really need to do that I can expand that lambda. Thanks to everyone for the help. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
I think the exception is thrown because you basically called (every? false coll) however on my clojure version I cannot reproduce it oh wait there we go, some bug here with empty collection (maybe someone can pick it up): = (every? false [1 2 3]) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn clojure.core/every? (core.clj:2423) = (every? false []) true = *clojure-version* {:interim true, :major 1, :minor 6, :incremental 0, :qualifier master} On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.comwrote: So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
there's another edge case when using and/or : getting passed an unbound var where for example `nil?` and `str` applied to it don't throw, and of course also `or` and `and`, ie.: = (def a) #'cgws.notcore/a = a #Unbound Unbound: #'cgws.notcore/a = (nil? a) false = (str a) Unbound: #'cgws.notcore/a = (or a) #Unbound Unbound: #'cgws.notcore/a = (or 1 2 a) 1 = (or a 1 2) #Unbound Unbound: #'cgws.notcore/a = (and 1 2 3 a) #Unbound Unbound: #'cgws.notcore/a = (and a 1 2 3) 3 = (type a) clojure.lang.Var$Unbound = (cond a 2) 2 = (when a 3) 3 = (if a 4 5) 4 = (bound? #'a) false = (bound? a) ; in case anyone was wondering ClassCastException clojure.lang.Var$Unbound cannot be cast to clojure.lang.Var clojure.core/bound?/fn--4837 (core.clj:4954) = (defn test1 [input] (cond (and (not (nil? input))) (println received nice input=` input `) :else (throw (RuntimeException. (str bad input: input) #'cgws.notcore/test1 = (test1 1) received nice input=` 1 ` nil = (test1 nil) RuntimeException bad input: cgws.notcore/test1 (NO_SOURCE_FILE:5) = (test1 a) received nice input=` #Unbound Unbound: #'cgws.notcore/a ` nil but I guess I should've put this in its proper thread aka here: https://groups.google.com/forum/#!msg/clojure/LmpcTRPUAY0/8ieaRmM7pIUJ On Wed, May 22, 2013 at 1:28 PM, atkaaz atk...@gmail.com wrote: On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote: I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? What about the other edge? user= (reduce #(and %1 %2) '(1 true 2)) 2 user= (eval (conj '(1 true 3) 'and)) 3 user= (doc and) - clojure.core/and ([] [x] [x next]) Macro Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true. nil Thanks. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Defining the ground truth
Is the ground truth your spec or your code? Here is an interesting read: http://shanecelis.github.io/2013/05/20/why-im-trying-literate-programming Shane started with a co-worker, working from a spec, to create a program. He eventually found that only he could make changes because only he understood the code and the spec was out of date. The last big project I worked on had 6 people for 6 years. The central data structure eventually became complex. It had optimizations and mountains of code that depended on them. When we tried to write a new and better central algorithm it turned out that nobody knew all the various substructures embedded in the main data structure so we couldn't make the improvement. The person who managed the main data structure had left the project, taking with him all the knowledge. The program died. Are you limiting our ability to collaborate because you don't communicate? Do we have to read (and reverse engineer) your code before we can write? Does your code add, change, or extend the spec with special cases? Can you keep up with the whole team using reverse engineering? Can you identify the person who holds it all together? Is your whole project dead code if certain people leave? If you want your code to live, communicate. Write words for people who will maintain your code but you'll never meet. Tim Daly Knuth fanboi -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: asm-based clojure yet?
Looks like I forgot to enable the paging file (windows virtual memory was disabled) and that is why my eclipse/firefox would crash when running out of memory and also had much eclipse.ini memory allocated -Xms228m -Xmx712m ; and because of all these I was unable to start repl most of the time in ccw due to not enough memory(it said), so due to your comment (thank you), I've fixed those and set -Xms128m -Xmx512m but will probably go back to 712 (it's ok now since I've the paging file); but the memory total is like 3.5gig since 512 is eaten by video card memory. So now at least I can run them without running out of memory all the time :) but they still use quite a lot and I found myself having to run lein commands (like lein test) and restarting repls enough times for it to make me want something else - but I am an odd ball, so it's not something everyone else will do. Honestly I really want a system where things are more accessible, unfortunately I can't explain this (i'll try if u really want me to) for example I really enjoyed the F3 in eclipse on java source code which would do Go to Definition/Declaration (of this identifier), and also the find all calls to this method in this project and the refactoring... this kind of connectivity I'd expect to be in the system (from what I've read some Lisp machines(?) or the lisp lang on some machines really have that was it Genera ? and some read about Dynamic Windows but I also remember something vaguely about ruby - haven't used it though). In a more broader way, I want to be able to explore/deduce the system without having to jump through hoops like googling for information about it, when in fact I already have it running on my system, why not just explore its construction live while it's running, visualize all its connections (like in a graph) I like this clojure lang because it gets me closer to the way I want things to be, but it feels all so disconnected like I can't feel that when writing some code I can just easily F3 on a symbol and see where else it was used or even defined(sometimes this works in ccw btw ie. for clojure core code) So far, I'm thinking maybe code something from assembler level up (maybe even not requiring garbage collector but still not using explicit mem allocations like malloc) so it will eventually become a replacement for whatever I use for text editor, and if it does the way I think it will, I can then store all kinds of information and advance it even to the next level... but there's all these barrier with transactions and locks but this functional programming idea might be pretty good to apply(even though I envisioned a system where everything would be global(ly accessible) restrictions can still apply in dependency style like A depends on B and C depends on B, so if I want to change B then the way A and C depend on B have to be satisfied before the change can occur or that change will have to include changes to A and/or C also). Sorry for the rant, it's just that i feel lost so far(and not very knowledgeable). I just imagine how awesome it would be to can explore a system (PC+OS+java+clojure+some window+some text+some word on it) of which say you know nothing of, from a point (any point you choose) and be able to understand it and see how everything interconnects to everything else (no data/level/layer stripped just like the .exe is without the sourcecode for example), because everything you need is there, visually explorable(maybe graph like) and even changeable, if you just need to know exactly how is some word(or even a pixel) on the screen connected to everything else for example you could dig in - I don't know how it would look and how to implement that so far, but i know I want it, and apparently I'm reluctant to accepting the status quo even though that's the only way to get there :/ It can still be fast even though all the debug info (so to speak) and source code is tagged/connected to the binary code/offsets I imagine. On Wed, May 22, 2013 at 6:51 PM, Mikera mike.r.anderson...@gmail.comwrote: On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote: thank you very much, my search has lead me to seeking a lisp that could compile to machine code (mainly because i cannot accept the 20-22 sec `lein repl` startup time and eclipse/ccw memory consumptions - so I was hoping for something fast even though the cost is portability and all else) The above strikes me as a slightly odd statement. Eclipse/CCW or lein repl startup times should be irrelevant because you should only be incurring them once, when starting a development session. Sure, Eclipse eats memory too, but again this is only a development time issue and your dev machine should have plenty, right? In production, running the packaged .jar file should be pretty quick and much more lightweight. JVM startup is less than 0.1sec nowadays, so you can get a splash screen or basic GUI up in front of a user almost immediately. That only leaves
Re: asm-based clojure yet?
emacs does this navigation stuff.. M-. and M-, . For uses of a function, try grep -R or rgrep. On Wed, May 22, 2013 at 1:30 PM, atkaaz atk...@gmail.com wrote: Looks like I forgot to enable the paging file (windows virtual memory was disabled) and that is why my eclipse/firefox would crash when running out of memory and also had much eclipse.ini memory allocated -Xms228m -Xmx712m ; and because of all these I was unable to start repl most of the time in ccw due to not enough memory(it said), so due to your comment (thank you), I've fixed those and set -Xms128m -Xmx512m but will probably go back to 712 (it's ok now since I've the paging file); but the memory total is like 3.5gig since 512 is eaten by video card memory. So now at least I can run them without running out of memory all the time :) but they still use quite a lot and I found myself having to run lein commands (like lein test) and restarting repls enough times for it to make me want something else - but I am an odd ball, so it's not something everyone else will do. Honestly I really want a system where things are more accessible, unfortunately I can't explain this (i'll try if u really want me to) for example I really enjoyed the F3 in eclipse on java source code which would do Go to Definition/Declaration (of this identifier), and also the find all calls to this method in this project and the refactoring... this kind of connectivity I'd expect to be in the system (from what I've read some Lisp machines(?) or the lisp lang on some machines really have that was it Genera ? and some read about Dynamic Windows but I also remember something vaguely about ruby - haven't used it though). In a more broader way, I want to be able to explore/deduce the system without having to jump through hoops like googling for information about it, when in fact I already have it running on my system, why not just explore its construction live while it's running, visualize all its connections (like in a graph) I like this clojure lang because it gets me closer to the way I want things to be, but it feels all so disconnected like I can't feel that when writing some code I can just easily F3 on a symbol and see where else it was used or even defined(sometimes this works in ccw btw ie. for clojure core code) So far, I'm thinking maybe code something from assembler level up (maybe even not requiring garbage collector but still not using explicit mem allocations like malloc) so it will eventually become a replacement for whatever I use for text editor, and if it does the way I think it will, I can then store all kinds of information and advance it even to the next level... but there's all these barrier with transactions and locks but this functional programming idea might be pretty good to apply(even though I envisioned a system where everything would be global(ly accessible) restrictions can still apply in dependency style like A depends on B and C depends on B, so if I want to change B then the way A and C depend on B have to be satisfied before the change can occur or that change will have to include changes to A and/or C also). Sorry for the rant, it's just that i feel lost so far(and not very knowledgeable). I just imagine how awesome it would be to can explore a system (PC+OS+java+clojure+some window+some text+some word on it) of which say you know nothing of, from a point (any point you choose) and be able to understand it and see how everything interconnects to everything else (no data/level/layer stripped just like the .exe is without the sourcecode for example), because everything you need is there, visually explorable(maybe graph like) and even changeable, if you just need to know exactly how is some word(or even a pixel) on the screen connected to everything else for example you could dig in - I don't know how it would look and how to implement that so far, but i know I want it, and apparently I'm reluctant to accepting the status quo even though that's the only way to get there :/ It can still be fast even though all the debug info (so to speak) and source code is tagged/connected to the binary code/offsets I imagine. On Wed, May 22, 2013 at 6:51 PM, Mikera mike.r.anderson...@gmail.comwrote: On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote: thank you very much, my search has lead me to seeking a lisp that could compile to machine code (mainly because i cannot accept the 20-22 sec `lein repl` startup time and eclipse/ccw memory consumptions - so I was hoping for something fast even though the cost is portability and all else) The above strikes me as a slightly odd statement. Eclipse/CCW or lein repl startup times should be irrelevant because you should only be incurring them once, when starting a development session. Sure, Eclipse eats memory too, but again this is only a development time issue and your dev machine should have plenty, right? In production, running the
Re: How to: reduce boolean operations?
On Wed, May 22, 2013 at 9:32 AM, Peter Mancini peter.manc...@gmail.com wrote: (defn all-true? [coll] (every? (fn [x] (= x true)) coll)) (defn all-true? [coll] (every? true? coll)) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: asm-based clojure yet?
I don't know about the emacs stuff, but I consider the latter to be a nice workaround/hack :) On Wed, May 22, 2013 at 8:35 PM, Gary Trakhman gary.trakh...@gmail.comwrote: emacs does this navigation stuff.. M-. and M-, . For uses of a function, try grep -R or rgrep. On Wed, May 22, 2013 at 1:30 PM, atkaaz atk...@gmail.com wrote: Looks like I forgot to enable the paging file (windows virtual memory was disabled) and that is why my eclipse/firefox would crash when running out of memory and also had much eclipse.ini memory allocated -Xms228m -Xmx712m ; and because of all these I was unable to start repl most of the time in ccw due to not enough memory(it said), so due to your comment (thank you), I've fixed those and set -Xms128m -Xmx512m but will probably go back to 712 (it's ok now since I've the paging file); but the memory total is like 3.5gig since 512 is eaten by video card memory. So now at least I can run them without running out of memory all the time :) but they still use quite a lot and I found myself having to run lein commands (like lein test) and restarting repls enough times for it to make me want something else - but I am an odd ball, so it's not something everyone else will do. Honestly I really want a system where things are more accessible, unfortunately I can't explain this (i'll try if u really want me to) for example I really enjoyed the F3 in eclipse on java source code which would do Go to Definition/Declaration (of this identifier), and also the find all calls to this method in this project and the refactoring... this kind of connectivity I'd expect to be in the system (from what I've read some Lisp machines(?) or the lisp lang on some machines really have that was it Genera ? and some read about Dynamic Windows but I also remember something vaguely about ruby - haven't used it though). In a more broader way, I want to be able to explore/deduce the system without having to jump through hoops like googling for information about it, when in fact I already have it running on my system, why not just explore its construction live while it's running, visualize all its connections (like in a graph) I like this clojure lang because it gets me closer to the way I want things to be, but it feels all so disconnected like I can't feel that when writing some code I can just easily F3 on a symbol and see where else it was used or even defined(sometimes this works in ccw btw ie. for clojure core code) So far, I'm thinking maybe code something from assembler level up (maybe even not requiring garbage collector but still not using explicit mem allocations like malloc) so it will eventually become a replacement for whatever I use for text editor, and if it does the way I think it will, I can then store all kinds of information and advance it even to the next level... but there's all these barrier with transactions and locks but this functional programming idea might be pretty good to apply(even though I envisioned a system where everything would be global(ly accessible) restrictions can still apply in dependency style like A depends on B and C depends on B, so if I want to change B then the way A and C depend on B have to be satisfied before the change can occur or that change will have to include changes to A and/or C also). Sorry for the rant, it's just that i feel lost so far(and not very knowledgeable). I just imagine how awesome it would be to can explore a system (PC+OS+java+clojure+some window+some text+some word on it) of which say you know nothing of, from a point (any point you choose) and be able to understand it and see how everything interconnects to everything else (no data/level/layer stripped just like the .exe is without the sourcecode for example), because everything you need is there, visually explorable(maybe graph like) and even changeable, if you just need to know exactly how is some word(or even a pixel) on the screen connected to everything else for example you could dig in - I don't know how it would look and how to implement that so far, but i know I want it, and apparently I'm reluctant to accepting the status quo even though that's the only way to get there :/ It can still be fast even though all the debug info (so to speak) and source code is tagged/connected to the binary code/offsets I imagine. On Wed, May 22, 2013 at 6:51 PM, Mikera mike.r.anderson...@gmail.comwrote: On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote: thank you very much, my search has lead me to seeking a lisp that could compile to machine code (mainly because i cannot accept the 20-22 sec `lein repl` startup time and eclipse/ccw memory consumptions - so I was hoping for something fast even though the cost is portability and all else) The above strikes me as a slightly odd statement. Eclipse/CCW or lein repl startup times should be irrelevant because you should only be incurring them once, when starting a
Re: Compiling the Android version of Clojure
On Wed May 22 05:10 2013, Alex Fowler wrote: My aim is to enable Clojure programming directly on an Android device.. so, as I understand, I can use lein-droid to make the pre-compiled JAR to work on the device? I seen Clojure 1.4.0 REPL for Android and I wanted to get the compiler itself, preferably for 1.5.1, so that I can integrate it into my program... I dont't know, though, how well will Clojure's dynamic bytecode generation work with Dalvik... Well, lein-droid should pull in a Clojure that includes the compiler and can compile on Dalvik. You can also explicitly use org.clojure-android/clojure-1.5.1 from Clojars which is the latest release of Clojure/Android that includes the Dalvik-compatible compiler. I think either one of these shoule help you do what you want to do. Sincerely, Daniel среда, 22 мая 2013 г., 1:39:43 UTC+4 пользователь Daniel Solano Gómez написал: Hello, I use Maven to build the Clojure/Android port, so I don't know whethter the Ant build instructions work or how to adapt them to Windows. Is there a reason you need to build from source? If not, then using lein-droid or getting the JAR directly from Clojars is probably an easier way to go. Sincerely, Daniel On Wed May 22 05:25 2013, Kelker Ryan wrote: What's wrong with the lein-droid plugin? https://github.com/clojure-android/lein-droid � 22.05.2013, 05:21, Alex Fowler alex.m...@gmail.com javascript:: Nope, I am on Windows :D.. I guess I could re-write this one into a *.bat file... �looking inside the file, however, does not give me a clue on how it will help me aside from that maybe maven will somehow manage to reolve the deps... On Wed, May 22, 2013 at 12:18 AM, Kelker Ryan [1]thein...@yandex.com javascript: wrote: Did you run ./antsetup.sh before trying to build with ant? � 22.05.2013, 05:01, Alex Fowler [2]alex.m...@gmail.comjavascript:: Nope, the installation instruction in the readme of the project says nothing about this one (i'm a newb to android development). So if I download it, where I put it? On Tue, May 21, 2013 at 11:59 PM, Kelker Ryan [3]thein...@yandex.com javascript: wrote: Did you download the Android JAR? [4]http://www.java2s.com/Code/Jar/a/Downloadandroid32jar.htm 22.05.2013, 04:52, Alex Fowler [5]alex.m...@gmail.comjavascript:: I'm trying to build this project:�[6]https://github.com/clojure-android/clojure�with ant command. It sarts working, but I get this output with errors: Buildfile: C:\Users\Admin\Downloads\clojure-android\clojure-android\build.xml clean: � �[delete] Deleting directory C:\Users\Admin\Downloads\clojure-android\clojure- android\target init: � � [mkdir] Created dir: C:\Users\Admin\Downloads\clojure-android\clojure-androi d\target\classes � � [mkdir] Created dir: C:\Users\Admin\Downloads\clojure-android\clojure-androi d\target\classes\clojure compile-java: � � [javac] Compiling 483 source files to C:\Users\Admin\Downloads\clojure-andro id\clojure-android\target\classes � � [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5 � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:13: error: package android.util does not �exist � � [javac] import android.util.Log; � � [javac] � � � � � � � � � �^ � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:17: error: package dalvik.system does no t exist � � [javac] import dalvik.system.DexFile; � � [javac] � � � � � � � � � � ^ � � [javac] C:\Users\Admin\Downloads\clojure-android\clojure-android\src\jvm\clo jure\lang\DalvikDynamicClassLoader.java:45: error: package android.os.Build does �not exist � � [javac] � � DEX_OPTIONS.targetApiLevel = android.os.Build.VERSION.SDK_INT; � � [javac] � � � � � � � � � � � � � � � � � � � � � � � � �^ � � [javac]
Re: [ANN] tawny-owl 0.11
Jim jimpil1...@gmail.com writes: I am certainly not an ontology guru but I can confirm that what you describe is sort of valid...Ontologies will indeed help you find predicate-argument structures of the form subject-predicate-object (i.e John likes pizza), but in order to do that you have to build the domain-specific ontology first! But there is another way to get the same information via deep-parsing. A syntactic parser like stanford's or enju will give you back the nodes (tokens) and their dependencies (relations). You can shove that into a (directed acyclic) graph structure and you're ready to query/navigate it as you like... This breaks down somewhat when you definitions get nasty enough. Take these two examples: the first says in English A VeggiePizza is a Pizza, and not a thing which has at least one MeatTopping and not a thing which has at least one FishTopping The second says A VeggiePizza is a Pizza which only has a topping which is not meat or rish Now, any and only individuals that fulfil the first definition also fulfil the second: or, alternatively, for any set of individuals we can think of, these two classes always have the same set. (defclass VegetarianPizza :equivalent (owland Pizza (owlnot (owlsome hasTopping MeatTopping)) (owlnot (owlsome hasTopping FishTopping ;; different, but equivalent, definition (defclass VegetarianPizza2 :equivalent (owland Pizza (only hasTopping (owlnot (owlor MeatTopping FishTopping) Most of the time, the practical upshot of this is that you can ask give me all the VegetarianPizza's and you get an answer. Pizza's are just a standing example, BTW. I don't know if any one has ever built an e-commerce site with an ontological backend. Phil -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] tawny-owl 0.11
Ah, now, that is a complicated question with a long history. If I may duck the question slightly, and just answer about OWL (it's not the only ontology representation language). Trivially, of course, the answer is yes. An ontology is representable as a graph, but then a graph is a rich enough data structure to represent most things. Some ontologies fall into this category and are explicitly represented as DAGs; the Gene Ontology is my favourite example of this. OWL has a more complex semantics, so representation as a graph is a bit limiting; the formal, underlying semantics are either (a subset of) first-order logic, or alternatively a set theoretic equivalent. Trivially, for instance, with OWL you can distinguish between some hasTopping MozzarellaTopping only hasTopping MozzarellaTopping (a thing that has at least one topping which is a MozzarellaTopping, and a thing which can have any number of toppings including none, but all of which are MozzarellaToppings). As you build up the complexity the graph representation becomes unwieldy. Having said all of that, you can represent structurally simple ontologies in OWL, by only using a defined subset of the language. Tawny uses the underlying java libraries to check this is happening correctly. I should give a simple example; think of a library classification -- science-biology-botany. This is a simple ontology. The SI system of units is another, rather different one. I realise that the barrier to entry for this is all quite high; it's one of the reasons I created (and others wrote) http://ontogenesis.knowledgeblog.org. Ontologies are currently still what I would class as a research area; they are used in specialist areas of (mostly) scientific development. Perhaps with tools like tawny, we can widen this somewhat. Phil atkaaz atk...@gmail.com writes: Would you say that ontologies can be modeled on top of graphs? so in a way they can be seen as a specific use case for graphs? (maybe directed acyclic graphs), that's what I am getting the sense of so far On Wed, May 22, 2013 at 4:47 PM, atkaaz atk...@gmail.com wrote: Thank you very much for this! I find it very interesting, I shall keep reading On Wed, May 22, 2013 at 4:24 PM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. In this setting, an ontology is essentially a set of facts, that you can test with a computational reasoner; so, it's something like logic programming. I don't implement the reasoner -- someone else has done that (in fact there are several). These reasoners can scale up to 100'000s of terms. My example Pizza ontology shows it in use. https://github.com/phillord/tawny-pizza So, you can make statements like (defclass CheesyPizza :equivalent (owland Pizza (owlsome hasTopping CheeseTopping))) and (defclass MozzarellaTopping :subclass CheeseTopping) and finally, (defclass MargheritaPizza :subclass (someonly hasTopping CheeseTopping TomatoTopping)) and the reasoner will work out that MargheritaPizza is a CheesyPizza. In itself, this is simple, but you can build up more complex classes like so. (defclass VegetarianPizza :equivalent (owland Pizza (owlnot (owlsome hasTopping MeatTopping)) (owlnot (owlsome hasTopping FishTopping (defclass NonVegetarianPizza :equivalent (owland Pizza (owlnot VegetarianPizza))) Of course, really takes flight when you have large ontologies. FMA which models human anatomy, has I think, about 100,000 terms. SNOMED (ways you can get ill) has millions. Now there are lots of tools for building these; the novelty with tawny is that the raw syntax is relatively simple (most of tawny-pizza does not look like a programming language), but it is entirely programmatic; so, it is possible to automate, build patterns, and integrate with external infrastructure all in one place. I think that this is going to be very useful, but we shall see! While I am interested in biomedical and scientific ontologies, there are lots of other applications. Probably the most famous one at the moment is Siri (the iphone thingy) which is ontological powered underneath. There are quite a few articles, varying in scope on ontologies on ontogenesis http://ontogenesis.knowledgeblog.org. It is a very valid point, though. I should write some documentation on ontologies for programmers. I shall work on it! Phil atkaaz atk...@gmail.com writes: For those who don't know the concepts (aka me) can we get a working example of what can be done ? I'm having a strange feeling that ontologies(although I've never heard the word/idea before except from you) might be something similar to what I am searching for... Possibly an example that showcases
Re: [ANN] tawny-owl 0.11
Paul Gearon gea...@ieee.org writes: On Wed, May 22, 2013 at 9:24 AM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: It's a good question; the library is more intended for people who know ontologies and don't care, or have never heard about, clojure. So the documentation is biased in that way. This message originally confused me. For some reason I found that my email filters had put a message for public-owl-dev into my folder for Clojure emails. It was a pleasant surprise to see that there was no mistake. :-) It can be strange when different worlds collide. I keep on seeing people here I know from my life as a minor Emacs hacker. I'm wondering about the file formats. I see that RDF/XML (:rdf) and Manchester (:omn) are supported, as well as OWL/XML (:owl - which I don't really know). I don't see Turtle though, which is the main interchange format I try to use. Am I missing it? Yeah, that should work. Underneath, most of this is driven by the OWL API. So as well as a keywords which I added for the lazy (that is, me), you can pass an OWL API OntologyFormat object. So: (save-ontology pizza.turtle (org.coode.owlapi.turtle.TurtleOntologyFormat.)) does the job. For me, :omn is the nicest to read; tawny's syntax looks similar, which is not an accident. I'll add a keyword shortcut for the next release. I should have just done all the known ones; like I say, lazy. Phil -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Auto-compiling HAML / SCSS
Hey Antonio, thanks for responding. I guess I'm a bit annoyed that *lein-haml-sass*, isn't managing it's own 3rd party tools itself. I'll check out the links you mentioned. Cheers Tim On Tue, May 21, 2013 at 3:59 PM, Antonio Terreno antonio.terr...@gmail.comwrote: I never used that lein plugin but the output is quite clear: Warning: JRuby home /Users/timothyw/Tools/jruby-1.4.0 does not exist: It seems like your jruby home is not properly configured, my favourite way to achieve this is to use https://github.com/sstephenson/ruby-build LoadError: no such file to load -- rubygems It seems like you don't have rubygems installed (or misconfigured), try following this: http://docs.rubygems.org/read/chapter/3 I hope it helps, toni On Mon, May 20, 2013 at 2:39 PM, Timothy Washington twash...@gmail.com wrote: Hi all, I'm trying to find a Clojure solution for auto-compiling HAML and SCSS code. I came across https://github.com/rtircher/lein-haml-sass, but that fails when I try to compile with lein haml once or lein haml auto. Has anyone gotten this setup working? Or is there otherwise any other Clojure solution for this? I'm trying to avoid Guard and it's plug-ins. I'm finding its file watching and auto-compiling not to fire properly on my OSX machine. Thanks Tim $ lein haml once Compiling haml files located in public/templ/haml Warning: JRuby home /Users/timothyw/Tools/jruby-1.4.0 does not exist, using /var/folders/nm/z6fkwpms5rdb6fr_b8m_n9nhgn/T/ LoadError: no such file to load -- rubygems require at org/jruby/RubyKernel.java:1062 (root) at script:1 org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- rubygems at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:136) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1263) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at leiningen.lein_haml_sass.render_engine$ensure_engine_started_BANG_$fn__239.invoke(render_engine.clj:44) at clojure.lang.AFn.call(AFn.java:18) at clojure.lang.LockingTransaction.run(LockingTransaction.java:263) at clojure.lang.LockingTransaction.runInTransaction(LockingTransaction.java:231) at leiningen.lein_haml_sass.render_engine$ensure_engine_started_BANG_.invoke(render_engine.clj:41) at leiningen.lein_haml_sass.render_engine$render_all_BANG_.invoke(render_engine.clj:83) at leiningen.tasks$once.invoke(tasks.clj:16) at leiningen.haml$haml.doInvoke(haml.clj:9) at clojure.lang.RestFn.invoke(RestFn.java:425) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.core$apply.invoke(core.clj:619) at leiningen.core.main$resolve_task$fn__1836.doInvoke(main.clj:149) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.lang.AFunction$1.doInvoke(AFunction.java:29) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:619) at leiningen.core.main$apply_task.invoke(main.clj:189) at leiningen.core.main$resolve_and_apply.invoke(main.clj:193) at leiningen.core.main$_main$fn__1899.invoke(main.clj:257) at leiningen.core.main$_main.doInvoke(main.clj:247) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.core$apply.invoke(core.clj:617) at clojure.main$main_opt.invoke(main.clj:335) at clojure.main$main.doInvoke(main.clj:440) at clojure.lang.RestFn.invoke(RestFn.java:457) at clojure.lang.Var.invoke(Var.java:427) at clojure.lang.AFn.applyToHelper(AFn.java:172) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- rubygems fig.1 -- -- 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 with
Re: [ANN] tawny-owl 0.11
On May 22, 2013, at 04:41, Phillip Lord wrote: I'm pleased to announce the release of tawny-owl 0.11. What is it? == This package allows users to construct OWL ontologies ... Not surprisingly, most Clojurists are not familiar with ontologies in general or OWL ontologies in particular. This is a large topic area; this is a modest effort to provide background information. -r The word ontology is used in two different (though related) ways. The historic meaning is mostly helpful as background: Ontology ... is the philosophical study of the nature of being, becoming, existence, or reality, as well as the basic categories of being and their relations. Traditionally listed as a part of the major branch of philosophy known as metaphysics, ontology deals with questions concerning what entities exist or can be said to exist, and how such entities can be grouped, related within a hierarchy, and subdivided according to similarities and differences. -- http://en.wikipedia.org/wiki/Ontology Computer-based ontologies (eg, OWL ontologies) are sets of facts and rules about items in the domain of discourse: In computer science and information science, an ontology formally represents knowledge as a set of concepts within a domain, and the relationships between pairs of concepts. It can be used to model a domain and support reasoning about concepts. -- http://en.wikipedia.org/wiki/Ontology_(information_science) These facts and rules can allow programs to make inferences and can also be used to establish a controlled vocabulary (allowing human conversations to avoid ambiguity and confusion). OWL ontologies are typically constructed as is a hierarchies describing categories (eg, Thing Food Pizza). An item can be placed in multiple categories (eg, Thing Product Pizza) and relations (eg, Pizza goesWith Beer) are added to link them. So, the ontology is really more of a directed graph than a tree. OWL (Web Ontology Language) is a product of the Semantic Web effort. It is generally used with technologies such as RDF (Resource Description Framework), RDFS (RDF Schema), SPARQL, and RDF Triplestores. So, for example, someone might set up an RDF Triplestore with a large number of facts about (say) medicine. RDFS and OWL could be used to provide a framework for reasoning about these facts. A query language (eg, SPARQL) could then be used to answer questions. Here are some relevant links, as starting points: http://en.wikipedia.org/wiki/RDF_Schema http://en.wikipedia.org/wiki/Resource_Description_Framework http://en.wikipedia.org/wiki/Semantic_Web http://en.wikipedia.org/wiki/SPARQL http://en.wikipedia.org/wiki/Triplestore http://en.wikipedia.org/wiki/Web_Ontology_Language http://www.w3.org/TR/owl2-overview/ I also recommend these books, which include programmer-friendly introductions to this area. Learning SPARQL Bob DuCharme Semantic Web for the Working Ontologist Dean Allemang, Jim Hendler -- http://www.cfcl.com/rdmRich Morin http://www.cfcl.com/rdm/resume r...@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Software system design, development, and documentation -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
On 22 May 2013 18:34, atkaaz atk...@gmail.com wrote: I think the exception is thrown because you basically called (every? false coll) however on my clojure version I cannot reproduce it oh wait there we go, some bug here with empty collection (maybe someone can pick it up): = (every? false [1 2 3]) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn clojure.core/every? (core.clj:2423) = (every? false []) true = *clojure-version* {:interim true, :major 1, :minor 6, :incremental 0, :qualifier master} (every? false []) should return true if and only if (false x) is truthy for every x in [], which is certainly the case. Cheers, Michał On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.com wrote: So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to: reduce boolean operations?
Well, seems to me more like this: if [] is empty then return true otherwise check (pred everyx in coll) however this allows for any pred especially(in this case) invalid preds: `false` is not a function/pred = (false 1) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn cgws.notcore/eval2542 (NO_SOURCE_FILE:1) = (false true) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn cgws.notcore/eval2564 (NO_SOURCE_FILE:1) doesn't seem truthy to me Thanks. On Thu, May 23, 2013 at 3:08 AM, Michał Marczyk michal.marc...@gmail.comwrote: On 22 May 2013 18:34, atkaaz atk...@gmail.com wrote: I think the exception is thrown because you basically called (every? false coll) however on my clojure version I cannot reproduce it oh wait there we go, some bug here with empty collection (maybe someone can pick it up): = (every? false [1 2 3]) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn clojure.core/every? (core.clj:2423) = (every? false []) true = *clojure-version* {:interim true, :major 1, :minor 6, :incremental 0, :qualifier master} (every? false []) should return true if and only if (false x) is truthy for every x in [], which is certainly the case. Cheers, Michał On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.com wrote: So I did some coding and came up with this but it is broken; (= java.lang.Boolean (type false)) ;;evaluates to true (defn all-true? [coll] (every? (cond (= java.lang.Boolean (type identity)) identity :else false) coll)) ;;compiles (all-true? '(true true true)) ;; throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn (all-true? '(true true false)) (all-true? '(true true 3)) -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.