Re: Implemented isa? as a protocol, makes multimethods more open
Can this be used in clojurescript? It looks like yes But, taking the given clj example, my first question is how can I extend a protocol to the equivalent of IPersistentMap. Given that maps in clojurescript are protocols, this seems harder. D On Wednesday, 11 July 2012 16:52:47 UTC+10, Leif wrote: > > Thanks! > > The similarity is no accident: When you consider it, 'isa?' is a > generalized subtyping relation: > > (isa? Double Number) ==> Double <: Number > (isa? ::goat ::animal) ==> ::goat <: ::animal > (isa? 1 x) ==> #{1} <: x, which makes sense if you define the value x to > mean "the set of all things equivalent to x" > > Specifically for the keyword case, clojure.core lets you define ad hoc > hierarchies, which you could view as type lattices. This project lets you > define ad hoc type lattice relations. > > You might be interested in the papers on LIFE. They define "sorts" for > logic terms (very much like types), and an algorithm for unifying two terms > (which can be quite a bit more complicated than Prolog terms). > > On Wednesday, July 11, 2012 2:22:51 AM UTC-4, Ambrose Bonnaire-Sergeant > wrote: >> >> This is cool :) >> >> It reminds me of subtyping between maps in Typed Clojure, where >> >> {:a 1, :b 2} <: {:a Number} >> >> Thanks, >> Ambrose >> >> On Wed, Jul 11, 2012 at 2:16 PM, Leif wrote: >> >>> Hi, everybody. I reimplemented the function isa? in terms of a protocol >>> Is-A. >>> >>> The reason why you would want to do that is in the README at >>> https://github.com/leifp/clj-isa-protocol >>> >>> tl;dr: One of the reasons why people are excited about predicate >>> dispatch is the irritation caused by the dispatch function of a multimethod >>> being closed. You have to decide up front what information the dispatch fn >>> is going to pull out of your arguments. Changing it afterward is a pain. >>> >>> Since the dispatch uses 'isa?' internally, if that function is >>> extensible, then multimethod dispatch becomes, to a certain extent, open. >>> See the README. >>> >>> Comments, critique, code, and questions welcome. >>> >>> Cheers, >>> Leif >>> >>> P.S. As an aside to people that like weird, obscure programming >>> languages, the rough idea of how is-a? should work for maps was inspired by >>> (but very much simpler than) the functional logic language LIFE [ >>> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.90.3175 ] >>> >>> -- >>> 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 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
Re: ClojureC - A Clojure to C compiler - Work in Progress
Take a look at the tiny lua objective-c bridge as a reference. https://github.com/fjolnir/TLC or language Nu http://programming.nu/index On Tuesday, July 10, 2012 6:20:48 AM UTC-7, Mark Probst wrote: > > On Mon, Jul 9, 2012 at 7:03 PM, Adam King wrote: > > However, thanks for your work on this! In the next couple of days, > I'll > > see if I can get it compiling and running under iOS. > > Wonderful! > > If you're interested in working on Objective-C interop, let me know - > I have a few ideas. > > Mark > -- 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
ANN: mcmc: a Clojure Library for MCMC Computations
Hello all, I just posted a library for MCMC (Markov Chain Monte Carlo) computations in Clojure on GitHub: https://github.com/farr/mcmc-clojure It is *very much* in a 0.0.1 state, but I have found it useful for a few astrostatistics projects I've done---in other words, there isn't a lot there, it lacks documentation, but what *is* present works and has been tested pretty carefully. The library includes an implementation of emcee ("The MCMC Hammer;" see http://danfm.ca/emcee/ ) that is fully parallel. If anyone has questions or wants to contribute to fleshing the library out, feel free to contact me off- or on-list to discuss. Hoping folks find this useful, Will -- 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
DAG (Direct Acyclic Graph) and Bayesian Network help
Hi guys, I'm trying to develop a Bayesian Network just "for fun" XD My first problem is to understand how represent the graph necessary a DAG. I come out with something : https://gist.github.com/3111539 (Very very first stage I just finish to write this code) But I have some question to how represent properly the DAG. I need to map every child of every node, or I just need to know the (non-)descendants of every node ? Why ? Do you have any useful link that I can use ? Thank you guys anyway. PS: This is still me http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474 -- 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
Re: DAG (Direct Acyclic Graph) and Bayesian Network help
Chas Emerick did a presentation on this: http://blip.tv/clojure/chas-emerick-modeling-the-world-probabilistically-using-bayesian-networks-in-clojure-5961126 But AFAIK the "raposo" library has not been published yet. On Saturday, July 14, 2012 4:20:17 PM UTC+2, Simone Mosciatti wrote: > > Hi guys, > I'm trying to develop a Bayesian Network just "for fun" XD > > My first problem is to understand how represent the graph necessary a DAG. > > I come out with something : https://gist.github.com/3111539 > (Very very first stage I just finish to write this code) > > But I have some question to how represent properly the DAG. > > I need to map every child of every node, or I just need to know the > (non-)descendants of every node ? Why ? > > Do you have any useful link that I can use ? > > Thank you guys anyway. > > PS: This is still me > http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474 > -- 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
Re: DAG (Direct Acyclic Graph) and Bayesian Network help
Yes, I already saw that... But without code doesn't help so much... On Saturday, July 14, 2012 7:24:41 PM UTC+2, Walter van der Laan wrote: > > Chas Emerick did a presentation on this: > http://blip.tv/clojure/chas-emerick-modeling-the-world-probabilistically-using-bayesian-networks-in-clojure-5961126 > > But AFAIK the "raposo" library has not been published yet. > > On Saturday, July 14, 2012 4:20:17 PM UTC+2, Simone Mosciatti wrote: >> >> Hi guys, >> I'm trying to develop a Bayesian Network just "for fun" XD >> >> My first problem is to understand how represent the graph necessary a DAG. >> >> I come out with something : https://gist.github.com/3111539 >> (Very very first stage I just finish to write this code) >> >> But I have some question to how represent properly the DAG. >> >> I need to map every child of every node, or I just need to know the >> (non-)descendants of every node ? Why ? >> >> Do you have any useful link that I can use ? >> >> Thank you guys anyway. >> >> PS: This is still me >> http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474 >> > -- 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
Re: Tail-recursive lazy sequence construction by appending to the end of accumulator problem.
Alexander Semenov writes: > The second lazy approach still needs to traverse all the sequence > recursively, why doesn't it cause stack overflow? You might find my answer to the StackOverflow question "Thinking in Lazy Sequences" useful here: http://stackoverflow.com/a/2214049/31818 Note that I wrote it about a year and a half ago. I hope the references to the Java classes are still correct. -- Steven E. Harris -- 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
Re: Implemented isa? as a protocol, makes multimethods more open
You could probably make it work in cljs by: 1. Putting IMultiMethod back to cljs version, except using is-a?, not core/isa? 2. Rewrite the Is-A protocol code to use the cljs rules: - Remove any code about class hierarchies - Only extend Is-A on actual types, so cljs.core.Vector, not IPersistentVector, cljs.core.ObjMap, not IPersistentMap Of course, I have maybe 2 days total of cljs experience, so an expert can jump on this thread any time :) . Re: #2 above, is what I'm doing in my JVM clojure code (extending on IPersistentVector, etc.) considered bad form? I ask because: - from http://clojure.org/protocols : "You can implement a protocol on an interface... opens the door to incidental multiple inheritance of implementation... which [interface] is used is unspecified." When I read that, I thought "Oh, lord. I'm going to have a horrible C++ nightmare tonight." - But I've seen extension on interfaces in basically all of the JVM clojure.core.* code. Are they using some undocumented convention so that the above problem won't happen? Also, does someone know of a good example of testing code that modifies global state? Right now I'm adding multimethods and derive-ing things, extending protocols, etc.. I'd like to make sure tests don't interfere with each other. This might all be off topic. Should I start a new thread (or two)? --Leif On Saturday, July 14, 2012 4:44:37 AM UTC-4, Dave Sann wrote: > > Can this be used in clojurescript? > > It looks like yes > > But, taking the given clj example, my first question is how can I extend a > protocol to the equivalent of IPersistentMap. Given that maps in > clojurescript are protocols, this seems harder. > > D > > > On Wednesday, 11 July 2012 16:52:47 UTC+10, Leif wrote: >> >> Thanks! >> >> The similarity is no accident: When you consider it, 'isa?' is a >> generalized subtyping relation: >> >> (isa? Double Number) ==> Double <: Number >> (isa? ::goat ::animal) ==> ::goat <: ::animal >> (isa? 1 x) ==> #{1} <: x, which makes sense if you define the value x to >> mean "the set of all things equivalent to x" >> >> Specifically for the keyword case, clojure.core lets you define ad hoc >> hierarchies, which you could view as type lattices. This project lets you >> define ad hoc type lattice relations. >> >> You might be interested in the papers on LIFE. They define "sorts" for >> logic terms (very much like types), and an algorithm for unifying two terms >> (which can be quite a bit more complicated than Prolog terms). >> >> On Wednesday, July 11, 2012 2:22:51 AM UTC-4, Ambrose Bonnaire-Sergeant >> wrote: >>> >>> This is cool :) >>> >>> It reminds me of subtyping between maps in Typed Clojure, where >>> >>> {:a 1, :b 2} <: {:a Number} >>> >>> Thanks, >>> Ambrose >>> >>> On Wed, Jul 11, 2012 at 2:16 PM, Leif wrote: >>> Hi, everybody. I reimplemented the function isa? in terms of a protocol Is-A. The reason why you would want to do that is in the README at https://github.com/leifp/clj-isa-protocol tl;dr: One of the reasons why people are excited about predicate dispatch is the irritation caused by the dispatch function of a multimethod being closed. You have to decide up front what information the dispatch fn is going to pull out of your arguments. Changing it afterward is a pain. Since the dispatch uses 'isa?' internally, if that function is extensible, then multimethod dispatch becomes, to a certain extent, open. See the README. Comments, critique, code, and questions welcome. Cheers, Leif P.S. As an aside to people that like weird, obscure programming languages, the rough idea of how is-a? should work for maps was inspired by (but very much simpler than) the functional logic language LIFE [ http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.90.3175 ] -- 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 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