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

2012-01-06 Thread Takahiro Hozumi
Hi, Following code cause an error, because NodeList doesn't extend ISeqable. (doseq [u (goog.dom/getElementsByClass "myclass")] ...) Uncaught Error: No protocol method ISeqable.-seq defined for type object: [object NodeList] So I implemented ISeqable for NodeList. (extend-type js/NodeList

Re: [Tutorial] Making core.logic work with custom data structures

2012-01-06 Thread Sunil S Nandihalli
great post! .. just what I wanted.! Sunil. On Sat, Jan 7, 2012 at 11:14 AM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > thank you Tassilo, I think this post was long due. :) > Sunil. > > > On Sat, Jan 7, 2012 at 3:14 AM, Tassilo Horn wrote: > >> Hi all, >> >> after spending the last

Re: [Tutorial] Making core.logic work with custom data structures

2012-01-06 Thread Sunil S Nandihalli
thank you Tassilo, I think this post was long due. :) Sunil. On Sat, Jan 7, 2012 at 3:14 AM, Tassilo Horn wrote: > Hi all, > > after spending the last two days making clojure.core.logic work with our > custom Java data structures, I decided to write a short blog posting > about it. Here it is:

Re: On using atoms together with side effect functions

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 11:28 PM, Alan Malloy wrote: > but if you look at the post There is no call for taking a rude tone. I correctly answered the question as originally posed. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: On using atoms together with side effect functions

2012-01-06 Thread Alan Malloy
On Jan 6, 7:32 pm, Cedric Greevey wrote: > On Fri, Jan 6, 2012 at 10:22 PM, Alan Malloy wrote: > > On Jan 6, 6:16 pm, Cedric Greevey wrote: > >> On Fri, Jan 6, 2012 at 4:34 PM, Alan Malloy wrote: > >> > On Jan 6, 12:56 pm, Jozef Wagner wrote: > >> >> Thank you, > > >> >> But the things are mor

Re: marking deprecated functions, namespaces or other?

2012-01-06 Thread Phil Hagelberg
Dave Sann writes: > I sometimes have need to change the names of fns in some of my libs. > > As I was doing this, I wondered - is there a way to mark a function or > namespace or other as deprecated? > > I have not seen anything to this effect. Here's what I use in Leiningen: https://github.com

Re: On using atoms together with side effect functions

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 10:22 PM, Alan Malloy wrote: > On Jan 6, 6:16 pm, Cedric Greevey wrote: >> On Fri, Jan 6, 2012 at 4:34 PM, Alan Malloy wrote: >> > On Jan 6, 12:56 pm, Jozef Wagner wrote: >> >> Thank you, >> >> >> But the things are more complicated. In my case, I need to update the atom

marking deprecated functions, namespaces or other?

2012-01-06 Thread Dave Sann
I sometimes have need to change the names of fns in some of my libs. As I was doing this, I wondered - is there a way to mark a function or namespace or other as deprecated? I have not seen anything to this effect. if not, would it be feasible to mark a function/namespace with a ^:deprecated m

Re: On using atoms together with side effect functions

2012-01-06 Thread Alan Malloy
On Jan 6, 6:16 pm, Cedric Greevey wrote: > On Fri, Jan 6, 2012 at 4:34 PM, Alan Malloy wrote: > > On Jan 6, 12:56 pm, Jozef Wagner wrote: > >> Thank you, > > >> But the things are more complicated. In my case, I need to update the atom > >> with the result of a (native) function which unfortunat

Re: On using atoms together with side effect functions

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 4:34 PM, Alan Malloy wrote: > On Jan 6, 12:56 pm, Jozef Wagner wrote: >> Thank you, >> >> But the things are more complicated. In my case, I need to update the atom >> with the result of a (native) function which unfortunately also performs >> some side effects and cannot b

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread Takahiro Hozumi
> ($ (css ))> > could wire an atom to a css (or > other) dom attribute, by placing a> watcher on the atom and automatically > updating the dom on change.Interesting idea! On 1月7日, 午前5:02, kovas boguta wrote: > Great, looking forward to see what Chris has come up with. I'm not > enough of a JS

add records in mysql????

2012-01-06 Thread jayvandal
i am using leinningen and mysql example. I can select records as: (defn list-ausers [] (sql/with-connection db (sql/with-query-results rows ["SELECT * FROM books WHERE BOOK_ID = '1'"] (println rows but I can't insert records,i doesn't like the query as: (defn add-ausers [

Re: add records in mysql????

2012-01-06 Thread jayvandal
I tried this code : (defn add-ausers [user] (sql/with-connection db (sql/insert-record :books user ["INSERT INTO books(BOOK_ID, BOOK_NAME, BOOK_PRICE, BOOK_AUTHOR) VALUES('%','joe','12', 'siley')"]; (println rows user=> (mysql.core/add-ausers) java.sql.SQLException: Can

[Tutorial] Making core.logic work with custom data structures

2012-01-06 Thread Tassilo Horn
Hi all, after spending the last two days making clojure.core.logic work with our custom Java data structures, I decided to write a short blog posting about it. Here it is: http://tsdh.wordpress.com/2012/01/06/using-clojures-core-logic-with-custom-data-structures/ A bunch of compliments and t

Re: On using atoms together with side effect functions

2012-01-06 Thread Alan Malloy
On Jan 6, 12:56 pm, Jozef Wagner wrote: > Thank you, > > But the things are more complicated. In my case, I need to update the atom > with the result of a (native) function which unfortunately also performs > some side effects and cannot be split in two. > > Updated example: > > (def state {:resul

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread Shantanu Kumar
Thanks everybody for responding. I will look at the mentioned projects. Shantanu On Jan 7, 1:12 am, ckirkendall wrote: > Chris, > I am interested in your challenges.  For Enfocus I had to implement > several features that existed in jquery around events (mouseenter, > mouseleave, window resize)

Re: Storing clojure lists and maps in Redis

2012-01-06 Thread Alex Miller
BTW, I have not done an actual release of Carbonite to put it out in the repos but I hope to get around to that soon. I have been a bit busy with Clojure/West. :) I plan to set it up in our Revelytix CI server so it can be regularly tested as well. On Jan 6, 12:27 pm, Sam Ritchie wrote: > Pete

Re: On using atoms together with side effect functions

2012-01-06 Thread Jozef Wagner
Thank you, But the things are more complicated. In my case, I need to update the atom with the result of a (native) function which unfortunately also performs some side effects and cannot be split in two. Updated example: (def state {:result nil :input [1 2 3]}) (defn update-item! [item]

Re: On using atoms together with side effect functions

2012-01-06 Thread Dave Ray
On Fri, Jan 6, 2012 at 3:02 PM, Jozef Wagner wrote: > Consider this contrived piece of code: > > (def aval (atom {:dumped false :contents "hello world"})) > > (defn update! >   [item] >   (when-not (:dumped item) >     (spit "a.out" (:contents item) :append true) >     (assoc item :dumped true)))

Re: add records in mysql????

2012-01-06 Thread Allen Johnson
You'd want to use one of the insert functions for that: (defn add-user [user] (sql/with-connection db (sql/insert-record :books user))) http://clojure.github.com/java.jdbc Allen On Fri, Jan 6, 2012 at 3:13 PM, jayvandal wrote: > i am using leinningen  and mysql example. I can select reco

add records in mysql????

2012-01-06 Thread jayvandal
i am using leinningen and mysql example. I can select records as: (defn list-ausers [] (sql/with-connection db (sql/with-query-results rows ["SELECT * FROM books WHERE BOOK_ID = '1'"] (println rows but I can't insert records,i doesn't like the query as: (defn add-ausers [

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread ckirkendall
Chris, I am interested in your challenges. For Enfocus I had to implement several features that existed in jquery around events (mouseenter, mouseleave, window resize) but I wanted to keep the stack pure without any external dependencies. Enfocus might have been easier to implement if I had chos

On using atoms together with side effect functions

2012-01-06 Thread Jozef Wagner
Consider this contrived piece of code: (def aval (atom {:dumped false :contents "hello world"})) (defn update! [item] (when-not (:dumped item) (spit "a.out" (:contents item) :append true) (assoc item :dumped true))) How should I correctly call update! ? Each of following two calls ha

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread kovas boguta
Great, looking forward to see what Chris has come up with. I'm not enough of a JS pro to be the one doing this. I think what matters is the design. Jquery is an accessible implementation target, but if someone wants to retarget the design to gclosure, thats fine too (just more work than is need to

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

2012-01-06 Thread Mark
Great! 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

Enlive reborn in ClojureScript - Enfocus (Dom Manipulation Lib)

2012-01-06 Thread ckirkendall
Since some very cool side bar conversations at clojure conj I have been bent on porting Enlive to ClojureScript. It has finally reach a point where it is stable and useful, so I give you: Enfocus. Enfocus is a dom manipulation library for ClojureScript. Originally inspired by Christophe Grand's c

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

2012-01-06 Thread Tassilo Horn
Mark writes: Hi Mark, > I'm very interested in using core.logic to query a relational database > or other data store. I figure querying custom java objects is a good > example of how to tackle this problem. > > Would you mind posting your code somewhere? I want to write a blog posting about it

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

2012-01-06 Thread Tassilo Horn
Phil Hagelberg writes: Hi Phil, >> (run* [q] (wrongo 1 2)) >> ; ClassCastException java.lang.Boolean cannot be cast to >> ; clojure.lang.IFn clojure.core.logic.Substitutions (logic.clj:207) >> >> But where is my backtrace? > > The Clojure REPL has actually never provided stack traces for

Re: How would I learn more about Clojure's class loading system?

2012-01-06 Thread Daniel Bell
Thanks for your help everyone. I think I'll make this a belated New Year's resolution. On Jan 6, 12:51 am, Brent Millare wrote: > Hi Daniel, > > I asked a question about the process of class reloading for different > clojure constructs. The following link may be helpful to you. > > http://stacko

Re: conj doesnt work consistently on records

2012-01-06 Thread Chris McBride
Ohh, ok that makes sense now. Thanks. On Jan 6, 1:01 pm, Meikel Brandmeyer wrote: > Hi, > > Am 06.01.2012 um 18:23 schrieb Chris McBride: > > > (defrecord Person [name address]) > > > (def bob (map->Person {:name "bob"})) > > > (prn (conj bob {:address "123 main st"}))  ;#user.Person{:name > > "b

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread Chris Granger
So there's pinot, but I've come to a relatively similar conclusion to Kovas that wrapping the goog libs aren't really the way to go. For one, I was basically replicating aspects of jQuery (like event delegation). Recently I started on doing some thing that makes jQuery play in the Clojure world re

Re: Storing clojure lists and maps in Redis

2012-01-06 Thread Sam Ritchie
Peter, Check out Carbonite for a great wrapper library around Kryo. Here are the API tests, with round trip examples: https://github.com/revelytix/carbonite/blob/master/test/carbonite/test_api.clj . Cheers, Sam On Fri, Jan 6, 2012 at 1:30 AM, Peter Taoussanis wrote: > Tim's the one to thank: I

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

2012-01-06 Thread Phil Hagelberg
Tassilo Horn writes: > The "; Evaluation aborted." instantly appears. No backtrace, no error > message, not even in the *swank* buffer. > > If I use a plain "lein repl" instead, I get at least an error message: > > (run* [q] (wrongo 1 2)) > ; ClassCastException java.lang.Boolean cannot be ca

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

2012-01-06 Thread Mark
I'm very interested in using core.logic to query a relational database or other data store. I figure querying custom java objects is a good example of how to tackle this problem. Would you mind posting your code somewhere? -- You received this message because you are subscribed to the Google

Re: conj doesnt work consistently on records

2012-01-06 Thread Meikel Brandmeyer
Hi, Am 06.01.2012 um 18:23 schrieb Chris McBride: > (defrecord Person [name address]) > > (def bob (map->Person {:name "bob"})) > > (prn (conj bob {:address "123 main st"})) ;#user.Person{:name > "bob", :address "123 main st"} > (prn (conj {:address "123 main st"} bob)) ;{:name "bob", :addres

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

2012-01-06 Thread Tassilo Horn
Anthony Grimes writes: Hi Anthony, > The last stacktrace that occurred in a REPL is bound to *e. Try > (.printStackTrace *e). That should work in the REPL. Might not in > SLIME. Yes, that does the trick. Ambrose also pointed me to (clojure.repl/pst *e) which is as good. Thanks, Tassilo -- Y

conj doesnt work consistently on records

2012-01-06 Thread Chris McBride
(defrecord Person [name address]) (def bob (map->Person {:name "bob"})) (prn (conj bob {:address "123 main st"})) ;#user.Person{:name "bob", :address "123 main st"} (prn (conj {:address "123 main st"} bob)) ;{:name "bob", :address nil} The first print statement behaves how I would expect, the

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread kovas boguta
Yes. I've created a jquery wrapper conveniently called cljs-jquery , however there is no documentation, tests, or general housekeeping yet so haven't announced it. If you are brave, https://github.com/kovasb/cljs-jquery Previous libraries have followed the lead of the initial Clojurescript exampl

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread ckirkendall
I have written dom manipulation library for ClojureScript. I just finished it up but haven't announced it yet. It started out as a port of enlive to ClojureScript but has evolved into something much more powerful. I covers everything from event handling, effects and standard transformations. Be

Re: where's let* ?

2012-01-06 Thread Ambrose Bonnaire-Sergeant
Hi Andrew, let* is a compiler special form. You will find it referenced in clojure.lang.Compiler in the map of special forms. AFAIK there is no reason to use it directly. Thanks, Ambrose On Sat, Jan 7, 2012 at 12:53 AM, Andrew wrote: > I have spent a little time trying to find the source code

where's let* ?

2012-01-06 Thread Andrew
I have spent a little time trying to find the source code for let* and have so far failed :-P Can someone help me? (source let) points to a use of let* I can see the definition of let at github in clojure/clojure ... src core.clj... But I can't find let* Thanks in advance! -- You

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

2012-01-06 Thread Anthony Grimes
The last stacktrace that occurred in a REPL is bound to *e. Try (.printStackTrace *e). That should work in the REPL. Might not in SLIME. -- 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 Not

Re: question from wikibooks page on macros?

2012-01-06 Thread Andrew
I see. That section is just horribly written, calling something a macro when it isn't one yet. Here's my thinking in **bold**, inlined. Simple Macro If you understand the reader and evaluator, there actually isn't all that much more to understand about the operation and creation of macros, for

Re: question from wikibooks page on macros?

2012-01-06 Thread Jeff Heon
You are right. Keep reading a bit and it says "But as we defined pointless above, it is just a regular function, not a macro." And you can verify the pointless macro using macro-expand as shown later.(macroexpand '(pointless (+ 3 5)))=>  (+ 3 5) On Jan 6, 11:12 am, Andrew wrote: > http://en.wikibo

Re: question from wikibooks page on macros?

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 11:12 AM, Andrew wrote: > http://en.wikibooks.org/wiki/Learning_Clojure/Macros > > The page says the following: > > (def pointless (fn [n] n)) > > "Whatever is passed to this macro---a list, a symbol, whatever---will be > returned unmolested and then evaluated after the call

question from wikibooks page on macros?

2012-01-06 Thread Andrew
http://en.wikibooks.org/wiki/Learning_Clojure/Macros The page says the following: (def pointless (fn [n] n)) "Whatever is passed to this macro---a list, a symbol, whatever---will be returned unmolested and then evaluated after the call. Effectively, calling this macro is pointless:" (pointles

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Jonathan Cardoso
Thanks a lot, guys!! I know there was a simple way!! -- 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 pos

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Ambrose Bonnaire-Sergeant
user=> (sort-by second [[0 25] [1 5] [2 70]]) ([1 5] [0 25] [2 70]) On Fri, Jan 6, 2012 at 11:29 PM, Jonathan Cardoso wrote: > Hi! I have a small stupid question and I hope you guys can help me... > > I wanted to sort a vetor, say [25 5 70] but I can't just use any sort > algorithm because later

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 10:29 AM, Jonathan Cardoso wrote: > Hi! I have a small stupid question and I hope you guys can help me... > > I wanted to sort a vetor, say [25 5 70] but I can't just use any sort > algorithm because later I will need to get the index of the element in the > original vector.

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Daniel Janus
(sort-by second (map-indexed vector [25 5 70])) -- 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

Sort a vector and keep the elements' indexes

2012-01-06 Thread Jonathan Cardoso
Hi! I have a small stupid question and I hope you guys can help me... I wanted to sort a vetor, say [25 5 70] but I can't just use any sort algorithm because later I will need to get the index of the element in the original vector. When I use: (map-indexed vector [25 5 70]) I get ( [0 25] [1

Re: topoged-hibernate 1.0.0

2012-01-06 Thread Bill Robertson
On Jan 3, 4:26 pm, "Matthew O. Smith" wrote: > There is a mismatch between hibernate maps and clojure maps which > means that there is some translating between them. Hopefully, this > will be smoothed over in the future What is the mismatch? -- You received this message because you are subsc

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

2012-01-06 Thread Tassilo Horn
Hi all, I'm still playing around with core.logic and managed to define relations that allow for querying my custom java datastructures with it. Thanks a ton to Ambrose, who has helped me a lot! One thing that really made the programming extremely hard was that I don't get any backtraces if an ex

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread Shantanu Kumar
On Jan 6, 1:23 pm, Mark Rathwell wrote: > Pinot [1] provides some dom manipulation [2], mostly wrapping goog.dom > stuff.  Were you thinking more than that? Thanks for mentioning. I will take a deeper look. Shantanu -- You received this message because you are subscribed to the Google Groups

Re: Storing clojure lists and maps in Redis

2012-01-06 Thread Peter Taoussanis
Tim's the one to thank: I didn't do much :) > I did some rudimentary bench marking for large data sets and found > deep-freeze to be 10 times faster on > average compared to JSON serialization. That is really a huge > performance difference. Some final comments if performance really is a major f

Re: How would I learn more about Clojure's class loading system?

2012-01-06 Thread Brent Millare
Hi Daniel, I asked a question about the process of class reloading for different clojure constructs. The following link may be helpful to you. http://stackoverflow.com/questions/7471316/how-does-clojure-class-reloading-work -- You received this message because you are subscribed to the Googl

Re: ClojureScript DOM-manipulation library?

2012-01-06 Thread Mark Rathwell
Pinot [1] provides some dom manipulation [2], mostly wrapping goog.dom stuff. Were you thinking more than that? [1] https://github.com/ibdknox/pinot [2] https://github.com/ibdknox/pinot/blob/master/src/pinot/dom.cljs On Fri, Jan 6, 2012 at 3:16 AM, Shantanu Kumar wrote: > Is anybody working on

Re: LCUG: 17th January 2012, Malcolm Sparks - Reflections on a real-world Clojure application

2012-01-06 Thread Philip Potter
I can't confirm anything about this talk, but skillsmatter usually record talk videos and post them online. Phil On Jan 6, 2012 4:47 AM, "Craig" wrote: > > On Jan 5, 11:56 am, Kevin Lynagh wrote: > > Any chance the talk will be filmed and posted online? > > +1. > > Or slides posted? > > -- > Yo

Re: Storing clojure lists and maps in Redis

2012-01-06 Thread Shoeb Bhinderwala
Peter/Tim - Also want to commend you on this amazing high performant library (deep- freeze) that you have written. Shoeb On Jan 6, 3:05 am, Shoeb Bhinderwala wrote: > Thanks a lot Peter. Worked great! I did some rudimentary bench marking > for large data sets and found deep-freeze to be 10 time

ClojureScript DOM-manipulation library?

2012-01-06 Thread Shantanu Kumar
Is anybody working on a DOM-manipulation library for ClojureScript? There are several JavaScript libraries that can probably be wrapped, but a ClojureScript library should be great. I noticed a short comparative list of jQuery basic operations vs JavaScript equivalent that looks interesting: http:

Re: Storing clojure lists and maps in Redis

2012-01-06 Thread Shoeb Bhinderwala
Thanks a lot Peter. Worked great! I did some rudimentary bench marking for large data sets and found deep-freeze to be 10 times faster on average compared to JSON serialization. That is really a huge performance difference. On Jan 6, 2:19 am, Peter Taoussanis wrote: > Oh wow, sorry- I didn't see