Re: Probabilistic programming in clojure

2011-11-17 Thread Konrad Hinsen
--On 17 novembre 2011 15:09:11 -0800 Nils Bertschinger wrote: The two approaches are somewhat complementary to each other. Your monad does exact inference on discrete distributions by running through all possibilities. Mine is sampling based and does approximate inference using MCMC. I tried

Re: Reactions to google dart?

2011-11-17 Thread daly
Doug Crockford was asked for his reaction to coffeescript. He loved it. He was asked for his reaction to Dart and he said that the set of features that Dart chose are not the set of features he would have chosen. Crockford on JavaScript - Section 8: Programming Style & Your Brain http://www.

Re: Change var in other namespace

2011-11-17 Thread Sean Corfield
Note: if you just want something that will execute at startup and force _all_ logging to use log4j, instead of wrapping code in (binding ..) then you probably want something like this: (ns your.namespace (:require [clojure.tools.logging :as log]) (:require [clojure.tools.logging.impl :as impl]

Re: Change var in other namespace

2011-11-17 Thread Mark Rathwell
You rebind dynamic vars with binding, so your use would look something like this: (binding [*logger-factory* (log-impl/log4j-factory)] (do-stuff-with-the-logger-factory-rebound)) On Thu, Nov 17, 2011 at 5:17 PM, vitalyper wrote: > clojure.tools.logging defines *logger-factory* and initializes

Re: Reactions to google dart?

2011-11-17 Thread Qihui Sun
Google Dart vs. ClojureScript *Dart ->* *Dart is a new class-based programming language for creating structured web applications. Developed with the goals of simplicity, efficiency, and scalability, the Dart language combines powerful new language features with familiar language constructs into a c

Change var in other namespace

2011-11-17 Thread vitalyper
clojure.tools.logging defines *logger-factory* and initializes it with first logger implementation on the class path (def ^{:doc "An instance satisfying the impl/LoggerFactory protocol. Used internally to obtain an impl/Logger. Defaults to the value returned from impl/ find-factory." :dynam

Re: clojure-opennlp

2011-11-17 Thread Lee Hinman
On Nov 17, 10:15 am, labwor...@gmail.com wrote: > That's probably an OpenNLP question, but here it goes. Is there a way to > tell the tokenizer to make tokens of more than one word according to a > multi-word lexicon? > > Thanks for any ideas. > melipone Not sure I understand what you're trying to

Re: Probabilistic programming in clojure

2011-11-17 Thread Nils Bertschinger
Hi Konrad, thanks for the link. I know your very nice library and actually use clojure.contrib.monads to implement my probability monad. The two approaches are somewhat complementary to each other. Your monad does exact inference on discrete distributions by running through all possibilities. Mine

Clojure type selection flowchart: add a translation for your language

2011-11-17 Thread Chas Emerick
For those that haven't seen it, I produced a flowchart earlier this year to help guide your selection of a Clojure type-definition form: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/ I wanted to make it easier for others to produce translations of

Re: ClojureScript: Should 'advanced optimizations' lead to faster execution? (or just faster loading)

2011-11-17 Thread David Nolen
I haven't seen performance gains from advanced optimization. David On Thu, Nov 17, 2011 at 5:18 PM, Paul Richards wrote: > Hi, > I'm interested in the differences between the default ClojureScript > compile, and the {:optimizations :advanced} mode. > > Aside from loading times (due to different

ClojureScript: Should 'advanced optimizations' lead to faster execution? (or just faster loading)

2011-11-17 Thread Paul Richards
Hi, I'm interested in the differences between the default ClojureScript compile, and the {:optimizations :advanced} mode. Aside from loading times (due to different file sizes) and memory usage (again due to different file sizes, minified field names, etc), do we expect the optimized version to ex

Re: Debugging Java heap space memory error with lazy sequences.

2011-11-17 Thread Meikel Brandmeyer
Hi, this is a “hold unto head” problem. Am 17.11.2011 um 15:06 schrieb Julian Kelsey: > (def seq-3s-n-5s > (filter > (fn [n] (or (= 0 (mod n 5)) (= 0 (mod n 3)) ) ) > (iterate inc 1))) Here you keep a reference to the head of the generated by iterate. Make it a function:

Debugging Java heap space memory error with lazy sequences.

2011-11-17 Thread Julian Kelsey
I was working on a few of the Project Euler puzzles. The first involves picking the nth element from a particular series, (sum the numbers factored either by 3 or 5 below 1000). One forum comment on the very first puzzle raised the criticism that it's easy to solve the question as presented (i.e. b

Re: Probabilistic programming in clojure

2011-11-17 Thread Konrad Hinsen
On 17 nov. 2011, at 18:57, Nils Bertschinger wrote: > inspired by the bher compiler for the probabilistic scheme dialect MIT > Church, I have implemented a version of the probability monad which > uses Metropolis Hastings to draw samples from runs of monadic > programs. You can find the code on gi

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread Base
I look forward to it. On Nov 17, 2:42 pm, David Nolen wrote: > On Thu, Nov 17, 2011 at 3:39 PM, Base wrote: > > It mentions: > > > "The one important difference is in calling no-argument methods. In > > Java (. x toString), where toString is a method, would unambiguously > > mean "call the toStr

Re: start-process-shell-command: Spawning child process: invalid argument

2011-11-17 Thread Phil Hagelberg
On Thu, Nov 17, 2011 at 6:50 AM, Andrew wrote: > Thanks Do I need Cygwin at all for Clojure work on > Windows/Emacs/Swank/clojure-mode/lein? Or can I remove Cygwin from my > machine? > > And are these two functionally equivalent? > > clojure-jack-in > lein swank and slime-connect If you have

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread David Nolen
On Thu, Nov 17, 2011 at 3:39 PM, Base wrote: > It mentions: > > "The one important difference is in calling no-argument methods. In > Java (. x toString), where toString is a method, would unambiguously > mean "call the toString method of x". JavaScript is more flexible, > separating "method" loo

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread Base
Doh! I am so used to Clojure at this point I actually forgot about about mutable data structures. Thanks David! On Nov 17, 2:38 pm, David Nolen wrote: > setDate mutates the date and does not return a value. > > David > > > > > > > > On Thu, Nov 17, 2011 at 3:26 PM, Base wrote: > > HI > > > I a

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread Base
Hi Matt - I forgot to add that one, but that also returned Undefined. Looking at this: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure It mentions: "The one important difference is in calling no-argument methods. In Java (. x toString), where toString is a method, would

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread David Nolen
setDate mutates the date and does not return a value. David On Thu, Nov 17, 2011 at 3:26 PM, Base wrote: > HI > > I am attempting to manipulate a goog.date.Date object and am a little > confused on how to call a method on this object in ClojureScript > > If I have a date object, how do I , for

Re: ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread Matt Hoyt
(.setDate (goog.date.fromIsoString "2010-12-31") 1)   Matt Hoyt From: Base To: Clojure Sent: Thursday, November 17, 2011 2:26 PM Subject: ClojureScript: Correct way to call an instance method with parameters? HI I am attempting to manipulate a goog.date.Date o

ClojureScript: Correct way to call an instance method with parameters?

2011-11-17 Thread Base
HI I am attempting to manipulate a goog.date.Date object and am a little confused on how to call a method on this object in ClojureScript If I have a date object, how do I , for example, to set the day of the month to a different day Both (. (goog.date.fromIsoString "2010-12-31") (setDate) 1)

Re: Overused phrases in the Clojure community

2011-11-17 Thread Luc Prefontaine
Maybe we should qualify non-idiomatic code as being "idiotmatic", that may help reducing the # of posts referencing "idiomatic". However this only a letter way from making (slight) mistakes in the posts :) I just spent my day's quota of idiotic writing ... Luc On Thu, 17 Nov 2011 11:22:27 -06

Re: Review my code - delay-map

2011-11-17 Thread Meikel Brandmeyer
Hi, without looking too much at your code, I might suggest you have look at my lazy map library: http://bit.ly/vNA56f. It basically solves the same problem. You can compare your solution to mine. If you want to discuss anything, feel free to go ahead. Sincerely Meikel PS: It's also on clojars

Review my code - delay-map

2011-11-17 Thread Chris Perkins
I'm trying to implement this: I want an object that behaves just like a normal clojure map, except in one very specific case - if a value is a Delay, then getting that value out of the map will force it. Other than that one difference, it should be indistinguishable from a regular map (or as cl

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
>Although implementing Clojure-in-Clojure no doubt should be done, that >does not make lein work on other platforms, Very true. But what it does do is abstract away the core elements of Clojure. ISeq, IPersistentList, PersistentList, etc. are all cross platform. All you need is a "emit-class" func

Probabilistic programming in clojure

2011-11-17 Thread Nils Bertschinger
Hi everyone, inspired by the bher compiler for the probabilistic scheme dialect MIT Church, I have implemented a version of the probability monad which uses Metropolis Hastings to draw samples from runs of monadic programs. You can find the code on github: https://github.com/bertschi/ProbClojureN

Re: clj-time and clojure 1.3

2011-11-17 Thread Sean Corfield
On Wed, Nov 16, 2011 at 5:39 PM, Sean Corfield wrote: > I have taken over clj-time from Mark McGranahan: > > https://github.com/seancorfield/clj-time > > (although github seems to be omitting the navigation bar on that repo > - I'll open a support ticket). github fixed that problem - apparently i

Re: Clojure on PyPy

2011-11-17 Thread dmiller
On Nov 17, 10:07 am, Timothy Baldridge wrote: > > With the clojureclr for example, it > > supports pretty much everything clojure does sans java, and gains all the > > .net interop. > > True...true, it supports it, but it's still a "2nd class citizen". For > instance, we don't have lein, ring, p

Re: Relationship between .clj and .class files?

2011-11-17 Thread Daniel Solano Gomez
On Thu Nov 17 09:06 2011, Terje Dahl wrote: > What is the relationship between the .clj source-file(s) and its gen- > class compiled class-files? > > The reason I ask is that my app is an applet, written in Clojure > (obviously), and compiled. > The resulting class-files are then bundled into a ja

Re: adding metadata to java objects

2011-11-17 Thread Ben Mabey
On 11/17/11 4:21 AM, Chas Emerick wrote: Ben, It's a good idea, but it's going to bite you: - what if the class in question has fields or package-private methods that are touched by Java code? Yeah, there are some use cases where this would fall apart in. Assuming that you use only public

Re: Overused phrases in the Clojure community

2011-11-17 Thread Duane Searsmith
Perhaps "idiot-magic" would sub? On Thu, Nov 17, 2011 at 8:30 AM, Sergey Didenko wrote: > I coded mutable Dejkstra algorithm isolated in a single function, > because it's easier for me to maintain it - I used to write a lot of > mutable algorithms. But I consider this code not idiomatic though >

clojure-opennlp

2011-11-17 Thread labwork07
That's probably an OpenNLP question, but here it goes. Is there a way to tell the tokenizer to make tokens of more than one word according to a multi-word lexicon? Thanks for any ideas. melipone -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Relationship between .clj and .class files?

2011-11-17 Thread Terje Dahl
What is the relationship between the .clj source-file(s) and its gen- class compiled class-files? The reason I ask is that my app is an applet, written in Clojure (obviously), and compiled. The resulting class-files are then bundled into a jar-file, but without the source clj-file. (I don't want t

Re: Clojure on PyPy

2011-11-17 Thread Gary Poster
On Nov 17, 2011, at 11:09 AM, Timothy Baldridge wrote: >> I also felt that sticking with the official Java implementation of Clojure >> would be more practical. It would certainly be fun to put Clojure on PyPy, >> though. > > There is one insanely off-the-wall idea I've been thinking about >

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
> With the clojureclr for example, it > supports pretty much everything clojure does sans java, and gains all the > .net interop. > True...true, it supports it, but it's still a "2nd class citizen". For instance, we don't have lein, ring, parts of contrib, IDEs, etc. All the examples, all the book

Re: Clojure on PyPy

2011-11-17 Thread Gary Poster
On Nov 17, 2011, at 10:45 AM, Brent Millare wrote: > ...The main point the poster should take away is the lack of any > library/runtime tools, you have to build from the ground up many things you > take for granted when targeting the JVM. I've thought about Clojure on PyPy too. My thought was

Re: Clojure on PyPy

2011-11-17 Thread Timothy Baldridge
> I also felt that sticking with the official Java implementation of Clojure > would be more practical.  It would certainly be fun to put Clojure on PyPy, > though. There is one insanely off-the-wall idea I've been thinking about recently, however: 1) Implement a full JVM in PyPy using GNU Clas

Re: Clojure on PyPy

2011-11-17 Thread Brent Millare
Couple of clarifications. My main point is the maturity of the JVM, so when comparing what is presented in the article (which isn't much), it can do what is listed. That's not to say the converse isn't true, that PyPy's JIT can do things the JVM can't do. Like I said, there are a lot of research

Re: start-process-shell-command: Spawning child process: invalid argument

2011-11-17 Thread Mark Rathwell
> Do I need Cygwin at all for Clojure work on > Windows/Emacs/Swank/clojure-mode/lein? I don't think so. If lein.bat is on your path and is working, and if emacs and clojure-mode are working, that's really all you need. There are utilities and tools out there that you may want to use at some poi

Re: start-process-shell-command: Spawning child process: invalid argument

2011-11-17 Thread Andrew
Thanks Do I need Cygwin at all for Clojure work on Windows/Emacs/Swank/clojure-mode/lein? Or can I remove Cygwin from my machine? And are these two functionally equivalent? - clojure-jack-in - lein swank and slime-connect -- You received this message because you are subscribed

Re: Overused phrases in the Clojure community

2011-11-17 Thread Sergey Didenko
I coded mutable Dejkstra algorithm isolated in a single function, because it's easier for me to maintain it - I used to write a lot of mutable algorithms. But I consider this code not idiomatic though useful in my case. So I think idiomatic Clojure code is not as ubiquitous as you probably mean an

Re: Overused phrases in the Clojure community

2011-11-17 Thread thenwithexpandedwingshesteershisflight
Firstly, sorry about this thread :-D I wasn't trolling, honest, I just thought it was getting to the point where the word was loosing its meaning. There are many ways to express the notion of applying Clojure's characteristics to one's code: "here's a more Clojurian version of that function..."

Re: adding metadata to java objects

2011-11-17 Thread Chas Emerick
Ben, It's a good idea, but it's going to bite you: - what if the class in question has fields or package-private methods that are touched by Java code? - what if the class take ctor arguments? - what if the ctor has side effects? - Chas On Nov 16, 2011, at 11:28 AM, Ben Mabey wrote: > Hi, > I

Re: adding metadata to java objects

2011-11-17 Thread Chas Emerick
On Nov 17, 2011, at 1:01 AM, Ben Smith-Mannschott wrote: >> (def o (Object.)) >> >> (def om (with-meta* o {:foo true})) >> >> (def whatever (with-meta* o {:foo false})) >> >> (meta* om) ;=> {:foo false} >> >> Doesn't really support Clojure's concept of metadata if it's shared >> global mutabl

Re: Java / clojure interop, invoking methods and perserving thread binding

2011-11-17 Thread Michael Jaaka
Ok. I have solved this. I have replaced eval with eval-data which is (defmacro eval-data[ & body ] (defonce this-current-context (get-thread-bindings) ) `(do (push-thread-bindings this-current-context) (try (eval ~@body) (finally (pop-thread-bindings) On Nov 17, 10

Re: Java / clojure interop, invoking methods and perserving thread binding

2011-11-17 Thread Michael Jaaka
Well, I have checked different possibilites and the problem is not about facade but lies in Clojure "eval" which is called on Clojure structure done from transforming XML to Clojure structures. This eval doesn't see context defined during loading time only if thread binding is not restored. Any hel

Java / clojure interop, invoking methods and perserving thread binding

2011-11-17 Thread Michael Jaaka
Hi! I'm using Clojure from Java via RT.loadResourceScript(...) and then RT.var(...) However this only works when I do Var.pushThreadBindings(THREAD_BINDING) and Var.popThreadBindings() around RT.var().invoke(), where THREAD_BINDING is a thread binding got during script loading via (def ^:dyn