sorted-set
Trying to migrate some of my code from clojure and javascript to ClojureScript and I'm missing 'sorted-set' Does anyone know if is is one of those parts of the library that has just not yet been migrated? Or will not at all be migrated? Or maybe I'm getting something wrong and its usage is not recommended in Clojure? In that case is there a recommended alternative? It might affect my ability to migrate to ClojureScript. Today I'm using javascript arrays that I keep sorted on the client side and clojure sorted-sets on the server. It would be really cool to have sorted-set's on both sides thanks Oded -- 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: Interfacing Cljs with external libs.
Looking at the this line closely from Advanced Compilation and Externs [1]: Closure Compiler compilation never changes string literals in your code, no matter what compilation level you use... Whenever possible, use dot-syntax property names rather than quoted strings. Use quoted string property names only when you don't want Closure Compiler to rename a property at all. Considering in this case that I don't want the compiler to rename the property `makeHtml`, I changed the code from dot notation to bracket notation [2] using the `aget` macro [3]. Dot notation ref (. (js/Showdown.converter.) makeHtml arg1 arg2) - (new q.Showdown.converter).Fb(...) Bracket notation ref (working) ((aget (js/Showdown.converter.) makeHtml) arg1 arg2) - (new q.Showdown.converter).makeHtml.call(...) @Michael Fogus: considering that the docs[1] advise the use the dot notation over bracket notation whenever possible, would you agree that it would be a better approach to add external libraries to :externs option [4] specifically when compiled code makes many different references to external code? Additionally, IMHO, the dot notation is more concise and idiomatic, i.e. there is no need to explicitly *get* the property. -Alen [1] http://code.google.com/closure/compiler/docs/api-tutorial3.html [2] ECMA 262 Section 11.2.1 Property Accessors - http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf [3] The `aget` macro produces a bracket notation based JS call like so: (new q.Showdown.converter)[makeHtml] [4] This ticket will solve this: http://dev.clojure.org/jira/browse/CLJS-10 On Aug 5, 11:00 pm, Michael Fogus mefo...@gmail.com wrote: Well, Showdown is not really a namespace right? It's an object in the global environment. You should be able to grab it via js/Showdown and do all kinds of interopey things to it. On Aug 5, 2011 4:27 PM, Alen Ribic alen.ri...@gmail.com wrote: Thanks Fogus for clearing that up. Would a call to a constructor function in a namespace of a third-party library be an exception for the time being? (I can't seem to see a clear way you can express that via `js` namespace.) Example: new Showdown.converter().makeHtml(~{b-txt},~{safe}) Showdown is the namespace and the converter function is the constructor. -Al On Aug 5, 8:57 pm, Fogus mefo...@gmail.com wrote: To access global JavaScript interop thingies (a technical term) you should use the `js` namespace. The use of `js*` should be considered a bad idea. It's used in core, but only for very low-level operations. It should be considered undocumented and therefore off- limits (we're working to eliminate its need). Look at code at the following link to see a very simple way to access global js functions: https://gist.github.com/1127895 Let us know if that helps. -- 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: sorted-set
Trying to migrate some of my code from clojure and javascript to ClojureScript and I'm missing 'sorted-set' Does anyone know if is is one of those parts of the library that has just not yet been migrated? Or will not at all be migrated? Or maybe I'm getting something wrong and its usage is not recommended in Clojure? In that case is there a recommended alternative? It might affect my ability to migrate to ClojureScript. Today I'm using javascript arrays that I keep sorted on the client side and clojure sorted-sets on the server. It would be really cool to have sorted-set's on both sides thanks Oded Hi Oded, sorted-set is on the todo list. Also, the which libraries are todo list is available in the repos at devnotes/corelib.org. Just look for anything marked todo. Stu Stuart Halloway Clojure/core http://clojure.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
Re: JSON library for clojure 1.3
From clojure.contrib.string 1.2, I have found myself using drop, take, and butlast. (These are more than just wrappers for String/substring, because they behave nicely when indices exceed the string length.) I like these methods in part because they match the behavior of corresponding sequence methods, but have better performance. This makes optimizing (when needed) easier. Thanks, Arthur On Aug 5, 6:36 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Are there any features you found essential in clojure.contrib.str-utils{2|3} that are not included in clojure.string? Please let me know, and we can consider tickets for those specific functions. -Stuart Sierra clojure.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
Out of memory using pmap
Problem summary: I am running out of memory using pmap but the same code works with regular map function. My problem is that I am trying to break my data into sets and process them in parallel. My data is for an entire month and I am breaking it into 30/31 sets - one for each day. I run a function for each daily set of data using pmap, something like: (defn process-monthly-data [grp-id month year] (doall (pmap #(process-daily-data grp-id % month year) (range 31))) (defn process-daily-data [grp-id day month year] ( ;load and process daily data … )) When I run my function using regular map it works fine, but when I change it to pmap I get an OutOfMemoryException. What am I doing wrong? -- Shoeb -- 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
Optimizing JDBC code
I am loading about 100,000 records from the database with clojure.contrib.sql, using a simple query that pulls in 25 attributes (columns) per row. Most of the columns are of type NUMBER so they get loaded as BigDecimals. I am using Oracle database and the jdbc 6 driver ( com.oracle/ojdbc6 11.1.0.7.0). I am using clojure 1.2.1. The code is about 10 times slower than the same code written in Java using the JDBC API. Is there any way to speed this up? Type hints? Move to Clojure 1.3? I am assuming that most of the extra time is spent converting the results into Clojure maps. Does anybody have experience optimizing code to load data from the database? -- Shoeb -- 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: Out of memory using pmap
Just a guess. If your daily data is huge you will be loading the data for only one day when using map and you will be loading the data for multiple days (equal to number of parallel threads) .. and may be this is the cause of the problem. Sunil. On Sat, Aug 6, 2011 at 11:40 PM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: Problem summary: I am running out of memory using pmap but the same code works with regular map function. My problem is that I am trying to break my data into sets and process them in parallel. My data is for an entire month and I am breaking it into 30/31 sets - one for each day. I run a function for each daily set of data using pmap, something like: (defn process-monthly-data [grp-id month year] (doall (pmap #(process-daily-data grp-id % month year) (range 31))) (defn process-daily-data [grp-id day month year] ( ;load and process daily data … )) When I run my function using regular map it works fine, but when I change it to pmap I get an OutOfMemoryException. What am I doing wrong? -- Shoeb -- 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: swank-cdt: Using Slime with the Clojure Debugging Toolkit
Hey Andreas: I have heard that it works on Windows, though I've never tried it. Which jvm are you using? Also, can you try attaching with command line jdb like so and see if that gets the no providers exception. 1. add a specific port to your jvm options, like 8021 below: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8021 2. invoke jdb from the command line with that port, like so: jdb -attach 8021 3. see if you get any errors thanks, g On Aug 5, 4:34 am, Andreas Liljeqvist bon...@gmail.com wrote: I have problem getting it to work. Windows 7. swank-clojure 1.4.0-SNAPSHOT clojure-mode 1.10.0 lein 1.6.1 GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600) of 2011-03-10 on 3249CTO project.clj: (defproject tetris 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.1] [org.clojure/clojure-contrib 1.2.0] [midje 1.1-alpha-1]] :dev-dependencies [[clojure-source 1.2.1] [swank-clojure 1.4.0-SNAPSHOT]] :jvm-opts [-agentlib:jdwp=transport=dt_socket,server=y,suspend=n]) M-x: clojure-jack-in user (use 'swank.cdt) warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail. com.sun.jdi.Bootstrap [Thrown class java.lang.ClassNotFoundException] ... Manually added tools.jar to classpath. user (use 'swank.cdt) warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail. CDT 1.4.0a startup failed: #IOException java.io.IOException: no providers installed nil 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 at http://groups.google.com/group/clojure?hl=en
Re: Out of memory using pmap
You didn't understand my problem. The exact same code throws out of memory when I change map to pmap. My monthly data is evenly divided into 30 sets. For e.g total monthly data = 9 records, daily data size for each day = 3000 records. I am trying to achieve performance gain by processing the daily data in parallel. On Aug 6, 2:18 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Just a guess. If your daily data is huge you will be loading the data for only one day when using map and you will be loading the data for multiple days (equal to number of parallel threads) .. and may be this is the cause of the problem. Sunil. On Sat, Aug 6, 2011 at 11:40 PM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: Problem summary: I am running out of memory using pmap but the same code works with regular map function. My problem is that I am trying to break my data into sets and process them in parallel. My data is for an entire month and I am breaking it into 30/31 sets - one for each day. I run a function for each daily set of data using pmap, something like: (defn process-monthly-data [grp-id month year] (doall (pmap #(process-daily-data grp-id % month year) (range 31))) (defn process-daily-data [grp-id day month year] ( ;load and process daily data … )) When I run my function using regular map it works fine, but when I change it to pmap I get an OutOfMemoryException. What am I doing wrong? -- Shoeb -- 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: Optimizing JDBC code
That assumption needs checking - first rule of performance analysis: check, don't guess :) For example, is the java code using an existing connection versus clojure creating one? I would also time the cost of creating 10 clojure maps of a similar structure. Finally - 100,000 is big enough to give a small heap size worriesare the jvm settings the same? Sent from my iPad On 6 Aug 2011, at 19:11, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: I am loading about 100,000 records from the database with clojure.contrib.sql, using a simple query that pulls in 25 attributes (columns) per row. Most of the columns are of type NUMBER so they get loaded as BigDecimals. I am using Oracle database and the jdbc 6 driver ( com.oracle/ojdbc6 11.1.0.7.0). I am using clojure 1.2.1. The code is about 10 times slower than the same code written in Java using the JDBC API. Is there any way to speed this up? Type hints? Move to Clojure 1.3? I am assuming that most of the extra time is spent converting the results into Clojure maps. Does anybody have experience optimizing code to load data from the database? -- Shoeb -- 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: Out of memory using pmap
The point is that sequentially the GC gets to remove stale entries so simplistically only 3000 records are in memory at any one time, in parallel processing all 9 can be in memory at the same time. Sent from my iPad On 6 Aug 2011, at 21:34, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: You didn't understand my problem. The exact same code throws out of memory when I change map to pmap. My monthly data is evenly divided into 30 sets. For e.g total monthly data = 9 records, daily data size for each day = 3000 records. I am trying to achieve performance gain by processing the daily data in parallel. On Aug 6, 2:18 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Just a guess. If your daily data is huge you will be loading the data for only one day when using map and you will be loading the data for multiple days (equal to number of parallel threads) .. and may be this is the cause of the problem. Sunil. On Sat, Aug 6, 2011 at 11:40 PM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: Problem summary: I am running out of memory using pmap but the same code works with regular map function. My problem is that I am trying to break my data into sets and process them in parallel. My data is for an entire month and I am breaking it into 30/31 sets - one for each day. I run a function for each daily set of data using pmap, something like: (defn process-monthly-data [grp-id month year] (doall (pmap #(process-daily-data grp-id % month year) (range 31))) (defn process-daily-data [grp-id day month year] ( ;load and process daily data … )) When I run my function using regular map it works fine, but when I change it to pmap I get an OutOfMemoryException. What am I doing wrong? -- Shoeb -- 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 -- 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
Using Lein with Local Jars on Heroku
I am trying to push a Clojure app on Heroku. I have a local jar file that the app needs. How can I get lein to use the local jar? When I have local jar dependencies on my personal machine I just install the jar into the local maven repository on the machine. It's not obvious to me how to do this on Heroku. Does anyone have any experience with this or ideas on how to solve this? Thanks. Asim -- 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: ClojureScript Compile errors
In Clojure, namespaces are different from the host's packages, in ClojureScript they are the same (insofar as they match the Google Closure approach). Why all the attention to :use - I thought everyone agreed using it is a bad idea? In any case, ClojureScript is a subset and right now that subset doesn't include :use. People who want it will have to explain why they think it's important. Its cost is that namespaces have to be enumerable, which poses challenges for code (re)loading and modularity for Clojure. The only benefit I see is that you can avoid a (minimum 2 character) prefix. Rich On Aug 5, 2011, at 9:12 PM, pmbauer wrote: In Clojure, there is a clear distinction between using Clojure namespaces and importing interop packages. Is it a goal then to blur that line in ClojureScript? 'use' couldn't be used analogously just for ClojureScript names as it is in Clojure? On Friday, August 5, 2011 5:14:36 PM UTC-7, Rich Hickey wrote:On Aug 5, 2011, at 3:06 PM, David Nolen wrote: On Fri, Aug 5, 2011 at 2:51 PM, Fogus mef...@gmail.com wrote: The following lines looks problematic: (ns mainpage (:use lib.dom-helpers)) That is, ClojureScript only supports the (ns foo (:require [a.b :as c])) form. Try changing your ns declaration accordingly. The error message could be slightly better I agree. ;-) :F Is there any particular reason / design rationale to not support use? :use requires the ability to determine all the names in a namespace, something we don't generally have in ClojureScript, especially for JS pseudo-namespaces. Rich -- 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: ClojureScript Compile errors
On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote: Why all the attention to :use - I thought everyone agreed using it is a bad idea? ... The only benefit I see is that you can avoid a (minimum 2 character) prefix. The other benefit is it saves you from the cognitive load of having to know exactly what namespace every given function comes from in order to use it. For some libraries the burden of knowing which namespace a function comes from is significant (e.g., Incanter). Also, those namespace prefixes really get in the way if you are defining a DSL, or redefining things from Clojure's core (e.g., because you want to use an enriched cond macro). In a nutshell, when working within a specific domain, sometimes you want to take a certain set of functions/macros as primitive to your program, and don't want to constantly have to think of the details of how the library that defines them is structured. -- 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: Optimizing JDBC code
I am not guessing. I measured the performance of the query using plain Java and Clojure. In one test case, I loaded 69,099 records. The Java code took 5 seconds to execute the query and create as many objects. Clojure code took 50.43 seconds. The JVM settings are the same - both are initialized to with 1G min and max heap size. Both the Java code and Clojure code use a database connection pool that is initialized with 10 connections. It is a level playing ground but I find Clojure code to be 10 times slower. Did anyone ever compare and find similar difference in performance? And if so, is there a way to improve the Clojure performance? On Aug 6, 4:35 pm, Colin Yates colin.ya...@gmail.com wrote: That assumption needs checking - first rule of performance analysis: check, don't guess :) For example, is the java code using an existing connection versus clojure creating one? I would also time the cost of creating 10 clojure maps of a similar structure. Finally - 100,000 is big enough to give a small heap size worriesare the jvm settings the same? Sent from my iPad On 6 Aug 2011, at 19:11, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: I am loading about 100,000 records from the database with clojure.contrib.sql, using a simple query that pulls in 25 attributes (columns) per row. Most of the columns are of type NUMBER so they get loaded as BigDecimals. I am using Oracle database and the jdbc 6 driver ( com.oracle/ojdbc6 11.1.0.7.0). I am using clojure 1.2.1. The code is about 10 times slower than the same code written in Java using the JDBC API. Is there any way to speed this up? Type hints? Move to Clojure 1.3? I am assuming that most of the extra time is spent converting the results into Clojure maps. Does anybody have experience optimizing code to load data from the database? -- Shoeb -- 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: Optimizing JDBC code
On Sat, Aug 6, 2011 at 4:51 PM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: In one test case, I loaded 69,099 records. The Java code took 5 seconds to execute the query and create as many objects. Clojure code took 50.43 seconds. Try using clojure.java.jdbc instead of clojure.contrib.sql. c.j.j is the maintained version of c.c.sql and has had a number of enhancements such as removing all the Java reflection that was being done. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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
(:key map) lookup vs accessor functions in large applications
Having evolved domain models in large Clojure projects over a long time, I've been going back and forth on maps contra accessor functions to opaque objects and I do see some merit in the latter even though they are not idiomatic Clojure. Basically, the crucial point for me is how well they work with refactoring. Renaming keys is done without compile-time support. I have to search for instances of :old-key and replace them with :key, and also remember to search for old-key if it is used in a key destructuring without the colon. Renaming accessor functions has the benefit of help from the compiler, which will tell me if the function is not defined so I can easily change the client code to use new name. Inside a module, the cost of the idiomatic way is bearable, but in large-scale programs I find it to be a bit on the limit. Essentially, the keys of a collection returned become an implicit contract between the consumers of the function and the function itself that is very hard to change. When I used scripting languages previously my standard response would be to say that the tests will tell you that it is broken, so there is no problem with the lack of compiler support. However, when data is being passed through layers with lazy data structures this calls for a higher level of integration in the tests which in turn has the potential to make them less robust. Despite all that I am still leaning towards the idiomatic way, but I would love to hear other's experiences of growing domain models in large Clojure projects over time and the design styles that favour that. Cheers, Martin -- 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: ClojureScript Compile errors
On Sat, Aug 6, 2011 at 6:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote: Why all the attention to :use - I thought everyone agreed using it is a bad idea? ... The only benefit I see is that you can avoid a (minimum 2 character) prefix. The other benefit is it saves you from the cognitive load of having to know exactly what namespace every given function comes from in order to use it. For some libraries the burden of knowing which namespace a function comes from is significant (e.g., Incanter). Also, those namespace prefixes really get in the way if you are defining a DSL, or redefining things from Clojure's core (e.g., because you want to use an enriched cond macro). In a nutshell, when working within a specific domain, sometimes you want to take a certain set of functions/macros as primitive to your program, and don't want to constantly have to think of the details of how the library that defines them is structured. +1, and the objections raised to :use don't apply if we require that :only go along with it. (:use [x :only foo bar baz]) could with minimal effort, and probably should, be available to make foo, bar, and baz refer to such primitives. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: ClojureScript Compile errors
Why all the attention to :use - I thought everyone agreed using it is a bad idea? Really? I thought it's use was only considered bad form in the absence of :only The only benefit I see is that you can avoid a (minimum 2 character) prefix. I would think the obvious benefit is its inclusion makes it easier port and share code between ClojureScript and Clojure. Every difference beyond the necessary (interop, no runtime compiler) makes re-use that much more difficult (see macro use, binding semantics, numerics, ns macro differences). Now if that's not a target and there is no expectation of sharing then all this is of course a non-issue. -- 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: Optimizing JDBC code
I switched to clojure.java.jdbc. Found no difference at all. It is still about 10 times slower than java. On Aug 6, 8:54 pm, Sean Corfield seancorfi...@gmail.com wrote: On Sat, Aug 6, 2011 at 4:51 PM, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com wrote: In one test case, I loaded 69,099 records. The Java code took 5 seconds to execute the query and create as many objects. Clojure code took 50.43 seconds. Try using clojure.java.jdbc instead of clojure.contrib.sql. c.j.j is the maintained version of c.c.sql and has had a number of enhancements such as removing all the Java reflection that was being done. -- Sean A Corfield -- (904) 302-SEAN An Architect's View --http://corfield.org/ World Singles, LLC. --http://worldsingles.com/ Railo Technologies, Inc. --http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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