Alternative structures to arrays?

2011-12-22 Thread Simon Holgate
Hi, I'm pretty new to functional languages but really love Clojure. My work typically involves multi-dimensional arrays of data. I'm an oceanographer and typically use things like sea surface height data from satellite altimetry on 1/3 degree 2D grids with maybe 800 time slices (=O(5E8 data

Re: Alternative structures to arrays?

2011-12-22 Thread Alex Robbins
Hey Simon, Incanter is a clojure data processing platform (R-like). http://incanter.org/ It wraps Parallel Colt, a Java matrix math/linear algebra library, among other things. Parallel colt provides sparse matrices, and I *guess* they are exposed in the clojure wrapper.

Re: Alternative structures to arrays?

2011-12-22 Thread Brian Hurt
If I wasn't using Incanter (see Alex Robbin's reply), I'd probably just use a vector of vectors. If your matricies 70% dense, it's generally not worth it to try and use some sort of sparse data structure- the extra overhead of the sparse data structure will be greater than the savings of not

Re: Literate programming

2011-12-22 Thread Adam Getchell
On Fri, Oct 28, 2011 at 2:45 PM, Damion Junk jun...@gmail.com wrote: I have also been using Emacs/Org-mode/Babel/R lately, mostly as a way to have easily modifiable write up and source code for assignments in statistics courses. I suppose this is one valid use, but I'm using it less to

Re: Could be my favourite improvement in 1.4

2011-12-22 Thread Julien Kirch
for these cases wouldn't be simpler to paste the map in a string and to create a function that could parse such a json-compatible map into a clojure map ? A. On Dec 20, 2011, at 1:36 PM, Alex Baranosky wrote: For what it's worth, I think colon's as whitespace in maps adds confusion,

Re: ClojureQL 1.0.3

2011-12-22 Thread tscheibl
Tamensi movetur! :) What about integrating the WITH RECURSIVE CTE stuff you've put on gist? I've merged it into my (local) fork, modified it slightly to autodetect the compiler and consider it quite conveniently to use. I've also added a feature to be able to mark predicate elements as 'inline'

Re: Clojurescript and google closure library versions?

2011-12-22 Thread Jordan Berg
I changed the curl command in the bootstrap script locally to download r1376 since the day google released it, and I haven't had a problem since. Not sure if there is an official reason for not switching over yet though. Jordan On Tue, Dec 20, 2011 at 9:42 AM, Dave Sann daves...@gmail.com

Strange compilation problem

2011-12-22 Thread Pieter Laeremans
Hello, When I have a clojure file with the code as listed below , I get a compilation error when I run lein compile whenever the DATABASE_URL is not defined at compile time. However I would expect this would be evaluated at runtime. Is this a bug, or more likely something I don't grasp, can

Literate programming/TDD with Leiningen + midje + marginalia

2011-12-22 Thread Adam Getchell
Thanks for all the replies! I'm trying midje first (keeping expectations in mind for later) as it seems to support writing tests and then code (i.e. top down testing). (This video https://github.com/marick/Midje/wiki/Top-down-testing was useful, thanks for making it!) In generating

Re: multiple return values

2011-12-22 Thread Razvan Rotaru
On Dec 14, 5:33 pm, Tom Faulhaber tomfaulha...@gmail.com wrote: Razvan, I believe that proxy actually only creates a new class per call site, not per instance. However, I can't completely swear to this. Anyone with more detailed knowledge than I have want to comment? Assuming I'm right,,

Re: Alternative structures to arrays?

2011-12-22 Thread Tassilo Horn
Brian Hurt bhur...@gmail.com writes: Hi Brian, Vectors are actually a great trade-off, giving you almost the same access and memory costs arrays do, but with all the advantages of being immutable (multi-threaded goodness). On the other hand, you can have arrays of primitives but no vector of

Re: Strange compilation problem

2011-12-22 Thread Tassilo Horn
Pieter Laeremans pie...@laeremans.org writes: Hi Pieter, when I run lein compile whenever the DATABASE_URL is not defined at compile time. However I would expect this would be evaluated at runtime. Is this a bug, or more likely something I don't grasp, can someone point it out for me?

Re: Alternative structures to arrays?

2011-12-22 Thread Daniel Janus
On Thursday, December 22, 2011 3:35:35 PM UTC, Tassilo Horn wrote: Brian Hurt bhu...@gmail.com writes: Hi Brian, Vectors are actually a great trade-off, giving you almost the same access and memory costs arrays do, but with all the advantages of being immutable (multi-threaded

Re: ClojureQL 1.0.3

2011-12-22 Thread Herwig Hochleitner
Vinzent: apparently, there is a CQL google group, but it seems not to be public. We're investigating, otherwise creating a new one. 2011/12/21 tscheibl t...@sharkbay.at What about integrating the WITH RECURSIVE CTE stuff you've put on gist? It would certainly be welcome. Though, I'm not

Sumo: A new clojure client for the Riak datastore

2011-12-22 Thread Tim Robinson
I'm not involved in the development of this client library - I'm just glad to see it get started. Many thanks to the folks a basho for considering a Clojure client worthy of being on their roadmap. https://github.com/reiddraper/sumo Tim -Original Message- From: Reid Draper

Re: Alternative structures to arrays?

2011-12-22 Thread Tassilo Horn
Daniel Janus nath...@gmail.com writes: Hi Daniel, Vectors are actually a great trade-off, giving you almost the same access and memory costs arrays do, but with all the advantages of being immutable (multi-threaded goodness). On the other hand, you can have arrays of primitives but no

Re: Literate programming

2011-12-22 Thread daly
On Tue, 2011-12-20 at 00:26 -0800, Adam Getchell wrote: On Fri, Oct 28, 2011 at 2:45 PM, Damion Junk jun...@gmail.com wrote: I have also been using Emacs/Org-mode/Babel/R lately, mostly as a way to have easily modifiable write up and source code for assignments in

Re: Literate programming

2011-12-22 Thread Larry Johnson
On Thu, Dec 22, 2011 at 2:54 PM, daly d...@axiom-developer.org wrote: The combination of literate + TDD seems forbidding. Are you finding it hard to explain why you wrote a test? Tim Daly I decided awhile back when trying to answer questions about literate programming, that people get

Re: Literate programming

2011-12-22 Thread daly
On Thu, 2011-12-22 at 15:35 -0500, Larry Johnson wrote: On Thu, Dec 22, 2011 at 2:54 PM, daly d...@axiom-developer.org wrote: The combination of literate + TDD seems forbidding. Are you finding it hard to explain why you wrote a

Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
Scheme, for instance, obeys the Law of Macro-Parsimony: don't use defmacro, namely, where defn will suffice; Clojure, on the other hand, is macro-liberal. In other words, everyone seems to prefer e.g. `(defmacro foo [vars body] `(do ... ~@body))' where `(defn foo [vars thunk] ... (thunk))' would

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Cedric Greevey
On Thu, Dec 22, 2011 at 4:54 PM, Peter Danenberg p...@roxygen.org wrote: Scheme, for instance, obeys the Law of Macro-Parsimony: don't use defmacro, namely, where defn will suffice; Clojure, on the other hand, is macro-liberal. In other words, everyone seems to prefer e.g. `(defmacro foo

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Kevin Downey
On Thu, Dec 22, 2011 at 1:54 PM, Peter Danenberg p...@roxygen.org wrote: Scheme, for instance, obeys the Law of Macro-Parsimony: don't use defmacro, namely, where defn will suffice; Clojure, on the other hand, is macro-liberal. In other words, everyone seems to prefer e.g. `(defmacro foo

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
Thanks, Cedric: I suspected that convenience was a primary motivation (and maybe analogy with `defn', etc.); and I realized that macros can be more efficient than their equivalent function. It hadn't occurred to me, though, that a shallow stack might come into play; or {un,}boxing, of all things.

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Peter Danenberg
Quoth Kevin Downey on Sweetmorn, the 64th of The Aftermath: Why do you care? SICP-forged neural pathways, basically; I'll end up writing e.g.: (defn with-input-from-file [file thunk] ...) only to censor myself: shit, we don't do thunks. At that point, I'll bust out `defmacro' with

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Meikel Brandmeyer
Hi, passing thunks and macros are not mutually exclusive. with-bindings and with-bindings* are an example you gave yourself. I often use this style with a convenience macro and a driver function. Benefits besides the named drawbacks are reduced code size (depending on number of calls vs. class

Mechanism for escaping of predefined entities missing in clojure.xml

2011-12-22 Thread Linus Ericsson
Hi! I have been in the wondrous world of XML-parsing last week and I've found a missing mechanism in clojure.xml - the escaping the predefined entities: Example: (use 'clojure.xml) (def xmlelem (parse (new org.xml.sax.InputSource (new java.io.StringReader tag greet=\Clojureamp;co\/ ;;

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Alan Malloy
with-open and with-local-vars couldn't be thunks - the whole point is creating some lexical variables in the caller's scope. Instead of (with-open [f (file)] (stuff f)) you could require (open-callback (fn [f] (stuff f)) (file)): either could expand into something like ((fn [f] (stuff f)) (file)),

Re: Literate programming/TDD with Leiningen + midje + marginalia

2011-12-22 Thread Alex Baranosky
Hi Adam, It seems like making it so that Marginalia allows you to specify which directories to use would be the ideal case, instead of feeling a need to lump all your tests in the src directory. I wonder if Marginalia already supports this? Alex On Wed, Dec 21, 2011 at 11:25 PM, Adam Getchell

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Brian Hurt
On Thu, Dec 22, 2011 at 5:10 PM, Kevin Downey redc...@gmail.com wrote: fns are not free. every (fn* …) in macroexpanded source results in a new class. This is only a problem with respect to load times- clojure tends to make java's already long load times even longer. Actual function call

Re: Why are body-macros more fashionable than thunks?

2011-12-22 Thread Brian Hurt
Gah, hit send before I meant to. On Thu, Dec 22, 2011 at 7:03 PM, Brian Hurt bhur...@gmail.com wrote: That being said, in defense of functions: -Many JVMs don't optimize large functions, or optimize them less aggressively. So there are reasons to use functions, even functions called via

Re: How to use *command-line-args* ?

2011-12-22 Thread Kevin Lynagh
If you need parsing that is any more complicated, check out https://github.com/clojure/tools.cli which handles flags, arguments, and generating --help banners. On Dec 21, 7:52 pm, Antonio Recio amdx6...@gmail.com wrote: Solved: (read-write-image (nth *command-line-args* 0) (nth

Re: Literate programming/TDD with Leiningen + midje + marginalia

2011-12-22 Thread Linus Ericsson
Yes, it does. I had problems with some midje-facts crashing the rendering in marginalia, but was able to just give the files as consecutive arguments as a work around. lein marg src/app/core.clj src/app/another/file.clj wildcards works fine as well. This problem with midje-facts being

Re: Literate programming

2011-12-22 Thread Larry Johnson
Probably the most effective way to really hammer the benefits of literate programming into the clojure community would be to take a manageable but serious and well known clojure program, module, or library, and render it into literate form. As a clojure programmer, I'm not even there. But as

Re: multiple return values

2011-12-22 Thread Brian Goslinga
On Dec 22, 8:52 am, Razvan Rotaru razvan.rot...@gmail.com wrote: What do you mean by site? For example, how is it when I'm creating my proxy inside a macro? (and assuming this macro is called many times) (defmacro [a-class]     (proxy (a-class) )) Razvan Once all code is macroexpanded,

Re: Literate programming

2011-12-22 Thread nchurch
Why should I write English in the first place? Because it helps me to think; and it helps me to program other people to think like me. But I would never have learned English unless along the way it gave me near-term results. It should follow, then, that telling people to write literate programs

Re: multiple return values

2011-12-22 Thread Alan Malloy
On Dec 22, 5:48 pm, Brian Goslinga brian.gosli...@gmail.com wrote: On Dec 22, 8:52 am, Razvan Rotaru razvan.rot...@gmail.com wrote: What do you mean by site? For example, how is it when I'm creating my proxy inside a macro? (and assuming this macro is called many times) (defmacro

Matching core.match's syntactic keywords

2011-12-22 Thread Herwig Hochleitner
Hi, I want to match vectors of the form [(some expr) :as :label], but #(match [%] [[expr :as (label :when keyword)]] {:expr expr :label label}) throws a compiler exception: Unable to resolve symbol expr How do I do this? kind regards --

Re: Literate programming

2011-12-22 Thread daly
On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote: Firstly, there really needs to be something like a Github for literate programming. What a great idea! I'll see what I can do. Tim Daly -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Literate programming

2011-12-22 Thread nchurch
I'll do everything I can to help. I have tons of thoughts (as you might guess); but I haven't demonstrated myself to be a great coder, yet. I feel like I'm a coder who needs something like literate programming to be great, so it's kind of a chicken-and-egg problem. I'm already partway there with

Re: Literate programming

2011-12-22 Thread nchurch
While we're on the topic of a literate Github, let me just point out that we might want to go just a little beyond Github to the way we write code itself. Look again at the capitalize-every-word function I defined above. In my original unshortened commentary, I included also this: .