ANN: core.unify v0.5.2

2012-01-09 Thread Fogus
core.unify v0.5.2 Release Notes === core.unify is a Clojure contrib library providing the following features: * Factory functions for constructing unification binding, subst, and unification functions, with or without occurs checking * Packaged functions for unificati

Re: Trying to understand variable capture

2012-01-09 Thread Neal Groothuis
Macro expansion time is not run time, is it? Thanks. :-) On Jan 8, 2:59 pm, Michael Fogus wrote: > The names in the first let only exist at compile time and do not exist when > the expanded form eventually runs. -- You received this message because you are subscribed to the Google Groups "Clo

Re: Help with binding

2012-01-09 Thread Matthew Giannini
Cedric - thanks. I'm new to Clojure and after posting this realized that I could/should use one of the do* approaches. I ended up using doseq and it worked great. Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Re: Difference between clojure.lang.Cons and clojure.lang.PersistenList

2012-01-09 Thread Samuel Lê
Yes, seq? works. Thanks for the help! On Sun, Jan 8, 2012 at 9:03 PM, Cedric Greevey wrote: > On Sun, Jan 8, 2012 at 10:30 AM, Samuel Lê wrote: > > Hi and Happy New Year to all the Clojure mailing list, > > > > I am am having some trouble with the two classes Cons and PersistentList: > > > > us

Re: Bug with ClojureScript keyword? function

2012-01-09 Thread Michael Lim
Apologies, there was a typo in my original email, what I meant to say was that: (js/alert (keyword? :foobar)) output result => false was compiled to => alert.call(null,cljs.core.keyword_QMARK_.call(null," 'foobar")); (js/alert (string? :foobar)) output result => true was compiled to => alert.call

Re: Two Slightly Different Versions Using lazy-seq: One works, One doesn't. Why?

2012-01-09 Thread Tom Chappell
For some reason I never saw either my first post nor your answer to it. It was my first post to the group, so I thought maybe it had been swallowed up (maybe the moderators had to approve my membership before I could post or something), so after waiting a day, I posted again. And...not 5 minutes

Re: Two Slightly Different Versions Using lazy-seq: One works, One doesn't. Why?

2012-01-09 Thread Tom Chappell
For some reason I never saw either my first post nor your answer to it. It was my first post to the group, so I thought maybe it had been swallowed up (maybe the moderators had to approve my membership before I could post or something), so after waiting a day, I posted again. And...not 5 minutes

Re: Bug with ClojureScript keyword? function

2012-01-09 Thread Timothy Baldridge
>Is this a bug in the conversion of the clojure keyword to the>JavaScript >object? I think there's probably an issue with string conversion in your program. In ClojureScript keywords are not separate objects. Instead they are simply strings that start with a bizarre unicode character. Example fro

Templating, how to?

2012-01-09 Thread Linus Ericsson
I want to generate rules with constant and/or functions producing parts of the rules: (defn rulemaker [] (str "SCOPE " global-constant ";" (some-global-function) ";")) which could be called with (with-super-closure model-in-file-reference (rulemaker)) Is there a way to make some "tempora

Re: Enlive reborn in ClojureScript - Enfocus (Dom Manipulation Lib)

2012-01-09 Thread Sean Corfield
On Sun, Jan 8, 2012 at 10:48 PM, Peter Taoussanis wrote: > I also get the impression that Enlive itself seems to be quite widely > misunderstood and consequently underrated. > > Haven't had a chance to take a serious look at this yet myself (I > will!), but just wanted to throw my support behind t

Re: mysql and fruit tables

2012-01-09 Thread Sean Corfield
On Sun, Jan 8, 2012 at 8:26 PM, jayvandal wrote: > I have been able to access tables in mysql, but not able to add > records. I look at the examples fo "fruit  so I created a lein named > fruitI made th project file as the mysql project file. I copied the > database instructions as in mysql. I add

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 8:00 AM, Fogus wrote: > core.unify v0.5.2 Release Notes > === > > core.unify is a Clojure contrib library providing the following > features: > > * Factory functions for constructing unification binding, subst, and > unification functions, with or

Re: Difference between clojure.lang.Cons and clojure.lang.PersistenList

2012-01-09 Thread Cedric Greevey
On Sun, Jan 8, 2012 at 4:11 PM, Samuel Lê wrote: > Yes, seq? works. Thanks for the help! You're 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 a

Re: Help with binding

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 7:48 AM, Matthew Giannini wrote: > Cedric - thanks. I'm new to Clojure and after posting this realized that I > could/should use one of the do* approaches. I ended up using doseq and it > worked great. > > Thanks. You're welcome. -- You received this message because you a

Re: Templating, how to?

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 10:36 AM, Linus Ericsson wrote: > I want to generate rules with constant and/or functions producing parts of > the rules: > > (defn rulemaker [] >    (str "SCOPE " global-constant ";" (some-global-function) ";")) > > which could be called with > > (with-super-closure model-i

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread Stuart Sierra
Hi Shantanu, #1 is a bug. #2 is not possible because `import` doesn't exist in ClojureScript: it doesn't differentiate between host classes and ClojureScript code. Protocols and types should be accessible with normal `require` in ClojureScript. #3 seems unlikely to be implemented. ClojureScri

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 1:18 PM, Stuart Sierra wrote: > #3 seems unlikely to be implemented. ClojureScript doesn't have Vars, and it > doesn't have threads, so there's not much for `binding` to do. I could see > `with-redefs` being supported, however. Actually, the lack of threads just simplifies

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Michael Fogus
> Yes, but what exactly are these "unification binding, subst, and > unification functions"? This is information that seems a bit odd to include in a set of release notes, but I suppose a link to where such information could be found is warranted. > In other words, I'm a developer. I have some co

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread Phil Hagelberg
Tassilo Horn writes: > One thing that really made the programming extremely hard was that I > don't get any backtraces if an exception occurs inside a `run'. For > example, I get this in SLIME with M-x clojure-jack-in RET. > (defn wrongo [a b] false) ;; intentionally broken > ;=> #'

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 1:45 PM, Michael Fogus wrote: >> Yes, but what exactly are these "unification binding, subst, and >> unification functions"? > > This is information that seems a bit odd to include in a set of > release notes, but I suppose a link to where such information could be > found i

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Sean Corfield
On Mon, Jan 9, 2012 at 11:00 AM, Cedric Greevey wrote: > On Mon, Jan 9, 2012 at 1:45 PM, Michael Fogus wrote: >> Google also helps too. :-) > Not really, not with a single fairly generic word like "unification". #1 result: wikipedia, which has a disambiguation page with the second entry: "Unifi

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Michael Fogus
> Not really, not with a single fairly generic word like "unification". In the amount of time that you spent lecturing me on good library release note practices you could have learned what unification was, read the code, and decided if it filled any of your needs. Hint. My library has very littl

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread Shantanu Kumar
> #3 seems unlikely to be implemented. ClojureScript doesn't have Vars, and > it doesn't have threads, so there's not much for `binding` to do. I could > see `with-redefs` being supported, however. Hi Stuart, Thanks for the pointers. So, I am trying to understand what is the canonical way to writ

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Vinzent
First of all, thank you for your work! But actually I agree with Cedric. He definitely has a point. I'd love to try unify, but I have no idea where to begin! Having short description and some simple use cases in announce would be great. Please do not take this as a critisism, but rather as a w

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 2:08 PM, Sean Corfield wrote: > On Mon, Jan 9, 2012 at 11:00 AM, Cedric Greevey wrote: >> On Mon, Jan 9, 2012 at 1:45 PM, Michael Fogus wrote: >>> Google also helps too. :-) >> Not really, not with a single fairly generic word like "unification". > > #1 result: wikipedia,

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Michael Fogus
> unify, but I have no idea where to begin! Having short description and some > simple use cases in announce would be great. I do not disagree. Those elements will be in place by the 1.0.0 release (as listed in the "planned" section). In the meantime, patches welcomed. -- You received this mess

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 2:16 PM, Michael Fogus wrote: >> Not really, not with a single fairly generic word like "unification". > > In the amount of time that you spent lecturing me on good library > release note practices you could have learned what unification was, > read the code, and decided if

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 2:20 PM, Shantanu Kumar wrote: >> #3 seems unlikely to be implemented. ClojureScript doesn't have Vars, and >> it doesn't have threads, so there's not much for `binding` to do. I could >> see `with-redefs` being supported, however. > > Hi Stuart, > > Thanks for the pointers.

Re: [ClojureScript] My implementation of ISeqable for NodeList doesn't work on Opera.

2012-01-09 Thread Stuart Sierra
I would like to have NodeList be seqable. Please file a ticket with a patch. Perhaps someone else can shed light on why Opera doesn't work. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Jay Fields
On Mon, Jan 9, 2012 at 3:20 PM, Cedric Greevey wrote: > Talk about completely missing the point. I had no idea what core.unify would be used for either. However, the email included a link to the github page, and the Readme on the github page included a link called "more information" and several

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread Tassilo Horn
Phil Hagelberg writes: Hi Phil, >> One thing that really made the programming extremely hard was that I >> don't get any backtraces if an exception occurs inside a `run'. For >> example, I get this in SLIME with M-x clojure-jack-in RET. > >> (defn wrongo [a b] false) ;; intentionally

Need help to translate a simple java program into Clojure program

2012-01-09 Thread Nicolas Garcin
Hello, I'm new to functional programming and Clojure and I'm trying to translate a simple java program into Clojure. My program must build from 2 input lists (stored in a vector) 2 output lists (also stored in a vector) which have same number of elements as input lists for both output lists. The e

Problem with :pre checks against nil in 1.3.0?

2012-01-09 Thread Tom Chappell
Ok, I've got a couple thousand lines of Clojure under my belt, but this has me stumped, unless it's a compiler etc. issue. If I'm missing something dumb, what is it, please? I have a function that is failing a not-nil precondition. Here are four versions of the same test; only #3 works correctly

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 3:43 PM, Jay Fields wrote: > On Mon, Jan 9, 2012 at 3:20 PM, Cedric Greevey wrote: > >> Talk about completely missing the point. > > I had no idea what core.unify would be used for either. However, the > email included a link to the github page, and the Readme on the github

Re: Problem with :pre checks against nil in 1.3.0?

2012-01-09 Thread Cedric Greevey
On Mon, Jan 9, 2012 at 12:53 PM, Tom Chappell wrote: > Ok, I've got a couple thousand lines of Clojure under my belt, but > this has me stumped, unless it's a compiler etc. issue.  If I'm > missing something dumb, what is it, please? > > I have a function that is failing a not-nil precondition.  H

Re: ANN: core.unify v0.5.2

2012-01-09 Thread Michael Fogus
> You have to pitch people on the potential benefits of downloading your > library *before* they click the download link for it, or they mostly > never will. Sold. I've learned my lesson. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Re: Problem with :pre checks against nil in 1.3.0?

2012-01-09 Thread Michael Fogus
Try to put your :pre entries in a vector, like so: {:pre [(not= 0 (mp k 0))]} -- 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 pat

Re: Problem with :pre checks against nil in 1.3.0?

2012-01-09 Thread Steve Miner
The precondition should be a vector of expressions. (defn foo [x] {:pre [(not (nil? x))]} (* 3 x)) On Jan 9, 2012, at 12:53 PM, Tom Chappell wrote: > Ok, I've got a couple thousand lines of Clojure under my belt, but > this has me stumped, unless it's a compiler etc. issue. If I'm > missing s

Re: [ClojureScript] My implementation of ISeqable for NodeList doesn't work on Opera.

2012-01-09 Thread Jozef Wagner
Beware that NodeList is often a live collection, so it is probably a good idea to produce "eager" seq. I use this to convert it to seq: (defn nodelist-to-seq "Converts nodelist to (not lazy) seq." [nl] (let [result-seq (map #(.item nl %) (range (.length nl)))] (doall result-seq))) --

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Linus Ericsson
2012/1/9 Nicolas Garcin > Hello, > > I'm new to functional programming and Clojure and I'm trying to > translate a simple java program into Clojure. My program must build > from 2 input lists (stored in a vector) 2 output lists (also stored in > a vector) which have same number of elements as inp

Re: mysql and fruit tables

2012-01-09 Thread sixs
I am running Win Vista. I create a project with Lein new fruit in C:\projects I cd to fruit in C:/projects/fruit I copy code from the mysql project that runs when reading the book table. This is the project code and the core code to access mysql. I added code to create the table "fruit" in test

Java interop: inner class

2012-01-09 Thread Alan
How do you instantiate a (non-static) inner class? -- 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.

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread David Nolen
binding works just fine in CLJS. That it doesn't work with required "vars" sounds like a bug. On Monday, January 9, 2012, Stuart Sierra wrote: > Hi Shantanu, > > #1 is a bug. > > #2 is not possible because `import` doesn't exist in ClojureScript: it doesn't differentiate between host classes and

Re: core.logic, leiningen, clj-stacktrace: someone eats my backtraces

2012-01-09 Thread David Nolen
Do you see the same issue when working with lazy sequences? We definitely don't eat exceptions. On Monday, January 9, 2012, Tassilo Horn wrote: > Phil Hagelberg writes: > > Hi Phil, > >>> One thing that really made the programming extremely hard was that I >>> don't get any backtraces if an exce

Re: Java interop: inner class

2012-01-09 Thread Alan Malloy
The syntax for this is atrocious in Java and the mechanism is in general rarely useful; I wouldn't be surprised if there's no non-hacky way to do this in Clojure. fooInstance.new Bar() is the construct you're talking about, right? My best guess would be that you just use the inner class's "real" (J

Re: Java interop: inner class

2012-01-09 Thread Lars Nilsson
On Mon, Jan 9, 2012 at 8:46 PM, Alan wrote: > How do you instantiate a (non-static) inner class? Something like the following? foo.java: public class foo { public class bar { public bar() { System.out.println("Made a bar"); } } } and (import 'foo)

Re: Java interop: inner class

2012-01-09 Thread Alan Bram
On 1/9/12, Lars Nilsson wrote: > (foo$bar. (foo.)) Thanks! That works. Actually this is exactly what I had guessed. But when I tried it, it wasn't working for me. But it turns out my problem was something unrelated, and the error message I got wasn't enough to get me to see where I was wrong.

Re: ClojureScript – inter-namespace usage

2012-01-09 Thread Praki Prakash
I bind *print-fn* and it seems to work fine in my snapshot of master pulled on 12/14. On Mon, Jan 9, 2012 at 6:16 PM, David Nolen wrote: > binding works just fine in CLJS. That it doesn't work with required "vars" > sounds like a bug. > > On Monday, January 9, 2012, Stuart Sierra > wrote: >> Hi

Re: mysql and fruit tables

2012-01-09 Thread Sean Corfield
On Mon, Jan 9, 2012 at 3:43 PM, wrote: > I run lein repl > I enter statement"(load "/fruit/core") You can just do: (require 'fruit.core) > I enter statement "(fruit.core/create-fruit) > I get error message > == > > user=> (fruit.core/insert-rows-fruit) > Exception n

Struggling in making a sub-process work in an interactive way

2012-01-09 Thread jaime
Hello there, I'm writing some code, int my code it does following things (under Windows): 1. create a sub-process by "(.exec (Runtime/getRuntime) "cmd")" named "shell" 2. get input-stream, output-stream and err-stream from the shell object 3. send commands to "shell" by dropping line into the outp

Re: Struggling in making a sub-process work in an interactive way

2012-01-09 Thread Phil Hagelberg
jaime writes: > Later on I tried to add code that can make this possible but I found > there's no way to detect if a command requires user's input and thus I > have to find another way to make it work - but I didn't success and > have been struggling for a workaround for a long while > > anyo

Re: mysql and fruit tables

2012-01-09 Thread sixs
Sorry for all the mistakes I make, but am trying todo something in mysql. In fruits example how is the mysql database called? In mysql example the statement is used to call mysql everytime a defn is called. === (sql/with-connection db. == Why is this s

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Baishampayan Ghose
On Tue, Jan 10, 2012 at 1:17 AM, Nicolas Garcin wrote: > I'm new to functional programming and Clojure and I'm trying to > translate a simple java program into Clojure. My program must build > from 2 input lists (stored in a vector) 2 output lists (also stored in > a vector) which have same number

Re: mysql and fruit tables

2012-01-09 Thread sixs
I guess I cange some things ecauseI don't know what the commands actually do. Icopied some ccode fromNakkaya "using mysql with clojure and for some reason I go that code running. I got to study what I screwed up in your fruit code and seeif I can understand that. Thanks - Original Message -

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Sean Corfield
On Mon, Jan 9, 2012 at 1:56 PM, Linus Ericsson wrote: > the last one becomes something like this: > > (for [option modified-options action modified-actions] >    (if (= (:name option) (:name option)) >       (let [sum (+ (:value action) (:value option))] >          [{:name (:name option) (Math/max

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Brian Mosley
(defrecord Pos [name value] Object (toString [this] (str ""))) (def actions [(Pos. "IBM", -50) (Pos. "ACCOR", -30); (Pos. "IBM", -10); (Pos. "APPLE", -20); (Pos. "AIRFRANCE", -20)]) (def options [(Pos. "IBM", 55) (Pos. "ACCOR", 40

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Brian Mosley
Oops. A possible solution might look something like that... -- 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 fir

Re: Trying to understand variable capture

2012-01-09 Thread Brian Mosley
Macro expansion time is just before compile time. -- 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. T