Re: Designing API for a Markov Model
Is there a limited number of models? The model should stay decoupled from the state as they are totally distinct so general-fn[model old-state] - new-state then either you (if you know the model) or the user if they can choose any model should define a partial fn partial specific-model-fn general-fn[model] so that it is always clear which model is being used to idiot proof the situation, which was your worry the partial fn can then be used with all the clojure goodies such as iteration and reduction as jony hudsun has pointed out all I am adding to the debate is suggesting having a named partial fn named after the model you are using, for clarity On Sunday, September 14, 2014 3:28:10 AM UTC+1, RJ Nowling wrote: Hi all, I'm new to Clojure and implementing a Markov Model as part of a larger project. I'd like some advice on the API for a progress-state function. I see two possible options. In the first option, we always ask the user to provide and keep track of the MSM state themselves: (progress-state markov-model previous-state) - new-state In the second approach, we create a record that combines a model and a current state: (defrecord MarkovProcess [model current-state]) (progress-state markov-process) - updated-markov-process, new-state Which of these approaches is more idiomatic for Clojure? Are multiple return types an accepted practice in Clojure? Is there a third, better way? Thanks in advance! RJ -- 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/d/optout.
Re: Is Clojure a language for growth?
I'd agree with this. A closely held (financially) company with a small team of very bright programmers (preferably with a decent stake in the outcome so they stay around) will be able to exploit the power and productivity of clojure to do with a small team fast what would need far more people in Java The type of company that wants to throw money and people at a project to scale it up would be a disaster with Clojure. Even the people that manage to master functional programming won't be able to understand each other's code because it tends to be more abstract and there are more ways of expressing things. Java is a brilliant lowest common denominator language where your options are deliberately restricted and you really have to spell everything out explicitly so any idiot with a debugger can work out what is going on. As a general point about doing anything 'new' if the guy where the buck stops is driving it, it can be made to work/covered up if it goes wrong. If you are NOT the guy where the buck stops but are the guy with his name against a decision then as soon as anything goes wrong whether it has anything to do with the technology choice or not you become mr fall guy, to be blamed and fired so that other people can keep their jobs. Seen it happen so many times. On Wednesday, August 20, 2014 4:51:44 PM UTC+1, jonah wrote: To add a data point to this, while the technology is great, it is not necessarily right for all companies at all lifecycle stages. My experience has been that C++ skills and interests don't necessarily translate directly to Clojure. The kinds of microdecisions one makes in modeling, algorithm design and so forth are quite different, and the costs one optimizes for in C++ land don't make sense in Clojure. What I have seen more often is motivated C++ers transition to Scala- getting up to speed on the JVM and the APIs, get a little bit of a REPL, while retaining types and compilation and a lot of the mental model- and then go from Scala to Clojure. But since Clojure is a different toolchain and level of abstraction, changing both at the same time even for the motivated can be a bridge too far. I would also not look at Clojure as a commodity tool, in the enterprise IT staffing model where one wants to just be able to throw bodies at problems, shift them around between teams, scale them up and down quickly with fluidity between staff and consultant roles. It's currently significantly more specialized and elite than that. On the flip side, because it is a different level of abstraction, the right team + Clojure can be incredibly productive in a wide variety of domains. If you have a budget and can afford to frame a Proof-of-Concept in your domain for a consulting team to demonstrate this, I would highly recommend getting in touch with Cognitect themselves. I don't think it is widely known that aside from being the creators of Clojure and Datomic, they have an extremely proficient consulting practice. Watching them work can be mind-blowing, from both technical and management perspectives. On Wed, Aug 20, 2014 at 11:06 AM, Nando Breiter na...@aria-media.com javascript: wrote: Perhaps the question is more Is your boss (or company) suitable for Clojure? On Wed, Aug 20, 2014 at 2:56 PM, Joshua Ballanco jbal...@gmail.com javascript: wrote: My advice on convincing your boss to use Clojure for a new project: don’t. Projects succeed or fail for any number of different reasons, but I can guarantee you that if you *start* a new project with Clojure, and it does happen to fail, then the choice of Clojure will bear the brunt of the blame whether it deserves it or not. -- 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 javascript: 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/d/optout. -- 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
Re: Is Clojure a language for growth?
Whenever there is an external institutional stakeholder it is almost guaranteed to happen. Someone in that external institution has a bonus or promotion depending on the outcome, and will demand results. They will also have penalty clauses in the contract which can be anything from non-payment, to seizing control of a start up, or even shutting it down. I have seen it happen myself in England and Germany, and there are plenty of well documented cases from the States so I don't think it is culturally dependent in the sense of national culture. If you live in a blame free society let us know where as it would be an excellent place for a start up! On Wednesday, August 20, 2014 7:16:55 PM UTC+1, Henrik Eneroth wrote: … as soon as anything goes wrong whether it has anything to do with the technology choice or not you become mr fall guy, to be blamed and fired so that other people can keep their jobs. Seen it happen so many times. Good lord, truly? Perhaps this is a good time to ask what culture OP lives in. This wouldn't happen where I live/work. -- 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/d/optout.
Re: Is Clojure a language for growth?
Just looked at your profile. Sweden? A very enlightened place. I am a big fan of the Paradox Interactive games. What happens in Sweden when investors lose their money? On Wednesday, August 20, 2014 7:16:55 PM UTC+1, Henrik Eneroth wrote: … as soon as anything goes wrong whether it has anything to do with the technology choice or not you become mr fall guy, to be blamed and fired so that other people can keep their jobs. Seen it happen so many times. Good lord, truly? Perhaps this is a good time to ask what culture OP lives in. This wouldn't happen where I live/work. -- 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/d/optout.
Re: Is Clojure a language for growth?
If an investor were kicking people out, its usually because money is running low or for other more diffuse reasons. If an investor or boss somewhere where kicking out people at random, he would quickly loose respect from his other employeers. The rest would soon leave as well. Hence the need for a scapegoat. Generally if an investor can make 20% of their startups work, people will blame the technologists for the failure of the other 80%, and the investor will have a PR machine to distort the history if needed. But yes, startup hubs work best when there are angel investors who want to build a personal reputation or where the institutional investors have strong links with the universities producing the start up talent and so don't want to jeopardise those (eg the Stanford University system). Even the best VCs will shut down the majority of their start ups though, so you'd think that would make people avoid them, but there are always people out there who need money to try and realise their dreams. All a bit tangential to the the original thread question though, which was assuming a high growth, high pressure, scale it up fast, need results kind of culture, would Clojure be a good fit? On Wednesday, August 20, 2014 11:46:48 PM UTC+1, Linus Ericsson wrote: Well, for better or worse we don't like conflicts that much. This has benefits when it comes to some kinds of problem solving (the way to consensus in Swedish companies is worth at least a chapter in a big book about antrophology). This shyness for open conflicts can lead to stagnation. This means that status quo is not turned over that easily, but when it does, it happens like an avalanche (cow oscillator comes to mind). Stockholm University has Clojure and Erlang in its second year curriculum for computer science. Just saying. Apart from that, its 3kloc database queries and Java classes galore and Wordpress shops all over, like everywhere else. The single larges group of workers in Stockholm is of course computer programmer. 33000 people out of a million of so. If an investor were kicking people out, its usually because money is running low or for other more diffuse reasons. If an investor or boss somewhere where kicking out people at random, he would quickly loose respect from his other employeers. The rest would soon leave as well. In Sweden we have a system... the ironic saying goes, but the truth is that even though the housing situation is outright catastrophic, you would not ever be put on the street if you wasn't psychotic enough not to accept the help offered (worst case you would end up in a sad, sleepy, far far out suburb with long commuting distances, but hey). The social security system is simply generous enough to make sure people gets back on track, should it be long time unemployment or whatever (this, and elderly care jobs, are powering much of the popular music industry here). Ah, everybody generalizes all the time. Henrik can nuance the picture. I have been programming and promoting Clojure quite aggressively for some years (it's hard not to), and the last months people have been starting to say yeah, my java friends really likes it or yes, my bf likes it too. Wind of change. /Linus working at Agical AB, a consultancy in love with technology and sometimes hosting Clojure Meet ups with Stockholm Clojure User Group and wov, so much thing I really can help companies with everywhere, epic win On Wednesday, August 20, 2014, Quzanti quz...@googlemail.com javascript: wrote: Just looked at your profile. Sweden? A very enlightened place. I am a big fan of the Paradox Interactive games. What happens in Sweden when investors lose their money? On Wednesday, August 20, 2014 7:16:55 PM UTC+1, Henrik Eneroth wrote: … as soon as anything goes wrong whether it has anything to do with the technology choice or not you become mr fall guy, to be blamed and fired so that other people can keep their jobs. Seen it happen so many times. Good lord, truly? Perhaps this is a good time to ask what culture OP lives in. This wouldn't happen where I live/work. -- 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/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post
Dynamic record creation
Hello. I need to dynamically define records Suppose I have a record (defrecord Person [name age]) Then to dynamically construct an instance I do a much more complex version of (concat [(symbol Person.)] [Peter] [18]) Where things like Peter and the class of the record are actually the results of complicated functions but I have just used simple values here for illustration The problem is I now have a lazy seq, not a record I can do an eval (eval (concat [(symbol Person.)] [Peter] [18])) But eval is evil. So I think my approach is wrong. Any suggestions much appreciated -- 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: Dynamic record creation
On Feb 4, 2:23 am, Kevin Downey redc...@gmail.com wrote: whole crazy concat thing which has nothing to do with anything I probably should have clarified that the reason I need concat is that various functions are returning subsets of the arguments as vectors, but as stated to keep things simple in the example I just used values -- 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: Dynamic record creation
Thanks - that might well be part of the solution Person. is dynamically determined (i.e the result of a fn too) So I guess I am asking is there a way to dynamically resolve a classname? I found this http://dev.clojure.org/jira/browse/CLJ-370?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel Does anyone know anything more about it, or where the sourcecode would be? On Feb 4, 2:44 am, Aaron Cohen aa...@assonance.org wrote: On Thu, Feb 3, 2011 at 9:36 PM, Quzanti quza...@googlemail.com wrote: On Feb 4, 2:23 am, Kevin Downey redc...@gmail.com wrote: whole crazy concat thing which has nothing to do with anything I probably should have clarified that the reason I need concat is that various functions are returning subsets of the arguments as vectors, but as stated to keep things simple in the example I just used values Were you aware that records support assoc (and as a side-effect, merge)? You end up with a new record as with all clojure immutable datastructures, but this is how you can build records up a piece at a time. (defn complicated-function [params] (let [p (Person. nil nil) parammap (zipmap [:name :age] params)] (merge p parammap))) user= (complicated-function [Aaron 31]) #:user.Person{:name aaron, :age 31} --Aaron -- 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: Dynamic record creation
On Feb 4, 2:47 am, Kevin Downey redc...@gmail.com wrote: if you really want to keep things simple you should just say '(Person. ... 18) without all the concat noise the solution becomes obvious. you have a form (new Person X Y), you want to execute the code with different values bound to X and Y at runtime, sounds like a function to me. No because Person is the result of a fn (constucted from Strings) the the values are returned from other fns in groups -- 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: Dynamic record creation
On Feb 4, 2:55 am, Kevin Downey redc...@gmail.com wrote: I strongly recommend against writing or designing anything that requires dynamically generating defrecords. if you want to dynamically generate classes I suggest getting familiar with the asm library and reading up on classloaders. Its just the instances I am trying to create dynamically I need to (1) Dynamically resolve a classname (the class of the predefined record) (2) Merge it with vectors containing the values -- 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: Dynamic record creation
I see no reason for the ctor to be defined as a string as you've done with Person.. The reason is that I am reading in XML and mapping a tag name to the record 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. 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: Dynamic record creation
On Feb 4, 3:04 am, Kevin Downey redc...@gmail.com wrote: then define a factory function when you define the record, and use that, you can easily apply a function to arbitrary arguments without using eval Thanks. There may be something in that. Would there be an easy way of dynamically determining which factory fn to call (as there is a record for each possible XML tag) -- 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: Improving Contrib
I understand that contrib wasn't intended to be a standard library, but it inclusion in contrib did suggest to me that a library was being widely used (and tested) and is relatively stable, and that is there was a common problem, then contrib would likely have a library for it Then there is the convenience of just putting one jar on your classpath. Is the intention to make contrib more democratic and accessible, or to get rid of the idea, in favour of letting people select their own libraries? On Oct 19, 3:00 pm, Rich Hickey richhic...@gmail.com wrote: We are taking several steps to improve contrib and the facilities used to host Clojure development. The goal is to make it easier and more desirable to work on the Clojure project, and encourage more libraries to be developed within the project. There are several impediments to people working in or on contrib, and within the Clojure project. The community is obviously vibrant, as there are many independent libraries. But fewer people work on Clojure itself or on libraries intended for inclusion in Clojure. I'd like that to change. Although there have been recent efforts to make contrib more modular from the Maven perspective (thanks Stuart Sierra!), it is still a monolithic repo. Logically, the individual libs are more independent than the repo structure would indicate. It should be much easier to obtain, build, version, distribute, branch, test and modify individual libraries. Some of these problems flow from historical choices made by the project. In particular, without money, boxes and the staff to maintain machines on the net, I chose free project hosting service providers - first SourceForge, then Google Code, and most recently GitHub and Assembla. In all cases, there was a tension between project and user management and code granularity. It would have been difficult to manage the contrib libs as independent projects/repos. Several things have changed recently that enable a better strategy. GitHub has added an organization feature that lets us manage users at the organization level and put multiple repos under the organization. Contegix is donating a hosted box so we can run our own server (thanks Contegix!), and the Clojure/core team now exists and is (voluntarily, and among other things) providing much needed administrative support (thanks Clojure/core team!). The New Model Contrib libraries will be independent repos under the Clojure GitHub organization. All contributions to these libraries will be contributions under the CA (therefor, no pulls). The primary authors will have substantial independence in terms of versioning. branches and releases etc, and it will be easy to obtain and work on a contrib library a la carte. We will be moving from Assembla to a self-hosted installation of the Atlassian suite, which they generously make available for free to open source projects (thanks Atlassian!). It will give us a superior wiki and bug tracking system. We will initially have support for Jira, Confluence and FishEye, and will be able to centrally manage users with Crowd. Individual contrib projects will get documentation and planning space in the Confluence wiki, and a dedicated subproject in the Jira tracking system. Contrib is not a Standard Lib People often ask if contrib constitutes a standard library. It has always been a goal of contrib to support exploratory work of the community that might or might not become part of Clojure proper, so the simple answer is no. As volunteer open source efforts, each library is likely to differ in quality, maturity and attention level. In that respect, they don't differ from all of the other libraries on GitHub. And with the new model, you will be using the same criteria in evaluating a contrib library as you do any other open source library - documentation, participation, recommendations, activity, stability, bug reports etc. And you'll only consume as much of contrib as you desire. Libraries will succeed on their merits. It is our plan to reserve the 1.0.0+ designations for the more mature and widely accepted libraries when they reach that point. That's as much sanctioning as I anticipate for the near term. You've Got to be In it to Win it Why work within the Clojure project? Because you want your work to eventually become part of Clojure and the Clojure distribution. You want to tap into the core development effort and have an impact on it. You are interested in collaborating on how best to make a set of things work together in a coherent way, as Clojure does. Isn't the GitHub free-for-all easier? Yes, but with this new setup, only very slightly so. The easiest thing is not necessarily the best thing. Participating in a project involves cooperation and compromise, and stewardship implies responsibility. Moving Forward We will be working on getting the existing contrib libraries moved over to the new model. Meanwhile, I'm
Evaluating elements of a vector in order
Hello I have a vector containing three macro calls. The third macro relies on the first having been fully evaluated. I want to define a macro to declare these three macros in order Call my vector 'stuff' then the following code inside a macro works (doall [(eval (get stuff 0)) (eval (get stuff 1)) (eval (get stuff 2))]) Is there any general solution eg (doall stuff) fails as it tells me a variable declared by the first macro (and needed by the third) is unbound. Thank you. -- 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: More urgency for CinC CLR given Oracle's lawsuit against Google?
I think it is all just posturing and gamesmanship, and will get settled by Google paying some sort of fee. Unless Google can buy someone with patents that Oracle is infringing then they can cross license. The only two implications I can think of are (1) Hardly helpful for people's confidence in the Java Platform, if Oracle embarks on these kind of surprise antics. May push people towards CLR. If Oracle start getting aggressive, then everyone will start worrying who they will attack next. (2) As Dalvik is based on Harmony and Harmony is techically non conforming (as they have never licensed the TCK) does this have any implications for Harmony. Although I don't use Harmony, it is nice to know its there as if Oracle un-open source Java (like they are doing with Solaris) then Harmony is my fallback option. On Aug 13, 5:29 pm, Brian Hurt bhur...@gmail.com wrote: On Fri, Aug 13, 2010 at 7:13 AM, Seth seth.schroe...@gmail.com wrote: Given Oracle's lawsuit against Google for its use of the JVM, is anyone else suddenly much more concerned about the states of Clojure in Clojure and CLR compatibility? I know the former is an important goal and also that the existence of the latter is due to heroic volunteer efforts on behalf of a small number of people. Frankly I've been sitting on the sidelines cheering the efforts on. But now I'm much more concerned about writing Clojure code that can only run as Oracle sees fit. I've got a small bit of code which needs OpenJDK on an Linux Amazon EC2 instance. What will the Oracle scry of that? As the good book says: DON'T PANIC. IANAL, but I don't think this lawsuit has any bearing on Clojure at all. The crux of the lawsuit, as I understand it, is that Google is shipping a non-conforming Java platform with their Android- and since it's non-conforming, the guarantees Sun gave out (and Oracle is still bound by) about not requiring patent licenses for conforming platforms don't apply, so Google needs a license. What I expect to happen is a couple of months of legal maneuvering, followed by Google cutting Oracle a check with a fair number of zeros, and the whole thing going away. Worse case, the Android handset makes all have to cut checks as well. But note- what Google did that opened itself up for this lawsuit was shipping a non-conforming Java implementation. Clojure isn't shipping a Java implementation at all, conforming or not, so the whole issue is moot. Note that the CLR has all the same patent problems as the JVM- just substitute Microsoft for Oracle. So switching to the CLR doesn't help (to the extent that there is a problem at all). Patents are a problem for software developers, in that you never know what patents you might be violating or who might sue you. But again, this has nothing to do with what language you implement things in. So relax. Breathe deep, pop some popcorn, and settle in to your comfy chair to watch the legal donnybrook. Brian -- 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: Function called from macro loses record structure
Thanks Michał I suppose this raises a deeper question - should an expression and what it evaluates to always be interchangeable in source code? I naively assumed it should, but then after reading Kyle's explanation decided that maybe there is a difference? On Jul 17, 2:18 am, Michał Marczyk michal.marc...@gmail.com wrote: This is an instance of the broader issue whereby records currently evaluate to maps. There was a ticket open for that on Assembla. I'm not sure what's the current status on that, but whenever it gets fixed, macros will be able to use records in their expansions. Sincerely, Michał -- 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: Function called from macro loses record structure
Kyle I think I understand what you are saying. So in practice you should prevent functions called from a macro from evaluating the records (using quoting), so that the output is in a form that looks like source code should? So think it probably is my lack of intuition about macros that is the problem here? What I don't know is, is it meaningful for a macro to expand to something that contains stuff that couldn't ever appear in the output of the reader, like instances of user-defined types, or even Java objects for that matter? What is the expected behavior here? -- 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
Function called from macro loses record structure
Hi Here is my sorry tale http://gist.github.com/477069 I am not sure if this could be my misunderstanding of macros or the ~ idiom Anyway if you spell out a record structure to a macro then you keep the Record information, even you call a function which spells out the structure then the records get turned into PersistentArrayMaps? I first discovered this behaviour on an early July build, but it is the same in the 1.2 Beta Any clues? -- 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
Attaching metadata to defrecord fields
Hello Please could someone tell me the preferred way of attaching field (key?) specific metadata in a defrecord definition? And how to I extract this metadata on a field by field basis? Thank you -- 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: Attaching metadata to defrecord fields
Thanks Michał You did understand my intention, and it was the former non-existent case I was referring to. I wanted to attach metadata about type, field arity etc in the definition of the record type so that I could write some tools to do intelligent conversion between record structures. Charles. On Jul 11, 3:15 pm, Michał Marczyk michal.marc...@gmail.com wrote: On 11 July 2010 14:30, Quzanti quza...@googlemail.com wrote: Please could someone tell me the preferred way of attaching field (key?) specific metadata in a defrecord definition? I'm not sure if I understand your intention correctly, but if I do, then there is no such thing. If the fields of a particular instance of your record hold objects which can have metadata attached to them, you can of course create a new instance of your record type with any such objects replaced with copies with new metadata attached. (defrecord Foo [x y]) (defn set-x-meta [foo x-meta] (Foo. (with-meta (.x foo) x-meta) y)) And how to I extract this metadata on a field by field basis? (meta (.x foo)) Sincerely, Michał -- 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: Attaching metadata to defrecord fields
Hi Pedro That's one idea isn't it. And I suppose you could write a macro for a 'metarecord' to generate both Foo and FooDefinition from a single concise and convenient definition? At the other end of the scale there is always the option of a naming convention - ducks-Set-Of-Birds etc!! Charles. On Jul 11, 5:15 pm, Pedro Henriques dos Santos Teixeira pedr...@gmail.com wrote: On Sun, Jul 11, 2010 at 11:45 AM, Quzanti quza...@googlemail.com wrote: Thanks Michał You did understand my intention, and it was the former non-existent case I was referring to. I wanted to attach metadata about type, field arity etc in the definition of the record type so that I could write some tools to do intelligent conversion between record structures. I have a similar need, and decided to model a FooDefinition record as part of my domain. (regards), Pedro -- 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: Non-tail recursion (Clojure way to hierarchies)
Thanks James. If any one else is as new to functional stuff as me then I found this in Paul Graham's book which enables me to reason logically about the matter (hopefully) A good compiler can compile a tail call into a goto, and so can compile a tail recursive function into a loop. In typical machine language code, when control arrives for the first time at the segment of instructions representing len (a local fn) there is information on the stack saying what to do upon returning. Because nothing remains to be done after the recursive call, this information remains valid for the second call as well On Jun 15, 11:28 pm, James Reeves jree...@weavejester.com wrote: On 15 June 2010 22:56, Quzanti quza...@googlemail.com wrote: Thanks Mike. So does is the only kind of recursion optimisation tail recursion? Can you only eliminate stack calls in tail calls? No, you can also eliminate stack calls using lazy-seq or trampolines. If you provide some example code of what you are currently doing, it would be easier to gauge what is the most suitable approach. You might not even need to bother eliminating stack calls, if you know you're never going to recurse very far. Having some sort of hint about this in the recur documentation might be helpful? Well, the docs do say recur in other than a tail position is an error, though that does assume the reader knows what the tail position of a function is. - James -- 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: Non-tail recursion (Clojure way to hierarchies)
Thanks Mike. So does is the only kind of recursion optimisation tail recursion? Can you only eliminate stack calls in tail calls? Having some sort of hint about this in the recur documentation might be helpful? On Jun 15, 2:32 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Tue, 15 Jun 2010 03:24:08 -0700 (PDT) Quzanti quza...@googlemail.com wrote: You can use recur to build a hierarchy. What do you mean by you can't use it as it is not the last statement? Exactly that. recur in some sense terminates the current call, and hence is required to be the last statement in the call. I have used recur in all sorts of places in the fn, without noticing any restrictions, and built hierarchies. The restriction is temporal, not spatial. You can put the recur statement anywhere you want, but there must be no other function waiting on it's return value. Or, if it weren't a special form, then it's value would be the value of the function. So this is legal, with the recur as the last function both temporally and spatially: (defn counter [n result] (if (zero? n) result (recur (dec n) (conj result n And moving the recur spatially still works: (defn counter2 [n result] (if ( n 0) (recur (dec n) (conj result n)) result)) But if we invert the conj and recur, so that conj uses the result of the recur, it breaks at compile time, even if the recur is spatially the last statement in the function: (defn busted-counter [n] (if (zero? n) [] (conj (recur (dec n)) n))) You can, of course, write this as a conventionally recursive function: (defn recursive-counter [n] (if (zero? n) [] (conj (recursive-counter (dec n)) n))) But this version *isn't* tail recursive - it'll use up n levels of stack. Personally, I like recur. Telling the language I believe this is a tail recursive call means it can tell me I was wrong at compile time, rather than after it runs out of stack out run time. I hope it stays around after we get TCE. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- 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: ClojureCheck 2.0
Useful, but not that sort of thing I'd ever think to look for unless I had read about it. Is there a wiki page somewhere that lists all this little libraries with a one line description? Would be great to just read a list of ideas and check a few out that hadn't thought about before. On Jun 14, 8:29 pm, Meikel Brandmeyer m...@kotka.de wrote: Dear fellow Clojurians, I just released ClojureCheck 2.0 into the wild. It is a clojure.test extension that allows to generate input data of a desired structure to test code with random input. It is similar to fact[1] or Haskell's QuickCheck[2]. I wrote a short introductory blog post with a example. Not necessarily a good one, but it should show the look'n'feel of the library:http://kotka.de/blog/2010/06/ClojureCheck_is_back.html ClojureCheck is available from Clojars as [clojurecheck 2.0.0]. The source is available athttp://bitbucket.org/kotarak/clojurecheck. Please feel free to try and test it. In particular I'd appreciate feedback concerning the API. Sincerely Meikel [1]:http://github.com/weavejester/fact [2]:http://en.wikipedia.org/wiki/QuickCheck -- 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: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
+1 Swing with caveats Will Swing itself continue to receive serious backing from Oracle? Will they get JavaFX to do everything Swing can and then deprecate Swing (if not officially then in practice?) It really depends on Netbeans. All the LF issues and other minor ones got attention when Sun began eating its own dogfood and developing Netbeans with Swing. Although having said that is JDeveloper built on top of Swing or SWT - I think probably Swing as JBuilder was so Swing wins whichever tool Oracle eventually standardises on. An example of the point I am trying to make is resolution independence. There was a big push for resolution independence in Swing, which got a long way, but then since JavaFX came along all efforts in that area seem to have been JavaFX focussed. On May 27, 4:32 pm, Sean Devlin francoisdev...@gmail.com wrote: +1 Swing. There's a ton of documentation out there, and it got some serious love from Sun between java 5 and 6. On May 27, 11:27 am, Laurent PETIT laurent.pe...@gmail.com wrote: Although I work with SWT at work, I would say Swing for 2 reasons : * no additional dependency for users of your lib, and *no need* for users of your lib to deliver different final apps binaries for different platforms * may be easier to work with in your implementation (?) 2010/5/27 Luke VanderHart luke.vanderh...@gmail.com My side project is a fairly complex GUI application written in Clojure. Recently, I've become irritated with using Java interop for everything. It's not that Clojure doesn't have nice java interop - it does. It's just that when interacting with a GUI framework, which is a large part of my app, I have to be back in mutable object-oriented land, worrying about class hierarchies, mutable state, locks, etc. Yucky. So, with a perhaps dangerous lack of sanity and without any guarantee of success, I've decided to try my hand at writing an idiomatic Clojure GUI library. If I have success (which I doubt) I will of course make it available as open source. I intend for it to be mostly declarative, with a nice DSL for defining GUI elements. Each component will also implement map, and use one of Clojure's reference types as an interface for inspecting / updating its state. I may also implement some aspects of Functional Reactive Programming wherever it's convenient to do so. What you all must help me decide is what GUI framework to use as the underpinnings of it. It's genuinely hard to decide. I have at least some experience with all of them, so I have no strong preference, but I'd like to get your input. I did consider trying to make it abstract enough that you could plug in *any* of them under the hood, but there's enough differences between the frameworks that that would get very ugly very fast. Possibilities are: AWT Pros: native widgets, bundled with Java, low-level Cons: few widgets, considered somewhat obselete Swing Pros: bundled with Java, good widget selection Cons: non-native widgets SWT Pros: native widgets, widely used Cons: requires platform-specific libs QT Jambi Pros: native widgets, huge widget selection, highly-regarded framework Cons: requires platform-specific libs, writing custom widgets is hairy, momentum and support seem to be lagging since Nokia dropped official support. Remember, the actual API won't matter - that will be completely abstracted away. So try to focus on the framework's look and feel. Also let me know if I've missed any of the framework's key characteristics. Thanks! -Luke -- 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.comclojure%2bunsubscr...@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: special form vs. macro
That was interesting. One more Q. What determines whether special forms can be used in functions eg you can't def a variable in a fn. Is it there some rule or is it special form specific depending on (a) the intended use of the special form (b) the mechanics of getting the compiler to use the special form On May 31, 9:48 am, Jarkko Oranen chous...@gmail.com wrote: On May 31, 10:35 am, alux alu...@googlemail.com wrote: [ ] A special form is what can be implemented by a macro. That depends. My understanding is that a special form is something that is fundamental to the language, that the evaluator handles as a special case. That is, they need to be implemented in the compiler/ interpreter itself. However, in practice you can't really tell the difference between a macro and a special form, and in fact some Clojure special forms are implemented as macros (on top of a real special form that is an implementation detail) [ ] Every macro gives a special form. Not really. All macros have the same evaluation semantics (macro expansion). [ ] Only a macro that doesn't evaluate some of its arguments gives a special form. I don't think evaluation of arguments matters. [ ] A special form is always built in, and cannot be implemented in the language itself. That depends on your point of view, but in general, yes. [ ] Special forms are exactly the things that can be called, but dont evaluate all of their arguments. (Macros and build-ins, at least for eager languages.) Special forms are special because the evaluator has separate evaluation rules for each of them. Other than that, they are merely another kind of operator (the others being macros and functions) [ ] The concept of special form doesnt have anything to do with eagerness or lazyness. This is correct. -- 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: special form vs. macro
Are you sure that always works? I think I am misunderstanding Halloway's Taxonomy of Macro's chapter defstruct is written as a macro and Stuart then comments This macro looks so simple that you may be tempted to try to write it as a function. You won't be able to because def is a special form. You must generate def at macro time; you cannot make 'dynamic' calls to def at runtime On May 31, 4:05 pm, Joost jo...@zeekat.nl wrote: On May 31, 4:35 pm, Quzanti quza...@googlemail.com wrote: That was interesting. One more Q. What determines whether special forms can be used in functions eg you can't def a variable in a fn. You can: user (defn fun [v] (def my-v v)) user (fun 'a) user my-v a user (fun 'b) user my-v b I'm not aware of any special form that can't be used inside a function. But I haven't looked for them either. Is it there some rule or is it special form specific depending on (a) the intended use of the special form (b) the mechanics of getting the compiler to use the special form First you'd have to find such special forms. -- 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: PDF generation with Clojure?
I am not enough of a functional programming / Clojure expert to comment on which library would integrate best with Clojure. However I have always found iText to be badly designed (even though historically it has been the mindshare leader with most features) Also the licence on iText is GPL 3 with Affero extension, but the iText guy has sold the commercial rights to a company so anything could happen with it http://itextpdf.com/contact.php I am hopeful that Apache PdfBox (recently out of incubation) will become the main Java library. It has historically been viewed as having a better design, and has always been better if you want to do the complex task of reading (parsing) pdf documents rather than just generating them (this is a tough problem because a pdf document is just glyphs) If it gets more heavily used as catches up on the pdf generation features then PdfBox will be a no-brainer. All Java libraries will be closely tied to the Adobe Pdf spec/api so (1) They won't differ that much (2) If any part of the Adobe spec isn't implemented it will be quite easy to do yourself as you will effectively just be wrapping a call hth, On May 24, 11:22 pm, Jim Tittsler j...@onjapan.net wrote: Is there a library for generating PDF pages/reports with Clojure? (Or a Java library that interoperates more naturally than others?) -- 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 athttp://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: Dumbest test Q you ever heard
I have written something to convince myself that things behave as I expected e.g. each runs only once per test, not once per assertion http://gist.github.com/399638 It handles the fact that tests can be run in any order by using a Set which gets added to when any function is run (so if the function is run more than once it only adds one thing to the Set as the Set removes duplicates) Think my mind works in an obscure way, so prob not much use to anyone else. On May 12, 7:55 pm, Quzanti quza...@googlemail.com wrote: Found an :each example using binding - is that the suggested option? Would still be really grateful for a link to the best examples of using the test framework out there. Thanks. On May 12, 7:10 pm, Quzanti quza...@googlemail.com wrote: Hi Now I am a bit baffled as how to store a fixture (eg a parsed xml zipper) As a fixture is a function you can't do a def within it? Instead of me carrying on asking dumb questions I would be really grateful if someone could point me to some source code or examples where the test framework is heavily used. I searched for with-test and :once in the clojure and contrib 1.1 source and couldn't find anything. Thanks. On May 8, 7:30 am, Quzanti quza...@googlemail.com wrote: Ah hah! Thanks On May 7, 9:35 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On May 6, 12:40 pm, Quzanti quza...@googlemail.com wrote: If you do anything outside an assertion you get an error saying you were outside an assertion. No, clojure.test permits any arbitrary code inside deftest. If you get an error saying Uncaught exception, not in assertion it means that some of that code threw an Exception when it was run. -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.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 athttp://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 athttp://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 athttp://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 athttp://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: Dumbest test Q you ever heard
Hi Now I am a bit baffled as how to store a fixture (eg a parsed xml zipper) As a fixture is a function you can't do a def within it? Instead of me carrying on asking dumb questions I would be really grateful if someone could point me to some source code or examples where the test framework is heavily used. I searched for with-test and :once in the clojure and contrib 1.1 source and couldn't find anything. Thanks. On May 8, 7:30 am, Quzanti quza...@googlemail.com wrote: Ah hah! Thanks On May 7, 9:35 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On May 6, 12:40 pm, Quzanti quza...@googlemail.com wrote: If you do anything outside an assertion you get an error saying you were outside an assertion. No, clojure.test permits any arbitrary code inside deftest. If you get an error saying Uncaught exception, not in assertion it means that some of that code threw an Exception when it was run. -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.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 athttp://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 athttp://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: Dumbest test Q you ever heard
Found an :each example using binding - is that the suggested option? Would still be really grateful for a link to the best examples of using the test framework out there. Thanks. On May 12, 7:10 pm, Quzanti quza...@googlemail.com wrote: Hi Now I am a bit baffled as how to store a fixture (eg a parsed xml zipper) As a fixture is a function you can't do a def within it? Instead of me carrying on asking dumb questions I would be really grateful if someone could point me to some source code or examples where the test framework is heavily used. I searched for with-test and :once in the clojure and contrib 1.1 source and couldn't find anything. Thanks. On May 8, 7:30 am, Quzanti quza...@googlemail.com wrote: Ah hah! Thanks On May 7, 9:35 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On May 6, 12:40 pm, Quzanti quza...@googlemail.com wrote: If you do anything outside an assertion you get an error saying you were outside an assertion. No, clojure.test permits any arbitrary code inside deftest. If you get an error saying Uncaught exception, not in assertion it means that some of that code threw an Exception when it was run. -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.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 athttp://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 athttp://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 athttp://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: Dumbest test Q you ever heard
I probably could, although again it would be a bit of a hack, as I want to 'do' some preparation rather than assign anything (specifically I need to 'touch' some files before testing a function which is modification time sensitive) So I want something that happens before all several 'is' assertions in my with-test for one specific function. If you do anything outside an assertion you get an error saying you were outside an assertion. Small point, and as you say easily worked around, but it would seem to me to be within the spirit of the with-test idea i.e. making the test code closely tied to the function, if you could do a function specific fixture?? On May 6, 2:34 pm, Sean Devlin francoisdev...@gmail.com wrote: Can you just use a local let in the specific test? On May 6, 6:41 am, Quzanti quza...@googlemail.com wrote: Sorry about this, but after an hour's googling I have drawn a blank. For clojure.test fixtures I understand you use :each for doing something around each and every test, and :once for doing it once around all the tests in that namespace What happens if you want to do some setup just for one particular test that you want to use a with-test structure for? Can you put non- assertion lines outside the scope of the function being tested, but within the scope of with-test I though of going an (is (= nil (mysetup-stuff))) but that is quite a hack I know also that I may be being obsessive as normally all tests on a namespace will get run together so :once will do the job, but I have this hitch to put setup code that only applies to testing that function within the with-test for that fn. 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 athttp://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 athttp://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: Logic programming in Clojure
Very interesting write up. What advantages would prolog have over such a language. Or if we are trying to move beyond language wars - what styles of logic programming would be more natural in either one or the other? I say that because my first thought is if you could build a logic language on top of LISP then would prolog be needed as the other AI language? I liked your insight on logic being a graph search. On Mar 23, 3:23 pm, jim jim.d...@gmail.com wrote: I just posted a new tutorial about doing logic programming in Clojure. It makes use of the mini-Kanren port to Clojure I did last year. It's intended to reduce the learning curve when reading The Reasoned Schemer, which is an excellent book. http://intensivesystems.net/tutorials/logic_prog.html 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Why I have chosen not to employ clojure
Reading his post I got the impression he was a bit of an egocentric (a bit more information about himself than was relevant), those sorts tend to overreact. However I can imagine the whole just bung the jar file on your classpath thing wouldn't make much sense for a java newbie. It may highlight the need for some special 'getting started' documentation for Lisp programmers who have never used java, which I understand to be one target audience of clojure. I don't understand the complaints about installing Clojure. As far as I know there's nothing required to 'install' Clojure beyond downloading the clojure.jar, other than I guess having a working Java installation. -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Why I have chosen not to employ clojure
But if he had never been in the Java mindset it wouldn't be obvious to him that there is nothing to be gained by compiling your own java code. Platform independence, bytecode etc means that a jar file of the stable build is the optimum solution. That is so obvious to us we forget that its a revolution for someone new to java. So he probably went down some compile from source to optimise for your architecture route that made perfect sense to him, but led him onto a iceberg (the captain of the titanic *knew* that a ship could turn in time because that is what all his previous experience on smaller ships led him to believe) On Mar 21, 8:39 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Yeah, too bad he removed his entry, 'cause as you said, installing clojure isn't harder than installing anything java based. I don't know of a sysadmin nowadays which had not to deal with java stuff in a way or another ? And ant is around the place *for years*. So more input from him may have helped more clearly identify the root problem. 2010/3/21 Cosmin Stejerean cstejer...@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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Var Value from String of varname
I am sure this is really obvious but as I don't know the technical term for what I am trying to do I can't google it (def age 3) then (cons (symbol age) [2 1]) I get (age 2 1) rather than (3 2 1) which is what I was hoping for. Or maybe you cannot do this at runtime? -- 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: Var Value from String of varname
Have found what I am trying to do eval I am working through the Halloway book, which doesn't seem to have eval in the index, so I probably should excuse myself my ignorance. Is there much a performance impact of using eval,as presumably the compiler can't do much until runtime? Or is the idea of functional languages to delay as much until runtime as possible anyway? On Feb 24, 11:16 am, Quzanti quza...@googlemail.com wrote: I am sure this is really obvious but as I don't know the technical term for what I am trying to do I can't google it (def age 3) then (cons (symbol age) [2 1]) I get (age 2 1) rather than (3 2 1) which is what I was hoping for. Or maybe you cannot do this at runtime? -- 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: Var Value from String of varname
Thanks. So it isn't a counterexample to my rule of Thumb 'If it is isn't in Halloway you shouldn't be using it' I'll catch you out one day. On Feb 24, 2:19 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: You don't need (and shouldn't use) eval for this: @(resolve (symbol age))) Stu Have found what I am trying to do eval I am working through the Halloway book, which doesn't seem to have eval in the index, so I probably should excuse myself my ignorance. Is there much a performance impact of using eval,as presumably the compiler can't do much until runtime? Or is the idea of functional languages to delay as much until runtime as possible anyway? On Feb 24, 11:16 am, Quzanti quza...@googlemail.com wrote: I am sure this is really obvious but as I don't know the technical term for what I am trying to do I can't google it (def age 3) then (cons (symbol age) [2 1]) I get (age 2 1) rather than (3 2 1) which is what I was hoping for. Or maybe you cannot do this at runtime? -- 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: Request for Feedback: Improve VimClojure's documentation
I'll give the newbie perspective, which given as I did not really know what I was doing may involve several false assumptions but will provide insight into the thinking of a newbie, which may be a hard frame of mind for experts to imagine. Firstly when you are new you just want to get something working fast. I didn't want some snazzy dev environment to wrestle with, I just wanted some syntax highlighting and maybe some code completion. The first thing you do is look for recent news on enclojure, vimClojure etc, and they all looked to be several months old. You always wonder whether people have moved on, worried Netbeans will be discontinued by Oracle etc or whatever. So for cutting edge projects releases or at least news every 6 weeks or so are needed to convince people the project in still in development. I looked at all of them and would have liked to go with VIM as I am a VIM user. For VIM it looked like I was going to have to go though some elaborate procedure (there was a webcast for it) rather than just stuff a config file in a directory so I decided to leave off that until support got built into the standard Ubuntu VIM release (debian or whatever). I tried enclojure with the latest netbeans and got a pile of errors so gave up. I tried the emacs mode and didn't get very far, largely because of my lack of emacs knowledge. Then I realised trusty old jedit had an clojure mode, which worked out of the box bar one small change in the patterns file (it needed prodding to map .clj to the clojure mode) So there I was with some pretty decent syntax formatting from jedit, the clojure and clojure contrib jars on my classpath and wow the REPL worked. I could type stuff in, I could test functions I was away. Yippee. That's all a newbie with a weekend to spare wants. When I get more experience of clojure and what my personal pain points and time consuming things are then I might try some of the more elaborate dev environments again to see if they help. So to answer your question a - be up and running with minimal fuss in three minutes with perhaps not all the bells and whistles 'Getting started' page - would be a real help to cater for one section of the community. -- 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