Re: beginner help with views in ClojureScript One?

2012-03-20 Thread Simon Holgate
Thanks for posting this. I actually had the same problem and couldn't work out what was going wrong. Cheers, Simon On Friday, 16 March 2012 15:42:03 UTC, George Oliver wrote: > > > > hi, I'm starting to modify the One sample application and can't get >> the hang of rendering a new view. I've t

Re: Mapping first element only: how to preserve vectors

2012-03-20 Thread Rasmus Svensson
On Mon, Mar 19, 2012 at 2:40 PM, Bojan wrote: > Hi! > > I'm a beginner at clojure and enjoying the learning process. While writing > my first nontrivial program, I noticed that I'm transforming only first > elements in the list, so I factored this transformation out by writing next > function: > >

Re: Parallel SSH and system monitoring in Clojure

2012-03-20 Thread Hugo Duncan
Chris McBride writes: >I releases two simple clojure libraries to help running commands > via SSH on multiple servers. Hopefully someone will find it useful. You might also be interested in Pallet [1], which executes via SSH. [1] http://palletops.com -- You received this message because y

Precondition asserts in macros

2012-03-20 Thread Shantanu Kumar
Hi, The way preconditions are invoked in Clojure 1.3.0 seems to have changed since Clojure 1.2: (defmacro foo [bar & body] {:pre [(string? bar)]} ...) (foo "bar34" ...) ; doesn't complain, which is OK (foo (str "baz" 34) ...) ; Error! (I wanted this to pass) When I write the preconditio

Re: Precondition asserts in macros

2012-03-20 Thread Chas Emerick
Your second `foo` call fails in 1.2 as well. If there was ever a time when it would have succeeded, it would have been a bug. Since `foo` is a macro, it receives its arguments unevaluated, so `(str "baz" 34)` will always be received as a list of three values. The syntax-quote precondition sim

Re: Precondition asserts in macros

2012-03-20 Thread Daniel Solano Gomez
Hello, I am not sure that anything has changed between Clojure 1.2.1 and Clojure 1.3.0 with respect to pre- and post-conditions. However, I think I have any idea as to what may be going on. On Tue Mar 20 05:34 2012, Shantanu Kumar wrote: > Hi, > > The way preconditions are invoked in Clojure 1.

Re: Precondition asserts in macros

2012-03-20 Thread Justin Kramer
Another option: create a helper function to do the work and have the macro call that: (defn foo* [bar body-thunk] {:pre [(string? bar)]} (body-thunk)) ;or whatever (defmacro foo [bar & body] `(foo* ~bar (fn [] ~@body)) Justin On Tuesday, March 20, 2012 9:07:45 AM UTC-4, Chas Emerick wrot

Re: Precondition asserts in macros

2012-03-20 Thread Bronsa
try with {:pre [(string? (eval bar))]} -- 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 unsubscri

Re: Returning Success

2012-03-20 Thread George Oliver
On Mar 19, 3:56 am, Narvius wrote: > I am writing a game in Clojure, and I often need some functions to return > whether they succeeded in doing what they are supposed to do > > [] > > I see several ways to achieve what I want, that is to return both the new > world state and success status. >

Re: ClojureScript error messages

2012-03-20 Thread Aaron Craelius
Not yet. I'll have to take care of that. On Mon, Mar 19, 2012 at 5:48 PM, David Nolen wrote: > On Mon, Mar 19, 2012 at 1:36 PM, Aaron wrote: > >> I pushed the patch to my fork on github in this commit: >> https://github.com/aaronc/clojurescript/commit/3193ed6e27061765782da32d36a63b0f7630f5e9 >

Re: Parallel SSH and system monitoring in Clojure

2012-03-20 Thread Paulo Suzart
Thinking "cloudly", one may query ec2 tags to assemble the cluster with clojure-control. Both are useful though. Paulo Suzart On 15 March 2012 21:19, Sun Ning wrote: > You might interested in clojure-control[1], which has similar > functionality to your library. > > [1] > https://github.com/k

Clojure for banking and invenstment system?

2012-03-20 Thread Roller
I dont understand why some companies use clojure for finance. How can I work there ? What do I have to learn ? -- 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 mem

Re: Precondition asserts in macros

2012-03-20 Thread Chas Emerick
Using an explicit eval is generally not a good idea, as `bar` will be evaluated at least twice: once in validating the precondition, and again in the macroexpansion. This can lead to all sorts of "interesting" problems if `bar` happens to be a side-effecting expression. - Chas On Mar 20, 2012

Re: Clojure for banking and invenstment system?

2012-03-20 Thread Bill Smith
Perhaps you could contact someone at a company that uses Clojure for finance and ask them. On Tuesday, March 20, 2012 9:03:30 AM UTC-5, Roller wrote: > > I dont understand why some companies use clojure for finance. > > > How can I work there ? > What do I have to learn ? -- You received this

Re: Clojure for banking and invenstment system?

2012-03-20 Thread Thomas
have a look here: http://blog.malcolmsparks.com/ On Tuesday, March 20, 2012 2:03:30 PM UTC, Roller wrote: > > I dont understand why some companies use clojure for finance. > > > How can I work there ? > What do I have to learn ? -- You received this message because you are subscribed to the G

Google Summer of Code 2012 Mentors please put yourself into Melange

2012-03-20 Thread David Nolen
If you've marked yourself as a mentor for any of Google Summer of Code 2012 proposals please apply to be a mentor: http://www.google-melange.com/gsoc/homepage/google/gsoc2012 Thanks! David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: Precondition asserts in macros

2012-03-20 Thread Shantanu Kumar
Thanks everybody for the pointers! I realized I was wrong about the behavior being different in 1.2; rather it is the same since 1.1.0. Shantanu On Mar 20, 2:29 pm, Chas Emerick wrote: > Using an explicit eval is generally not a good idea, as `bar` will be > evaluated at least twice: once in va

into applied to transient vectors undocumented?

2012-03-20 Thread László Török
Hi, While implementing qsort with clojure for fun, I thought about using transient vectors to speed up sorting vs the "naive" functional implementation. I need an *into!* version of *into *when joining two sorted subarrays and I was wondering why there isn't one. It seems that (source into) does

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
into uses transient and persistent! for speed. The fact that into can take a transient as input is an accidental consequence of that, I think. Before into was changed to use transients internally, it could only take persistent data structures as input, and return a persistent data structure.

Re: into applied to transient vectors undocumented?

2012-03-20 Thread László Török
Ok, so the pattern is: func! (bang) takes a transient and returns a transient regular collection functions MAY take a transient but ALWAYS return a persistent collection, right? :) thx Las 2012/3/20 Andy Fingerhut > into uses transient and persistent! for speed. The fact that into can > tak

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
func! (bang) is a naming convention from the programming language Scheme that Clojure often uses. In general it means that the function mutates data, i.e. it is not a pure function. Clojure does not have a ! after all of its core functions that do this, but it does after some. In particular,

Re: understanding data structures, and other low-level stuff

2012-03-20 Thread Timo Mihaljov
On 03/15/2012 09:15 PM, Nic Long wrote: > So I guess I'm asking whether anyone can recommend some good primers > on data structures, both as they relate to Clojure, but also how they > work in the fundamentals - e.g. what exactly is the classic model of > an 'array' and how does it work, etc. I hav

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Alan Malloy
(def into! #(reduce conj! %1 %2))? On Mar 20, 10:32 am, László Török wrote: > Hi, > > While implementing qsort with clojure for fun, I thought about using > transient vectors to speed up sorting vs the "naive" functional > implementation. > > I need an *into!* version of *into *when joining two s

Re: Literate programming in emacs - any experience?

2012-03-20 Thread Tim Dysinger
I'm using org-mode, org-babel & swank for a "living" document I'm writing. I'm generating a PDF which includes documentation, working clojure code that generates incanter graphs. Also the generated incanter graphs are included in the generated (latex) PDF. On Monday, January 23, 2012 3:14:09 A

Re: understanding data structures, and other low-level stuff

2012-03-20 Thread Devin Walters
I have to tip my hat to Daniel Spiewak's talk at Clojure/conj 2011: http://blip.tv/clojure/daniel-spiewak-extreme-cleverness-functional-data-structures-in-scala-5970151 I learned a lot from it. Cheers, '(Devin Walters) On Tuesday, March 20, 2012 at 12:56 PM, Timo Mihaljov wrote: > On 03/15/2

revisiting community funding?

2012-03-20 Thread nchurch
There was a brief period of community funding for Rich's work back in 2010. When that ended, we now know the result was Datomica huge win. But there are other people who work on Clojure and Clojurescript; great things could happen from the focus that comes from being able to work on them full

Passing data out of closure into the outer context

2012-03-20 Thread Tom Krestle
Greetings, I've stumbled across the following problem, which I believe is common and should have some sort of generic solution. Imagine I have ... ;; code inside defn ;; I extract some information out of my atom in closure: (swap! my-atom (fn [val] (let [extracted-info1 (extract-somethin

Re: Returning Success

2012-03-20 Thread Narvius
Alright. 1) Why I need success state: this is a turn-based game, and I want to advance the world clock if and only if the player makes a valid move. 2) identical? makes sense. I generated some unnecessarily large data structure and checked, it really is ridiculously fast. Thanks! 3) Returning ni

Re: understanding data structures, and other low-level stuff

2012-03-20 Thread Nic Long
Hey, just want to say thanks for all the advice! And Andy especially for the kind offer - I may well PM some specific questions once I start reading. The Cormen et al. book looks great - tough but exactly what I need - so I'm going to pick up a copy. And I'll also read the PhD thesis on Functional

Re: Clojure code optimizer

2012-03-20 Thread Andru Gheorghiu
Thank you for the clarifications and the resources, I understand now what tree shaking is. In fact, I had a project last year at our college to implement (in Scheme) a constant folding optimizer for Scheme programs, I now see the resemblance with what you described. The program would optimize funct

SuperDevMode and SourceMaps for ClojureScript debugging

2012-03-20 Thread Alexander Zolotko
Ray Cromwell , a Google employee, has recently announced new feature in Chrome Dev Tools: SuperDevMode and SourceMaps. It helps to map source code written in programmi

ClojureScriptOne design

2012-03-20 Thread Pierre-Henry Perret
I have added a new model cljs file in my dev One app , but when I use it in the controller, that one doesnt see it. Any idea, suggestion? Thanks -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: SuperDevMode and SourceMaps for ClojureScript debugging

2012-03-20 Thread David Nolen
On Tue, Mar 20, 2012 at 2:45 PM, Alexander Zolotko wrote: > Ray Cromwell , a > Google employee, has recently announced new feature in Chrome Dev Tools: > SuperDevMode > and > SourceMaps

Re: Passing data out of closure into the outer context

2012-03-20 Thread Cedric Greevey
On Tue, Mar 20, 2012 at 11:16 AM, Tom Krestle wrote: > Greetings, > > I've stumbled across the following problem, which I believe is common and > should have some sort of generic solution. Imagine I have > > ... ;; code inside defn > ;; I extract some information out of my atom in closure: > (swap

Re: revisiting community funding?

2012-03-20 Thread bernardH
On 20 mar, 21:09, nchurch wrote: > But there are other people who work on Clojure and Clojurescript; > great things could happen from the focus that comes from being able to > work on them full time.  I know I'd be willing to give a couple > hundred to fund such an effort, and given how much pe

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
Sorry, I said something incorrect. into cannot take transients as the first arg. It calls transient internally on the first arg for speed. This does not modify the value you passed in at all -- it creates a new transient data structure from what you pass in. If you try calling transient on a

Re: Returning Success

2012-03-20 Thread Stephen Compall
On Mon, 2012-03-19 at 03:56 -0700, Narvius wrote: > 2) Return [new-state success?] instead of just new-state - requires too > much acrobatics from the user of the function (which is still me, but > whatever). Don't be so sure...you can arrange for values "on the side" to be readable and writable

Re: into applied to transient vectors undocumented?

2012-03-20 Thread László Török
Hi, I'm not sure why I said it can be. My original post was going to be about why there isn't a into! (Thanks Alan for the hint!) I think the (if (instance? clojure.lang.IEditableCollection to) line made me draw false conclusions. It was a bit late, apologies for the noise and thx! 2012/3/20 An