Re: How can I improve this?

2014-01-10 Thread Jonas
Here's a version using reduce: (defn uniquify [items] (first (reduce (fn [[result count-map] item] (let [n (inc (count-map item 0))] [(conj result (str item _ n)) (assoc count-map item n)])) [[] {}]

Re: [ANN] Eastwood 0.1.0 Clojure lint tool

2014-01-11 Thread Jonas
=trueversionLabels=majorselectedProjectId=10371reportKey=com.atlassian.jira.plugin.system.reports%3Acreatedvsresolved-reportNext=Next Cheers, Jonas On Saturday, January 11, 2014 9:30:46 AM UTC+2, Andy Fingerhut wrote: Eastwood is a Clojure lint tool. It analyzes Clojure source code

Re: oob schemas, re: The Language of the System

2014-01-18 Thread Jonas
IIRC in that particular part of the talk he was specifically talking about (non-self describing) protocol buffers and not JSON. On Saturday, January 18, 2014 10:00:09 PM UTC+2, Brian Craft wrote: Regarding Rich's talk (http://www.youtube.com/watch?v=ROor6_NGIWU), can anyone explain the

Re: probably a noobie question: apparent memory leak

2014-03-29 Thread Jonas
You could give core.rrb-vector[1]. From the docs: The main API entry points are clojure.core.rrb-vector/catvec, performing vector concatenation, and clojure.core.rrb-vector/subvec, which produces a new vector containing the appropriate subrange of the input vector (in contrast to

Re: Animation libraries for clojurescript?

2014-04-20 Thread Jonas
found that SVG + one of the new React based CLJS wrapper libs is an excellent fit (see my experiments in reagent[3] and om[4]). There are also js libs for working with SVG such as Raphael[5] and the newer Snap.svg[6] (which is by the same author as Raphael). /Jonas [1] http://paperjs.org/ [2

Newbie macro problems

2009-07-08 Thread Jonas
Hi. I'm developing a simple pattern matching library for clojure but I am having trouble with macros (which I have almost zero experience with). I have a function `make-matcher` (make-matcher pattern) which returns a function that can pattern match on data and returns a map of bindings (or

The :while modifier (list comprehensions)

2009-08-03 Thread Jonas
I find the :while modifier non intuitive user= (for [x (range 1 10) y (range 1 10) :while (= y 2)] [x y]) () user= (for [x (range 1 10) y (range 1 10) :while (= x 2)] [x y]) ([2 1] [2 2] [2 3] [2 4] [2 5] [2 6] [2 7] [2 8] [2 9]) My (false) intuition told me that both expressions would have

transient quicksort

2009-08-04 Thread Jonas
Hi I'm playing with the new transient/persistent! features in Clojure. I have implemented quicksort as described on wikipedia (http:// en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code: (defn swap-index! [v i j] (let [tmp (v i)] (assoc! v i (v j)) (assoc! v j tmp))) (defn

Re: [ANN] analyze 0.3.0 - Hygienic transformation

2013-02-14 Thread Jonas
On Friday, February 15, 2013 6:19:00 AM UTC+2, ronen wrote: It looks as if https://github.com/jonase/kibit/ is a lint/check style tool that only reads the source code, this limits its utilization: Kibit readshttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/read

Re: datomic question

2013-03-03 Thread Jonas
Hi You can use the tempid (http://docs.datomic.com/clojure/index.html#datomic.api/tempid) function to generate new temporary ids. Jonas On Monday, March 4, 2013 8:50:56 AM UTC+2, edw...@kenworthy.info wrote: Okay, I think I understand that. Does that mean this code could never work

[ANN] Termito - a term rewriting library

2013-03-17 Thread Jonas
] [(+ 0 ?x) ?x]) (def rules (concat zero-rules identity-rules) and ask the library to simplify expressions for you: (simplify '(+ (* 0 x) (* 1 y) rules) ;; = y Feedback, usage and bug reports welcome! Jonas [1] https://github.com/jonase/termito -- -- You received this message

Re: GSOC Algebraic Expressions

2013-05-30 Thread Jonas
://jonase.github.io/kibit-demo/#1 [2] https://github.com/jonase/kibit Jonas On Wednesday, May 29, 2013 6:10:52 PM UTC+3, Maik Schünemann wrote: Hello, I am glad to announce that my proposal got accepted for google summer of code. I am doing the algebraic expression project idea which could lay

A simple mistake to make when translating Javascript to ClojureScript

2011-07-26 Thread Jonas
a mistake that I think experienced javascript developers might have a hard time to spot. Thanks, Jonas (The problem, of course, is that ‘click’ is a string in javascript but evaluates to the symbol click’ in clojurescript so it’s easy to make copy-paste errors) -- You received this message

Re: updating some values in map

2011-10-23 Thread Jonas
Another way to do it (defn apply-map-fn [m f ks] (reduce #(update-in %1 [%2] f) m ks)) -- 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 -

Re: Datestreams

2011-11-01 Thread Jonas
Hi Have you looked at the interleave function[1]? I'd guess that's the one you want. /Jonas [1] http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/interleave -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

Re: - vs - and names vs anonymous function

2011-11-02 Thread Jonas
hi). Also, the form (- hi (#(println %))) should also work fine. /jonas [1] https://github.com/clojure/clojure/blob/f5f827ac9fbb87e770d25007472504403ed3d7a6/src/clj/clojure/core.clj#L1528 -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: loop/recur and tail postion

2011-06-15 Thread Jonas
Is the call to recur not in tail position here? No, because of (cons (first lat) (recur a (rest lat))). You cons (first lat) after you call (recur ...). That is why (recur ...) is not in tail position. -- You received this message because you are subscribed to the Google Groups Clojure

Re: Attractive examples of function-generating functions

2012-08-10 Thread Jonas
How about the new reducers library: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html Jonas On Wednesday, August 8, 2012 7:48:23 PM UTC+3, Brian Marick wrote: I'm looking for medium-scale

Re: What is the meaning of :while in a for ?

2012-08-21 Thread Jonas
comprehension when the test evaluates to false (or nil) and returns the sequence generated thus far. Note the difference between (for [x [2 4 6 7 8] :when (even? x)] x) ; = (2 4 6 8) and (for [x [2 4 6 7 8] :while (even? x)] x) ; = (2 4 6) Hope that helps. Jonas On Tuesday, August 21

Re: What is the meaning of :while in a for ?

2012-08-21 Thread Jonas
On Tuesday, August 21, 2012 2:22:39 PM UTC+3, Tassilo Horn wrote: Jonas jonas@gmail.com javascript: writes: `:while` on the other hand ends the list comprehension when the test evaluates to false (or nil) and returns the sequence generated thus far. No, it's perfectly possible

Re: Building School Seating Charts in Clojure and ClojureScript: Part 1

2012-08-29 Thread Jonas
a similar project starting where I need to move/rotate/drag/drop graphical objects so I was wondering if you built your app on SVG, Canvas or something else? I'm leaning towards SVG (maybe via the Raphael.js library) but I'd love to know what path you took! Jonas -- You received this message because

[Ann] Kibit 0.0.6

2012-11-11 Thread Jonas
`*default-data-reader-fn*` var). This release also includes several new rules contributed by the community -- Many thanks! I hope you enjoy Kibit Jonas [1] https://github.com/jonase/kibit [2] https://github.com/clojure/core.logic [3] https://github.com/jonase/lein-kibit -- You received

Re: [Ann] Kibit 0.0.6

2012-11-12 Thread Jonas
in this area would be most appreciated! Jonas On Monday, November 12, 2012 4:20:58 PM UTC+2, Jim foo.bar wrote: Thank you Bronza...this is exactly what I meant! when using reducers 'into' is the norm isn't it? Couldn't kibit parse the ns declaration before it starts suggesting things

Re: math expression simplifier, kibit implementation

2012-11-30 Thread Jonas
enhancements they are aiming for. You can see some of the results of those discussions in many of Kevins gists on github (https://gist.github.com/lynaghk) Cheers, Jonas On Saturday, December 1, 2012 12:08:16 AM UTC+2, Brent Millare wrote: Hey all, Before I diving in detail into the code, can someone

Re: math expression simplifier, kibit implementation

2012-12-02 Thread Jonas
On Sunday, December 2, 2012 7:33:17 PM UTC+2, David Nolen wrote: On Sat, Dec 1, 2012 at 12:24 AM, Jonas jonas@gmail.com javascript:wrote: * Predicates on logic vars: [(foo (? x number?)) (bar ?x)] = match (foo 42) but not (foo :bar) This is now possible since we have

Re: Tail call in multi method?

2012-12-17 Thread Jonas
recur doesn't work well with multimethods: (defmulti foo identity) (defmethod foo 1 [n] (recur (dec n))) (defmethod foo 0 [n] :ok) (foo 1) ;; runs forever Jonas On Monday, December 17, 2012 6:56:34 PM UTC+2, juan.facorro wrote: What about recur http

Re: what is js/ in clojurescript?

2013-01-12 Thread Jonas
Hi I created an issue+patch on JIRA: http://dev.clojure.org/jira/browse/CLJS-455 Jonas On Monday, January 7, 2013 3:58:25 PM UTC+2, Peter Taoussanis wrote: Thanks David. Ticket patch welcome. I've been lazy / holding out for the electronic CA, but I'll make a note to come back

[ANN] nrepl-transcript

2013-01-14 Thread Jonas
Hi I created a middleware for nrepl that saves a transcript of your repl interactions so you can go back and see what you did. https://github.com/jonase/nrepl-transcript Feedback welcome! Jonas -- You received this message because you are subscribed to the Google Groups Clojure group

Re: Question about accessing java methods?

2011-12-21 Thread Jonas
You can also do (.. boxWidget GetProp3D (SetUserTransform t)) or (- boxWidget .GetProp3D (.SetUserTransform t)) -- 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

Re: Really loving Clooj but..

2011-12-30 Thread Jonas
You should take a look at tools.trace [1]. A minimal example: (ns trc.core (:use [clojure.tools.trace :only [deftrace]])) (deftrace fib [n] (if (or (= n 0) (= n 1)) 1 (+ (fib (- n 1)) (fib (- n 2) the following is printed when (fib 4) is evaluated: TRACE

Re: [ANN] analyze 0.1

2012-01-02 Thread Jonas
Hi Ambrose I’ve been playing around with your library and find it very intresting. A couple of questions: 1. In order to be able to run your examples I have to comment out the clojure.test, clojure.stacktrace and clojure.template namespaces. Otherwise I get a NullPointerException[1] which I’m

Re: [ANN] analyze 0.1

2012-01-02 Thread Jonas
Hi, I pulled the latest version. How are you running the code? Could you pull the latest master and try again? Nothing fancy: - clone the repo - lein deps - start emacs, clojure-jack-in, - compile e.g., examples/docstring - NullPointerException - comment out the three namespaces I mentioned -

Re: [ANN] analyze 0.1

2012-01-02 Thread Jonas
On Tuesday, January 3, 2012 9:45:04 AM UTC+2, Ambrose Bonnaire-Sergeant wrote: It seems if the namespace is not already loaded, then there are issues. That's it! It's simple to fix. Just require the namespaces in the ns form. I can send you a pull request if you want to? /Jonas -- You

How to use goog.dom.query

2012-01-24 Thread Jonas
Hi all I was wondering if it's possible to use goog.dom.query[1] from ClojureScript or ClojureScript One? It's a third party module but it's bundled with the Closure version which is downloaded by scripts/bootstrap. I've tried (:require [goog.dom.query :as query]) but that doesn't work out of

Re: got trouble when combine use condition-map and doc-string

2012-01-28 Thread Jonas
The docstring goes before the argument list: (defn another-f doc string here [x] {:pre [(pos? x)]} x) user= (another-f -1) java.lang.AssertionError: Assert failed: (pos? x) (NO_SOURCE_FILE:0) user= (doc another-f) - user/another-f ([x])

Re: filter out null values

2012-02-02 Thread Jonas
Note that `(filter identity ,,,)` will also remove `false` values: = (filter identity [1 2 nil 3 false 4]) (1 2 3 4) You could use `remove` instead = (remove nil? [1 2 nil 3 false 4]) (1 2 3 false 4) Hope that helps! Jonas -- You received this message because you

[ANN] data.csv 0.1.1

2012-02-13 Thread Jonas
Hi data.csv is a csv reader/writer for Clojure. I released version 0.1.1 today and it should arrive at maven central soon. New in this release is more control over how and when the writer will quote strings. Hopefully, all necessary information can be found on github[1] Jonas [1

Re: options for a function

2012-02-22 Thread Jonas
I'll fix this today. Thanks, 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 patient with your first post. To unsubscribe

Re: options for a function

2012-02-22 Thread Jonas
a few helper functions, for example (quote-string s \'), together with a good description of how to use with-binding, doseq, str/join etc. in the README file. Ideas welcome. Jonas -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group

[ANN] kibit, A static code analyzer

2012-03-04 Thread Jonas
there might exist simpler functions. For example, if the analyzer finds (apply concat (apply map ...) It will notify its user about the availability of `mapcat`. Jonas [1] https://github.com/jonase/kibit [2] https://github.com/clojure/core.logic -- You received this message because you

Re: [ANN] kibit, A static code analyzer

2012-03-04 Thread Jonas
(some pred) a b c) Thanks, 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 patient with your first post

Re: [ANN] kibit, A static code analyzer

2012-03-04 Thread Jonas
On Monday, March 5, 2012 12:44:14 AM UTC+2, Alex Baranosky wrote: Hi Jonas, Kibit just helped me find some good uses for inc, pos? when and when-not in Midje, thanks :) https://github.com/marick/Midje/commit/b0525b7237bf615e3013317d2a0c2fc56f14bfe2 That's very nice to hear! -- You

Re: [ANN] kibit, A static code analyzer

2012-03-05 Thread Jonas
On Monday, March 5, 2012 2:51:23 PM UTC+2, David Nolen wrote: It should unify: (foo ?x . ?y) If it doesn't we should open up a ticket for that. It seems to work, thanks! https://github.com/jonase/kibit/commit/4ec52462d3920470be63916928021f266f838f1b -- You received this message

[ANN] kibit 0.0.2

2012-03-09 Thread Jonas
all contributors and especially Paul deGrandis who has helped me with everything in this release! Jonas [1] https://github.com/jonase/kibit [2] https://github.com/clojure/core.logic [3] http://jonase.github.com/kibit/ -- You received this message because you are subscribed to the Google Groups

Compilable clojure program, but unreadable?

2012-03-10 Thread Jonas
(java.io.PushbackReader. (clojure.java.io/reader unread.clj))) #'user/reader user= (read reader) (require (quote [clojure.string :as s])) user= (read reader) (prn :clojure.string/kwd) Can anyone think of a way to read the file without loading/compiling it? Thanks, Jonas -- You

Re: Compilable clojure program, but unreadable?

2012-03-11 Thread Jonas
I think that ::s/foo should be resolved to :s/foo if there is no alias for s (like symbols). Jonas On Monday, March 12, 2012 1:50:50 AM UTC+2, Meikel Brandmeyer (kotarak) wrote: Hi, Am 12.03.2012 um 00:09 schrieb Stuart Sierra: The syntax ::s/kwd is incorrect syntax: it should

[ANN] kibit 0.0.3

2012-04-01 Thread Jonas
I'm happy to announce the release of kibit[1] version 0.0.3. New in this release include: * much better reporting * a more advanced rule system * more rules * bug fixes Thanks to all who have contributed! Jonas [1] https://github.com/jonase/kibit -- You received this message because you

[ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
methods and constructors - deprecated clojure vars - unused function arguments - unused private vars - reflection - naked (:use ...) - misplaced docstrings - keyword typos I appreciate bug reports and feature requests and I also hope you find it useful! Jonas [1] https://github.com/jonase/eastwood

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant wrote: Did I do something wrong? Sorry, I only tested in with lein2. I'll try to make it work with both in the next release. -- You received this message because you are subscribed to the Google Groups Clojure

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
runs on Clojure 1.2.1. On Thursday, April 19, 2012 4:30:19 PM UTC+3, Jonas wrote: On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant wrote: Did I do something wrong? Sorry, I only tested in with lein2. I'll try to make it work with both in the next release

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Jonas
On Wednesday, May 2, 2012 7:24:04 AM UTC+3, Sean Neilan wrote: Hi, I'm sure this has been discussed to death but I can't figure it out. I've got a file-seq sequence from (file-seq (java.io.File. /DirectoryWithMillionsOfFiles/)) that will cause an out of memory error if realized. I

Re: when function

2012-05-21 Thread Jonas
On Monday, May 21, 2012 6:54:28 PM UTC+3, Christian Guimaraes wrote: Hi all, I'm struggling with when code structures and my imperative mindset. What is the better approach (or functional approach) to work with a code like the below? (defn parse-group [group-identifier line] (when

Re: CRUD application backed only by immutable facts

2012-06-04 Thread Jonas
On Tuesday, June 5, 2012 3:59:39 AM UTC+3, Kevin Lynagh wrote: Has anyone seen or implemented a CRUD application in Clojure using a database of immutable facts? For instance, a traditional database table supporting a todo-list application has columns user_id, task_id,

Re: Scheme dotted pair equivalent in Clojure

2012-06-17 Thread Jonas
A very nice section of SICP[1] describes how cons/car/cdr can be built only with functions. Translated to Clojure it might look like (defn cons [a b] #(condp = % :car a :cdr b)) (defn car [cons-cell] (cons-cell :car)) (defn cdr [cons-cell]

Re: communicating quits to timeouts AND parent loop in core.async

2013-07-17 Thread Jonas
You can also use the alt! macro: (let [stop (chan)] (go (loop [] (println Hello World!) (alt! (timeout 1000) (do (println I'm done sleeping...) (recur)) stop :ok))) (!! (timeout 1)) (!! stop :now) (println We're done.))

[ANN] cljsfiddle.net

2013-09-28 Thread Jonas
user you must upgrade to firefox 25. Happy Hacking, Jonas [1] http://jsfiddle.net/ [2] http://jsbin.com/ [3] http://cljsfiddle.net/fiddle/jonase.bezier [4] http://cljsfiddle.net/view/jonase.snake [5] http://github.com/jonase/cljsfiddle -- -- You received this message because you

Re: [ANN] cljsfiddle.net

2013-09-28 Thread Jonas
Hi I updated the clojurescript version and core.async seems to work fine now: http://cljsfiddle.net/fiddle/jonase.async Jonas On Saturday, September 28, 2013 7:31:55 PM UTC+3, David Nolen wrote: Wow, awesome. Yes to core.async support, there was a release yesterday with new goodies

Re: [ANN] cljsfiddle.net

2013-09-29 Thread Jonas
Thanks! I added these two addons to the cljs editor and it's a huge improvement IMHO. Jonas On Saturday, September 28, 2013 9:41:52 PM UTC+3, Ian Bishop wrote: These are pretty great for writing Clojure in CodeMirror: http://codemirror.net//addon/edit/matchbrackets.js http://codemirror.net

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-08 Thread Jonas
On Tuesday, October 8, 2013 10:19:07 PM UTC+3, Laurent PETIT wrote: 2013/10/8 Greg Bowyer gbo...@fastmail.co.uk javascript: js Array(16).join(wat - 1) + Batman! NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman! js One of the many reasons we're using Clojurescript and not raw

Re: Clojure:Lisp :: LSD:Meditation

2014-06-13 Thread Jonas
I found this post from 2011 which probably is still relevant: https://groups.google.com/d/msg/clojure/t0pGIuoyB7I/RQtuuAOhes8J On Friday, June 13, 2014 1:05:47 PM UTC+3, David Della Costa wrote: You raise a good point, which is that I don't know what the group policy is or where it's posted.

Re: Transducers: Why left to right rather than right to left?

2014-10-30 Thread Jonas
clojure.core/comp has not been changed at all. It's just the nature of how transducers work. Here's a another example where function composition seems to compose left-to-right (the second example, `comp2`): (defn add-3 [x] (+ 3 x)) (defn mul-2 [y] (* 2 y)) (defn sub-1 [z] (- 1 z))

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-14 Thread Jonas
Is this cheating? (defn altsum [n] (int (* (if (even? (inc n)) 1 -1) (Math/floor (/ (inc n) 2) On Friday, November 14, 2014 3:31:38 AM UTC+2, Andy L wrote: Hi, All I was able to come up with was this (defn altsum[n] (reduce + (map * (range 1 (inc n))

core.async pub/sub closing source channel issue

2015-03-01 Thread Jonas
-chan (async/thread (async/close! source) (async/unsub-all pub)) ;; This will close sub-chan (async/thread (async/close! source)) What is the reason for this behaviour? Is it unnecessary to call unsub-all if I close the publications source channel? Thanks, Jonas

[ANN] eq - A command line tool for edn

2016-06-12 Thread Jonas
github. /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 patient with your first post. To unsubscribe from this g

Re: Clojure 1.0

2009-05-04 Thread Jonas Bonér
Big congrats. Fantastic work Rich and all contributors. Thanks for making this happen. /Jonas 2009/5/4 Rich Hickey richhic...@gmail.com: After a sustained period of API stability and minimal bugs reports, I'm happy to announce the release of Clojure 1.0! http://clojure.googlecode.com/files

Re: Clojure goes Git!

2009-06-17 Thread Jonas Bonér
Awesome. Good decision. On Jun 17, 2:17 am, Rich Hickey richhic...@gmail.com wrote: Clojure and contrib repos are now on GitHub: http://github.com/richhickey/clojurehttp://github.com/richhickey/clojure-contrib Issues and other development collaboration has moved to Assembla:

Re: First Release of Chimp available

2008-10-08 Thread Jonas Bengtsson
? Is the idea that I should launch chimp and then launch vim inside the screen session? Thanks in advance, Jonas On Aug 18, 11:47 pm, Meikel Brandmeyer [EMAIL PROTECTED] wrote: Dear vimming Clojurians, the first release of Chimp is available. It is similar to Limp, VILisp, fvl and the previously

Re: First Release of Chimp available

2008-10-08 Thread Jonas Bengtsson
(/usr/bin/screen -list screenlist) Sorry for getting a bit OT but I'd really like to get this thing working. If anyone has any idea I would very much appreciate it! Cheers, Jonas On Oct 8, 11:07 pm, Meikel Brandmeyer [EMAIL PROTECTED] wrote: Hello, Am 08.10.2008 um 23:16 schrieb Jonas

Re: How can I improve this?

2014-01-10 Thread Jonas Enlund
On Fri, Jan 10, 2014 at 9:39 PM, Mark Engelberg mark.engelb...@gmail.comwrote: 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

Re: Newbie macro problems

2009-07-08 Thread Jonas Enlund
a copy of Programming Clojure by Stuart Holloway Sean On Jul 8, 11:42 am, Jonas jonas.enl...@gmail.com wrote: Hi. I'm developing a simple pattern matching library for clojure but I am having trouble with macros (which I have almost zero experience with). I have a function `make

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 Enlundjonas.enl...@gmail.com 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. Pattern matching

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: 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

Re: transient quicksort

2009-08-04 Thread Jonas Enlund
On Tue, Aug 4, 2009 at 3:55 PM, Albert Cardonasapri...@gmail.com 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

Re: transient quicksort

2009-08-05 Thread Jonas Enlund
, 11:08 am, Jonas jonas.enl...@gmail.com wrote: Hi I'm playing with the new transient/persistent! features in Clojure. I have implemented quicksort as described on wikipedia (http:// en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code: (defn swap-index! [v i j]   (let [tmp (v i

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Jonas Enlund
.* interfaces to (extends ...). /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 patient with your first post. To unsubscribe from

Re: Datatypes and Protocols - early experience program

2009-11-16 Thread Jonas Enlund
On Mon, Nov 16, 2009 at 6:27 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Nov 14, 8:28 am, Jonas Enlund jonas.enl...@gmail.com 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

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 patient

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 konrad.hin...@fastmail.net wrote: On 01.01.2010, at 23:56, Hugo

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, Jan 4,

Re: how to use with-bindings*

2010-02-15 Thread Jonas Enlund
On Mon, Feb 15, 2010 at 7:25 AM, Аркадий Рост arkr...@gmail.com 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 simple csv parsing library

2010-05-25 Thread Jonas Enlund
performance still be improved? b) Is it idiomatically written? c) What should an idiomatic csv parsing API look like in Clojure? Currently there is only one public function, 'parse' (like clojure.xml). The end of the file contains a few usage examples. happy hacking! /Jonas [1] http://gist.github.com

Recur on a function which uses keyword arguments?

2010-06-06 Thread Jonas Enlund
to recur on a function which uses keyword arguments? If so, is using loop/recur the correct workaround? - 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

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 jonas.enl...@gmail.com wrote: Hi there I built a simple csv parsing library[1] last

Re: A simple csv parsing library

2010-06-09 Thread Jonas Enlund
don't want to sacrifice performance since I consider that to be the most important feature in any csv reading library (people often have Gb+ sized csv files). Jonas On Wed, Jun 9, 2010 at 6:54 AM, Kyle R. Burton kyle.bur...@gmail.com wrote: I've added my work on the csv reader/writer library

Re: A simple csv parsing library

2010-06-11 Thread Jonas Enlund
On Thu, Jun 10, 2010 at 1:01 AM, Daniel Werner daniel.d.wer...@googlemail.com 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

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

2013-02-09 Thread Jonas Enlund
/bootstrap pulls in different closure-library deps than are specified in the pom.xml. The browser repl works without cljsbuild out of the box. If more testing concerning this issue is required please tell me because I'd like to see a new clojurescript release soon. Jonas [1] https://github.com

proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
[] chrs, int offs, int len) throws IOException { String str = new String(chrs, offs, len); text.append(str); } } public static void main(String[] args) throws IOException { Main m = new Main(); m.writer.write(Hello, World!); } } Any help is much appreciated! /Jonas

Re: proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
On Sun, Jan 30, 2011 at 7:01 PM, Ken Wesson kwess...@gmail.com wrote: On Sun, Jan 30, 2011 at 9:26 AM, Jonas Enlund jonas.enl...@gmail.com 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 clojure code so far: (def

Re: proxy and java.io.Writer

2011-01-30 Thread Jonas Enlund
On Sun, Jan 30, 2011 at 8:39 PM, Ken Wesson kwess...@gmail.com wrote: On Sun, Jan 30, 2011 at 1:35 PM, Jonas Enlund jonas.enl...@gmail.com wrote: On Sun, Jan 30, 2011 at 7:01 PM, Ken Wesson kwess...@gmail.com wrote: On Sun, Jan 30, 2011 at 9:26 AM, Jonas Enlund jonas.enl...@gmail.com wrote

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