Re: ANN: Om 0.8.0-alpha1, Reference Cursors!

2014-10-18 Thread Jonas Enlund
Hi Interesting work as usual! One quick question: What is the difference between (let [xs (om/observe owner (items))] ...) as seen in the sub-view component versus the one in main-view which doesn't use `om/observe`: (let [xs (items)] ...) /Jonas On Saturday, October

Re: How can I improve this?

2014-01-10 Thread Jonas Enlund
On Fri, Jan 10, 2014 at 9:39 PM, Mark Engelberg wrote: > Technically, all these solutions are flawed. > > With the input > ["a" "a" "a_1"] > you'll get back > ["a" "a_1" "a_1"] > > To truly address this, you need to also add the newly formatted filename > into the "seen" map, which none of the sug

Re: [ClojureScript] Please test CLJS-418, fixing browser REPL

2013-02-09 Thread Jonas Enlund
On Thursday, February 7, 2013 7:11:35 PM UTC+2, David Nolen wrote: > http://dev.clojure.org/jira/browse/CLJS-418 > > > > Some of you may have encountered bizarre problems when trying to use browser > REPL with the latest releases of ClojureScript. This ticket contains a patch > that should res

Re: proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
On Sun, Jan 30, 2011 at 8:39 PM, Ken Wesson wrote: > On Sun, Jan 30, 2011 at 1:35 PM, Jonas Enlund wrote: >> On Sun, Jan 30, 2011 at 7:01 PM, Ken Wesson wrote: >>> On Sun, Jan 30, 2011 at 9:26 AM, Jonas Enlund >>> wrote: >>>> Hi. >>>> I'

Re: proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
On Sun, Jan 30, 2011 at 7:01 PM, Ken Wesson wrote: > On Sun, Jan 30, 2011 at 9:26 AM, Jonas Enlund wrote: >> Hi. >> I'm trying to create a java.io.Writer proxy (which writes to a >> JTextArea) but I can't get it to work. >> Here is my cloj

proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
Hi. I'm trying to create a java.io.Writer proxy (which writes to a JTextArea) but I can't get it to work. Here is my clojure code so far: (def text-area (javax.swing.JTextArea.)) (def frame      (let [f (javax.swing.JFrame.)]        (.. f getContentPane (add text-area))        (.setMinimumSize f

Re: A simple csv parsing library

2010-06-11 Thread Jonas Enlund
On Thu, Jun 10, 2010 at 1:01 AM, Daniel Werner wrote: > Jonas, > > Thanks for stepping forward and publishing your work. From the short > glance I had at it already, your code seems very low-level (probably > for performance), but sound. The only thing that, compared to other > CSV libraries I've

Re: A simple csv parsing library

2010-06-09 Thread Jonas Enlund
On Wed, Jun 9, 2010 at 3:47 PM, Kyle R. Burton wrote: >> When I say that it supports the RFC I mean that the library should be >> able to read any file that follows that standard. It might (and it >> does) read files that do not follow the standard. Here are some >> examples: >> >> 1) quotes can a

Re: A simple csv parsing library

2010-06-09 Thread Jonas Enlund
t; not signal an error.  I think I recognize the same behavior in cljcsv > as well (though as I said I could not try it).  It might be nice to at > least have an option which allows an unterminated field to be > recognized. > > Best Regards, > > Kyle > > [1] http://github.com/

Re: A simple csv parsing library

2010-06-08 Thread Jonas Enlund
I've added my work on the csv reader/writer library to github (http://github.com/jonase/cljcsv). Please let me know If anyone finds it useful. Thanks, Jonas On Wed, May 26, 2010 at 6:40 AM, Jonas Enlund wrote: > Hi there > > I built a simple csv parsing library[1] last weekend w

Recur on a function which uses keyword arguments?

2010-06-06 Thread Jonas Enlund
The function definition below fails with "java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 1 args, got: 2" (defn countdown [& {:keys [from] :or {from 10}}] (println from) (when (pos? from) (recur :from (dec from Is it not possible t

A simple csv parsing library

2010-05-25 Thread Jonas Enlund
Hi there I built a simple csv parsing library[1] last weekend which I want to show you guys. It follows the RFC 4180[2] pretty closely but it allows for any character as separator and quote mark. It would be great if someone would take time and read the code. I would like to know: a) Can performa

Re: how to use with-bindings*

2010-02-15 Thread Jonas Enlund
On Mon, Feb 15, 2010 at 7:25 AM, Аркадий Рост wrote: > Hi! > I was playing a bit with with-bindings* function, but I got error > every time. > > I've tried: > > (def a 5) > > (with-bindings* {a 3} println a) ;; got java.lang.Integer cannot be > cast to clojure.lang.Var > > (with-bindings* [{a 3}]

Re: am i the only one with deftype/defprotocol problems?

2010-01-04 Thread Jonas Enlund
I think you simply need to get the syntax right. The following works fine for me: user=> (defprotocol p (foo [this])) p user=> (deftype a [f] p (foo [])) #'user/a user=> (foo (a nil)) nil user=> (deftype a [f] :as this p (foo [] [this])) #'user/a user=> (foo (a nil)) [#:a{:f nil}] On Mon, Ja

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Jonas Enlund
Sorry, I think my reply got lost... Inside deftype methods the symbol "Bar" is the name of the class. You can use the constructor (Bar. (inc i)) instead. Again, note the "." after Bar. On Sat, Jan 2, 2010 at 1:23 PM, Konrad Hinsen wrote: > On 01.01.2010, at 23:56, Hugo Duncan wrote: > >>> I want

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Jonas Enlund
(note the .) (deftype Bar [i] Foo (foo [] (Bar. (inc i /Jonas -- 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 patien

Re: Datatypes and Protocols - early experience program

2009-11-16 Thread Jonas Enlund
On Mon, Nov 16, 2009 at 6:27 PM, Stuart Sierra wrote: > On Nov 14, 8:28 am, Jonas Enlund wrote: >> I have built a simple Matrix datatype with defprotocol and deftype. >> You can take a look at it athttp://gist.github.com/234535 >> (constructive criticism welcome!). >

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Jonas Enlund
Hi there! I have built a simple Matrix datatype with defprotocol and deftype. You can take a look at it at http://gist.github.com/234535 (constructive criticism welcome!). Some simple examples are provided at the end of the file. I have a few questions. - Why must i write (matrix/Matrix ...) ins

Re: transient quicksort

2009-08-05 Thread Jonas Enlund
Hi, Thank's for pointing this out for me. I didn't realize how to use these constructs correctly. Seeing the !-mark i just thought that assoc! was to be used like set! set-car! set-cdr! in Scheme... my mistake. On Tue, Aug 4, 2009 at 8:49 PM, Jarkko Oranen wrote: > > On Aug 4, 11:08 am, Jonas w

Re: transient quicksort

2009-08-04 Thread Jonas Enlund
On Tue, Aug 4, 2009 at 3:55 PM, Albert Cardona wrote: > > Jonas wrote: >>  Can you give any hints on how I can make the transient sort faster? I >>  would like to get as close as possible to the native Java speed. > > > My guess is that you need primitive type hints. For example: > >     (let [piv

Re: transient quicksort

2009-08-04 Thread Jonas Enlund
I get ~8% performance boost by turning swap-index! into a macro: (defmacro swap-index! [v i j] `(let [tmp# (~v ~i)] (assoc! ~v ~i (~v ~j)) (assoc! ~v ~j tmp#))) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: The :while modifier (list comprehensions)

2009-08-03 Thread Jonas Enlund
> When you put the :while at the `x` clause you get the expected empty > seq. > > user=> (for [x (range 1 10) :while (= x 2) y (range 1 10)] [x y]) > () Interesting, I didn't know that. Still, the behavior of :while feels strange. I guess I'll get used to it. In the following example :while and

Re: Newbie macro problems

2009-07-08 Thread Jonas Enlund
2. http://gist.github.com/142939 On Wed, Jul 8, 2009 at 7:19 PM, Jonas Enlund wrote: > 1. Ok, I'll consider that. > > 2. Yes, I'll post a link when I have uploaded the code somewhere. > > 3. It has not yet arrived > > 4. No. I have two sources of inspiration. Patte

Re: Newbie macro problems

2009-07-08 Thread Jonas Enlund
1. Ok, I'll consider that. 2. Yes, I'll post a link when I have uploaded the code somewhere. 3. It has not yet arrived 4. No. I have two sources of inspiration. Pattern matching in PLT Scheme and this link: http://groups.csail.mit.edu/mac/users/gjs/6.945/psets/ps05/ps.txt (which is almost SICP