Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Max Penet
Thanks! This looks really good. I hope this ends up in contrib at some point, also looking forward to its extension (guards co). On Aug 9, 7:49 am, David Nolen dnolen.li...@gmail.com wrote: Ambrose and I have been working on a high performance pattern matching library for Clojure. There's

How to read project.clj file.

2011-08-09 Thread mmwaikar
Hi, Assuming there are some DB credentials specified in a project.clj file as a map, how should I read those credentials in my clojure code - 1) should I use slurp and then parse that text? 2) should I (use 'leiningen.core) and then (load-file project.clj) 3) or something else Please let me

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Sam Aaron
Exciting stuff! Do you happen to have any simple descriptions/examples of where and how we might use this stuff in our daily programming repertoires? I for one am sure I'm not educated enough as to the value and utility of pattern matching - at the moment I just think that looks cool rather

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Baishampayan Ghose
Do you happen to have any simple descriptions/examples of where and how we might use this stuff in our daily programming repertoires? I for one am sure I'm not educated enough as to the value and utility of pattern matching - at the moment I just think that looks cool rather than I'm

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Edmund
That's a great explanation Baishampayan, thanks ! Edmund On 09/08/2011 10:43, Baishampayan Ghose wrote: Do you happen to have any simple descriptions/examples of where and how we might use this stuff in our daily programming repertoires? I for one am sure I'm not educated enough as to the

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Ambrose Bonnaire-Sergeant
Hi Sam, On Tue, Aug 9, 2011 at 3:50 PM, Sam Aaron samaa...@gmail.com wrote: Do you happen to have any simple descriptions/examples of where and how we might use this stuff in our daily programming repertoires? Think of pattern matching sugar for nested conditionals. For example (match [x

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Ambrose Bonnaire-Sergeant
Hi BG, On Tue, Aug 9, 2011 at 5:43 PM, Baishampayan Ghose b.gh...@gmail.comwrote: A sample implementation of the `defm` macro used above could be something like this (UNTESTED!) - *snip* `defm` is already at `match.core/defmatch`. Pretty neat :) I personally believe that David and

Re: Argslist of fn?

2011-08-09 Thread Sunil S Nandihalli
Hey, This may be not be the answer you are expecting but here it goes anyways.. (defmacro fnd [ rest] `(with-meta (fn ~@rest) {:source '~form})) would associate the source of the function with the function as its meta data you are defining and you can extract any subset of it for whatever

Re: standalone indentation tool

2011-08-09 Thread Philipp Steinwender
thanks for that lars. it works better. emacs does restart for each file, but it is faster than before because it only evaluates the code without ui. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Referencing Clojure code from the ClojureScript namespace

2011-08-09 Thread Paul Dorman
Thanks from me as well. This very question was my very next challenge. I would like to reuse Clojure functions from ClojureScript to achieve consistent back- and front-end password quality validation. One potential wrinkle may be the issue of the size of the bloom filter I'm using for the

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Ambrose Bonnaire-Sergeant
For those browsing the source, I'll give a quick run through of what's going on. 1. A pattern matrix is built using the given variables and pattern rows. A Pattern row is a pair of matches and a result. Example: match.core= (build-matrix [x y] [1 0] 0

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Sam Aaron
Wonderful. Baishampayan and Ambrose thanks so much for your fantastically lucid examples. I can totally see myself using this stuff. David and Ambrose, it's remarkable work - well done! Sam --- http://sam.aaron.name -- You received this message because you are subscribed to the Google

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread David Nolen
On Tue, Aug 9, 2011 at 3:50 AM, Sam Aaron samaa...@gmail.com wrote: Exciting stuff! Do you happen to have any simple descriptions/examples of where and how we might use this stuff in our daily programming repertoires? I for one am sure I'm not educated enough as to the value and utility of

Re: standalone indentation tool

2011-08-09 Thread Philipp Steinwender
sorry i didn't check the result. with --batch something went wrong. the indentation gets weird. -- 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

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread David Nolen
On Tue, Aug 9, 2011 at 6:34 AM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: For those browsing the source, I'll give a quick run through of what's going on. This means that the machinery is already exposed. There's a bit of code cleanup to do but the pattern matcher is

Re: Howto automate tests w/ ClojusreScript?

2011-08-09 Thread Timothy Washington
Hmm, I tried this with a v8 shell, and I still get... load('out/goog/base.js'); load('out/goog/deps.js'); load('bkeeping.js'); bkeeping.fubar(thing); *(shell):1: ReferenceError: bkeeping is not defined* *bkeeping.fubar(thing);* *^* Where cat bkeeping.cljs gives... *(ns bkeeping* *

Re: standalone indentation tool

2011-08-09 Thread Bendlas
On Aug 7, 10:50 pm, Phil Hagelberg p...@hagelb.org wrote: I think your best bet is to use Emacs from the command-line. Even if people edit outside Emacs, it's easy to invoke for indentation purposes:     $ emacs --eval (progn (find-file \badly_indented.clj\) (indent-region (point-min)

Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Eric Merritt
Hello All, Are there any thoughts yet on distributing ClojureScript libraries? ClojureScript does whole program optimization, it needs the sources. Copying the sources into your main project isn't really a solution, not a long term solution at the very least. At the very least it would be nice

Toward in-browser ClojureScript debugging ?

2011-08-09 Thread Thomas CORDIVAL
Hello everybody, I ran across a nice feature the Firefox and Webkit developers are currently working on: the possibility of mapping the javascript source code executed by the VM and another file of source code, for example written in clojurescript or coffeescript. This feature is already

Re: Argslist of fn?

2011-08-09 Thread Stefan Kamphausen
Hi, On Tuesday, August 9, 2011 12:09:58 PM UTC+2, Sunil Nandihalli wrote: would associate the source of the function with the function as its meta data you are defining actually I really do think that it would be great to have the orignal defn add the source to the metadata. Then one

Re: Toward in-browser ClojureScript debugging ?

2011-08-09 Thread Chouser
On Tue, Aug 9, 2011 at 2:27 AM, Thomas CORDIVAL tuxe...@gmail.com wrote: Hello everybody, I ran across a nice feature the Firefox and Webkit developers are currently working on: the possibility of mapping the javascript source code executed by the VM and another file of source code, for

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Ambrose Bonnaire-Sergeant
On Tue, Aug 9, 2011 at 7:39 PM, David Nolen dnolen.li...@gmail.com wrote: Think about code for dealing with macros. (defmacro foo [ forms] (match [forms] [(a [x] :else rest)] ... [(a [x b] :else rest)] ...)) Wow, that is cool! -- You received this message because you are

Re: How to read project.clj file.

2011-08-09 Thread Daniel E. Renfer
On 08/09/2011 05:35 AM, Shantanu Kumar wrote: On Aug 9, 12:22 pm, mmwaikar mmwai...@gmail.com wrote: Hi, Assuming there are some DB credentials specified in a project.clj file as a map, how should I read those credentials in my clojure code - 1) should I use slurp and then parse that

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread Meikel Brandmeyer (kotarak)
Hi, Am Dienstag, 9. August 2011 15:14:25 UTC+2 schrieb Ambrose Bonnaire-Sergeant: On Tue, Aug 9, 2011 at 7:39 PM, David Nolen dnolen...@gmail.com wrote: Think about code for dealing with macros. (defmacro foo [ forms] (match [forms] [(a [x] :else rest)] ... [(a [x b] :else

Re: ClojureScript Compile errors

2011-08-09 Thread David Nolen
On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote: In Clojure, namespaces are different from the host's packages, in ClojureScript they are the same (insofar as they match the Google Closure approach). Makes sense. Why all the attention to :use - I thought everyone

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Brenton
There isn't an official way to do this now but you can package a ClojureScript library (of .cljs files) into a jar and add it to the classpath. Once on the classpath, the namespaces in the library can then be required and used just as you would currently use clojure.set or clojure.string.

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Marko Kocić
If you mark your public functions with ^:export, even advanced optimization will keep those functions intact. You can campile your library into js, and distribute that file. You can use this compiled file just as any other Closure compatible javascript library. Regards, Marko -- You received

Re: ClojureScript Compile errors

2011-08-09 Thread Chas Emerick
On Aug 9, 2011, at 10:01 AM, David Nolen wrote: On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote: Why all the attention to :use - I thought everyone agreed using it is a bad idea? I like pairing :use with :only especially between files that belong to the same

Re: standalone indentation tool

2011-08-09 Thread Phil Hagelberg
On Tue, Aug 9, 2011 at 4:42 AM, Philipp Steinwender philipp.a.steinwen...@gmail.com wrote: sorry i didn't check the result. with --batch something went wrong. the indentation gets weird. The --batch flag causes it to skip your personal dotfiles, so you will have to explicitly load clojure-mode.

Re: ANN: Optimized Pattern Matching Library for Clojure

2011-08-09 Thread David Nolen
On Tue, Aug 9, 2011 at 1:49 AM, David Nolen dnolen.li...@gmail.com wrote: Ambrose and I have been working on a high performance pattern matching library for Clojure. There's much left to do but it's already in a place where it's fun to play around with and we think some of you might even find

Re: Optimizing JDBC code

2011-08-09 Thread Shoeb Bhinderwala
Hi Sean – With these options added the Clojure code runs just about as fast as Java. I set the fetch size to 1000 for both of them. Average run times to load 69,000 records: Java = 2.67 seconds Clojure = 2.72 seconds Thanks Shoeb On Aug 9, 12:54 am, Sean Corfield seancorfi...@gmail.com

Creating a map algorithmically

2011-08-09 Thread Kevin Sookocheff
Hi, I have a question regarding the map data structure. I'm trying to program a Sieve of Eratosthenes using the algorithm at Wikipedia: *Input*: an integer *n* 1 Let *A* be an array of bool values, indexed by integers 2 to *n*, initially all set to *true*. *for* *i* = 2, 3, 4, ..., *while*

Re: Creating a map algorithmically

2011-08-09 Thread Bob Shock
user= (def n 5) #'user/n user= (zipmap (range 2 (inc n)) (repeat true)) {5 true, 4 true, 3 true, 2 true} user= As a start... On Aug 9, 10:50 am, Kevin Sookocheff kevin.sookoch...@gmail.com wrote: Hi, I have a question regarding the map data structure. I'm trying to program a Sieve of

Re: Optimizing JDBC code

2011-08-09 Thread Colin Yates
Nice work getting to the bottom of this. Sent from my iPad On 9 Aug 2011, at 17:39, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: Hi Sean – With these options added the Clojure code runs just about as fast as Java. I set the fetch size to 1000 for both of them. Average run times to

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Chris Granger
FWIW, I've already done what Brenton describes (jar'ing the compiler and such) for noir-cljs (https://github.com/ibdknox/noir-cljs) which adds compilation as middleware. I've also gone the route of jar'ing up my clojurescript stuff and that has worked really well. It seems to me that there's no

Re: Stanford AI Class

2011-08-09 Thread Zack Maril
If you looks here, http://aima.cs.berkeley.edu/code.html, you can see that the data/code is provided in formats for Java, Lisp, Python, and just some plaintext as well. Here is his rationale, and other info, about why he switched: http://norvig.com/python-lisp.html Personally, I plan on giving it

Re: Creating a map algorithmically

2011-08-09 Thread joegallo
(zipmap (range 2 (inc n)) (repeat true)) -- 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

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Eric Merritt
On Tue, Aug 9, 2011 at 9:25 AM, Brenton bashw...@gmail.com wrote: There isn't an official way to do this now but you can package a ClojureScript library (of .cljs files) into a jar and add it to the classpath. Once on the classpath, the namespaces in the library can then be required and used

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Eric Merritt
Thanks Marko! However, I am looking at using this for a new project and I am going to try to treat javascript as nothing more the assembler for the browser. That being the case I am really going to try to avoid worrying too much about how Clojurescript compiles to Javascript. The other side of

Re: Stanford AI Class

2011-08-09 Thread daly
On Tue, 2011-08-09 at 10:42 -0400, Robert Levy wrote: Another likely factor is that Google (where Norvig works) supports Python but not Lisp. With some exceptions I guess? http://www.itasoftware.com/ http://en.wikipedia.org/wiki/Google_App_Inventor

Re: Distributing ClojureScript Libraries packaging/dependencies

2011-08-09 Thread Eric Merritt
On Tue, Aug 9, 2011 at 1:08 PM, Chris Granger ibdk...@gmail.com wrote: FWIW, I've already done what Brenton describes (jar'ing the compiler and such) for noir-cljs (https://github.com/ibdknox/noir-cljs) which adds compilation as middleware. This is actually really really great. Though a little

Re: ClojureScript macro import

2011-08-09 Thread Stuart Sierra
It's not currently possible to refer macros without a namespace prefix: ClojureScript does not have `refer` or `use`. There have been some discussions around this, don't have a link handy. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups

Re: ClojureScript macro import

2011-08-09 Thread Kevin Lynagh
Okay, that's the impression I got from poking around but I just wanted to make sure I wasn't missing anything. Thanks Stuart. On Aug 9, 1:46 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: It's not currently possible to refer macros without a namespace prefix: ClojureScript does not have

Re: Creating a map algorithmically

2011-08-09 Thread pmbauer
For the sieve, if performance matters, clojure's native data structures may not be the best choice. A mutable array of boolean primitives could be more apropos. (defn prime-sieve [^long n] (let [^booleans sieve (make-array Boolean/TYPE (inc n))] ...) ... using aset/aget to write/read

Re: Stanford AI Class

2011-08-09 Thread Robert Levy
unfamiliar with my resume (nobody at Google knew what was on it even though they had a copy at the interview). The whole idea of such approaches shows (a) a lack of respect for the individual and (b) an arrogant attitude of you should feel LUCKY that we even CONSIDERED talking to you...Google

Problem getting started: Wrong number of args (4) passed to: core$assert

2011-08-09 Thread Daniel Ribeiro
Hi, When starting the clojurscript from a clojure repl: clojurescript $ script/repl Clojure 1.2.1 user= (require '[cljs.compiler :as comp]) java.lang.IllegalArgumentException: Wrong number of args (4) passed to: core$assert (core.clj:63) user= The jdk version: java -version java version

Re: Problem getting started: Wrong number of args (4) passed to: core$assert

2011-08-09 Thread David Nolen
On Tue, Aug 9, 2011 at 8:09 PM, Daniel Ribeiro dan...@gmail.com wrote: Hi, When starting the clojurscript from a clojure repl: clojurescript $ script/repl Clojure 1.2.1 user= (require '[cljs.compiler :as comp]) java.lang.IllegalArgumentException: Wrong number of args (4) passed to:

Example of a real-world ClojureScript web application

2011-08-09 Thread Filip de Waard
I'm working on Vix, which is a document repository and content management system written in Clojure with a CouchDB backend. After the announcement on July 23 I immediately got excited about ClojureScript and the Google Closure toolkit, so I dropped the existing Backbone.js and jQuery code and

Re: Problem getting started: Wrong number of args (4) passed to: core$assert

2011-08-09 Thread Daniel Ribeiro
Thanks. Worked great. -- 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

Re: Creating a map algorithmically

2011-08-09 Thread Sunil S Nandihalli
you should considering looking at clojure.contrib.lazy-seqs/primes to get an idea it is implemented there.. Sunil. On Wed, Aug 10, 2011 at 1:48 AM, Chouser chou...@gmail.com wrote: On Tue, Aug 9, 2011 at 12:50 PM, Kevin Sookocheff kevin.sookoch...@gmail.com wrote: Hi, I have a question

Re: Optimizing JDBC code

2011-08-09 Thread Sean Corfield
On Tue, Aug 9, 2011 at 9:39 AM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: With these options added the Clojure code runs just about as fast as Java. I set the fetch size to 1000 for both of them. Average run times to load 69,000 records: Java = 2.67 seconds Clojure = 2.72

Re: Example of a real-world ClojureScript web application

2011-08-09 Thread David Jagoe
Thank you for making this available! On 10 August 2011 02:53, Filip de Waard f...@vix.io wrote: I'm working on Vix, which is a document repository and content management system written in Clojure with a CouchDB backend. After the announcement on July 23 I immediately got excited about