Re: println / for unexpected behaviour

2013-11-26 Thread Gary Verhaegen
But it is indeed a characteristic of the seq. The repl reads and evals the for expression, which yields a lazy seq, so basically nothing has happened at this point. Then the repl needs to print the result. So first it prints an open parenthesis as the result is a seq. Then it needs to evaluate the

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Kevin Bell
Hey Craig, Thanks for the input. Forgive my naiveté, but I gather you're implying that the DSL-ishness is desirable? That makes sense, and it seems to be inline with what I'm learning about the lisp mindset. You're suggestion is actually a lot more like an option that I was considering but di

Best Practice For Logging vs. Functional (and Elegant)

2013-11-26 Thread Stefan Kamphausen
Hi, logging is a side-effect and I try to keep it out of the functional parts of my code. But even for the parts where I want to introduce logging I find that it renders code less readable. As an example, say you've got an 'if-let' somewhere (if-let [a (do-something-non-trivial-with-some-lo

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Jeroen van Dijk
Hi Kevin, I've created some kind of wrapper around CF templates too. It is too immature (and ugly) to open source it, but I think it has some nice features, like Ref checking, templating for userdata and schema validation of the CF resources via Prismatic Schema. Can you elaborate on what kind of

Re: [ANN] Optimus - a Ring middleware for frontend performance optimization.

2013-11-26 Thread Magnar Sveen
Hi Paul! Thanks for chiming in. I set out to create a suite of middlewares for frontend optimization. The first was Catenate, which concerned itself with concatenation into bundles. So I certainly agree with your points. You'd be hard pressed to think otherwise in the Clojure community, I think

Re: [ClojureScript] [ANN] cljs-start 0.0.5

2013-11-26 Thread Deniz Kurucu
Thanks, that worked ! On Tue, Nov 26, 2013 at 1:15 AM, Mimmo Cosenza wrote: > you need to upgrade to leiningen >= 2.2.0 > > lein upgrade # from the terminal > > > On Nov 25, 2013, at 8:18 PM, Deniz Kurucu wrote: > > > > > On Mon, Nov 25, 2013 at 8:59 PM, Mimmo Cosenza wrote: > >> what are: >> >

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Craig
Kevin, Typical advice is to not use macros (implicitly used in the gists to build a CF DSL) when functions or data will suffice. Sometimes however the syntactic sugar is quite tasty and hard to overlook. I do not have enough knowledge of the domain to suggest what might be the correct approach

Re: [ClojureScript] [ANN] cljs-start 0.0.5

2013-11-26 Thread Mimmo Cosenza
Good. I added the version requirement in the README (sorry to have forgotten that before). mimmo On Nov 26, 2013, at 12:02 PM, Deniz Kurucu wrote: > Thanks, that worked ! > > > On Tue, Nov 26, 2013 at 1:15 AM, Mimmo Cosenza > wrote: > you need to upgrade to leiningen >= 2.2.0 > > lein up

Re: Access the datastructure used to create a function?

2013-11-26 Thread henry w
Sad not to get any replies - even to tell me if it is a bad idea or not possible. :-( Assuming it is not possible, am I right in saying that at the moment, in Clojure, 'code is data' really only applies until code is compiled? I realise compiled functions can still be passed around, assigned t

Re: [ANN] Optimus - a Ring middleware for frontend performance optimization.

2013-11-26 Thread Stefan Kamphausen
Hi, I'd be very interested in learning, how Twixt[1] compares to Optimus and the other solutions cited. [1] https://github.com/AvisoNovate/twixt/ Regards, stefan -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: Access the datastructure used to create a function?

2013-11-26 Thread Max Penet
The best you can do is probably mess with https://github.com/technomancy/serializable-fn, but maybe trying to describe what you are trying to do at a higher level would help, most of the time using serializable-fn is a bad idea (symptom of one). On Thursday, November 21, 2013 7:14:39 PM UTC+1,

Re: Access the datastructure used to create a function?

2013-11-26 Thread Guru Devanla
Hi, This may not be the answer you are looking for. But, kooking at the example you gave, you will need to execution environment of the function to determine the binding of y. It could vary based on where it is invoked. That is because, if the function call was wrapped inside a 'binding form then

Re: println / for unexpected behaviour

2013-11-26 Thread Alex Miller
Realizing a lazy sequence incurs overhead on every item. Chunked seqs amortize that cost by realizing a chunk of items at a time giving you better overall performance at the cost of less laziness. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Access the datastructure used to create a function?

2013-11-26 Thread Jamie Brandon
> (def f (let [y 1] (fn [x] (+ x y Let's have a look inside. > (require '[no.disassemble :refer [disassemble]]) > (println (disassemble f)) // Compiled from /home/jamie/strucjure/src/strucjure.clj (version 1.5 : 49.0, super bit) public final class strucjure$fn__5589$fn__5590 extends clojure.l

ClojureCLR 1.5.1 compiler problem

2013-11-26 Thread Brian Barnes
I'm not sure this is the correct place for this, but the GitHub page led me to this place. I believe I have found a problem in the 1.5.1 ClojureCLR currently on GitHub. The problem is with the initialization of the static Compiler class. According to section 10.4.5.1 of the MSDN documentation

Re: [ANN] Overtone 0.9.0 Released

2013-11-26 Thread Joseph Burnett
Sweet! On Monday, November 25, 2013 8:46:44 AM UTC-8, Sam Aaron wrote: > > Hi there noise polluters! > > It's that glorious time again - another version of Overtone has forced its > timbral wings out of its cocoon. 0.9.0 is here and is edgy. It was so edgy, > that it burst into flames and mutat

Re: println / for unexpected behaviour

2013-11-26 Thread Cedric Greevey
On Tue, Nov 26, 2013 at 8:58 AM, Alex Miller wrote: > Realizing a lazy sequence incurs overhead on every item. Chunked seqs > amortize that cost by realizing a chunk of items at a time giving you > better overall performance at the cost of less laziness. > And in this case that resulted in all t

Re: [ANN] Overtone 0.9.0 Released

2013-11-26 Thread Cedric Greevey
Is there a turnkey download/install/play with version of this yet, or is that not until 1.0? On Tue, Nov 26, 2013 at 10:24 AM, Joseph Burnett wrote: > Sweet! > > > On Monday, November 25, 2013 8:46:44 AM UTC-8, Sam Aaron wrote: >> >> Hi there noise polluters! >> >> It's that glorious time again

Re: Access the datastructure used to create a function?

2013-11-26 Thread Guru Devanla
Hi Jamie, Thats interesting. How do I not let the compiler not optimize away the fact that y refers to the constant. When I run your program I have two constant fields defined rather than 'y. Am I missing something. Thanks Guru On Tue, Nov 26, 2013 at 6:16 AM, Jamie Brandon wrote: > > (def f

Re: Access the datastructure used to create a function?

2013-11-26 Thread Jamie Brandon
Guru, I'm not sure. Are you running it exactly the same way? If you did... (def y 1) (def f (fn [x] (+ x y))) ...then I think that would result in two const fields instead, because it stores the var #'y as a static field and calls getRawRoot on it at runtime. Otherwise I'm not sure. On 26 Nove

Re: ClojureCLR 1.5.1 compiler problem

2013-11-26 Thread dmiller
I guess it doesn't matter that it works fine for me if it doesn't for you. :) I'll post an issue. Along with many other Clojure projects, issues and related items are on the JIRA site under dev.clojure.org. For ClojureCLR, that is at http://dev.clojure.org/jira/browse/CLJCLR -David On Tuesday,

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Kevin Bell
Hey Craig and Jeroen, Jeroen: Can you elaborate on what kind of features you would like to support? Are you just deciding on DSL syntax or do you have already some kind of Clojure layer working? -My main goals are to create as "pretty" of a format for defining CF templates within Clojure synt

Re: Access the datastructure used to create a function?

2013-11-26 Thread Alex Miller
It would help to know what your real goal is, but compiled Clojure does not retain the original source form. One hook you do have though is macros which will be invoked prior to compilation. At macro execution time, you have access to the special &form var which is the original form (as a Cloj

Re: ANN: core.logic 0.8.5

2013-11-26 Thread Norman Richards
On Mon, Nov 25, 2013 at 10:51 PM, David Nolen wrote: > This release represents a fairly significant change to the simple DB > functionality that core.logic provides - instead of a mess of mutable atoms > thanks to Norman Richard we now store facts in a persistent data structure. > This is likely a

Re: ANN: core.logic 0.8.5

2013-11-26 Thread David Nolen
Thanks Norman, that would be extremely helpful! On Tue, Nov 26, 2013 at 2:39 PM, Norman Richards wrote: > On Mon, Nov 25, 2013 at 10:51 PM, David Nolen wrote: > >> This release represents a fairly significant change to the simple DB >> functionality that core.logic provides - instead of a mess o

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Gary Verhaegen
Before you decide on the question of macros/dsl versus data api, I would recommend watching the "(not= DSL macro)" talk from a few years ago. It nicely illustrates the tradeoffs involved, and hints at the reasons why the Clojure community, as opposed to traditional lisps, tends to gravitate more to

Re: Access the datastructure used to create a function?

2013-11-26 Thread Gary Verhaegen
I think that is basically what serializable-fn does. Might be worth taking a look at it: https://github.com/technomancy/serializable-fn/blob/master/src/serializable/fn.clj On Tuesday, 26 November 2013, Alex Miller wrote: > It would help to know what your real goal is, but compiled Clojure does >

Re: Best Practice For Logging vs. Functional (and Elegant)

2013-11-26 Thread Gary Verhaegen
I haven't had time to really investigate it, but I was planning to delve into dire for exactly that problem. https://github.com/MichaelDrogalis/dire On Tuesday, 26 November 2013, Stefan Kamphausen wrote: > Hi, > > > logging is a side-effect and I try to keep it out of the functional parts > of m

Re: Access the datastructure used to create a function?

2013-11-26 Thread Alex Miller
Seems like you lost the clojure mailing list in this response, so I re-added it. On Tue, Nov 26, 2013 at 2:09 PM, henry w wrote: > Thanks to all respondents. > > This was really just something I was curious about, although I can think > of some practical uses. > > It's just not clear to me still

Re: Best Practice For Logging vs. Functional (and Elegant)

2013-11-26 Thread Stefan Kamphausen
On Tuesday, November 26, 2013 8:56:11 PM UTC+1, Gary Verhaegen wrote: > > I haven't had time to really investigate it, but I was planning to delve > into dire for exactly that problem. > > https://github.com/MichaelDrogalis/dire > > That looks interesting. Thanks for pointing out. Best, stefan

Re: [ANN] fsrun : file change notifier high order lein task

2013-11-26 Thread Phil Hagelberg
Cool; this looks really handy. Could you add it to the list of plugins on the Leiningen wiki? https://github.com/technomancy/leiningen/wiki/Plugins > > -Phil -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Working clojure zippers and trees

2013-11-26 Thread dabd
I am trying to work with a tree representation using vectors where the first element is the node value and the rest are the children as suggested here: http://grokbase.com/t/gg/clojure/12afy2cz9p/how-to-represent-trees-for-use-with-zippers However I am having trouble using clojure.zip/edit to ch

Working with zippers and trees

2013-11-26 Thread dabd
I am trying to work with a tree representation using vectors where the first element is the node value and the rest are the children as suggested here: http://grokbase.com/t/gg/clojure/12afy2cz9p/how-to-represent-trees-for-use-with-zippers However I am having trouble using clojure.zip/edit to ch

Re: Access the datastructure used to create a function?

2013-11-26 Thread henry w
The thing is, the data contained in the source definition is all still there in the compiled version - but apparently it is not easily accessible. It feels like it must be possible to write a function that looks at a function object and it's class and can produce at least a decent approximation

Re: [ANN] fsrun : file change notifier high order lein task

2013-11-26 Thread Mimmo Cosenza
yes, it's very cool mimmo On Nov 26, 2013, at 10:31 PM, Phil Hagelberg wrote: > Cool; this looks really handy. Could you add it to the list of plugins on the > Leiningen wiki? > > https://github.com/technomancy/leiningen/wiki/Plugins > > -Phil > > -- > -- > You received this message becaus

Re: Access the datastructure used to create a function?

2013-11-26 Thread Guru Devanla
The important caveat here is "what do we label as data?". If we are okay with just 'streams of bytes' that will make us understand and reason some information about the function, then may be the bytecode itself could be sufficient and could be considered to be data. But, I guess the original quest

Re: Working with zippers and trees

2013-11-26 Thread martin_clausen
With a nested vector tree you can use the built in vector-zip function to create your zipper. As to the editing, the source code contains a very similar use-case, which can be adapted to something like the following: (le

Re: CloudFormation template generation with Clojure

2013-11-26 Thread Kevin Bell
Hey Gary, Thanks for the references. Those videos were awesome! I think Cristophe definitely hit the nail on the head with this slide about the challenges of binding. Though, I'm not sure I fully get what he meant by "binding specs" and "capturi

Re: [ANN] fsrun : file change notifier high order lein task

2013-11-26 Thread Plinio Balduino
Excellent, Deniz But I'm getting an error when I try to run for the first time: Could not find artifact fsrun:fsrun:jar:0.1.0 in central (http://repo1.maven.org/maven2/) Could not find artifact fsrun:fsrun:jar:0.1.0 in clojars (https://clojars.org/repo/) This could be due to a typo in :dependen

Re: Working with zippers and trees

2013-11-26 Thread dabd
The built-in vector-zip will build a tree with a different structure than what I need. I want build a tree as described in the first post: the node value is the first element of the vector and the children the rest of the elements. zipper.core> (loop [loc (tree-zipper [1 2 [3 4 5]])] (if (z/en

Re: Working with zippers and trees

2013-11-26 Thread martin_clausen
To use the zipper library you have to be able to provide branch? children and make-node functions that apply to your data structure. I don't see a way to provide a meaningful branch? or children function for the structure you describe. Vector? will not work as branch? as it will not return true

Re: Best Practice For Logging vs. Functional (and Elegant)

2013-11-26 Thread Mars0i
I'm not an experienced Clojure programmer, and not fully committed to functional programming, so others will probably have ... cooler, and better answers. But to me it seems that there is nothing special to this situation that has to do with functional programming. Adding code that reports on

Re: Working with zippers and trees

2013-11-26 Thread Carlo Zancanaro
On Tue, Nov 26, 2013 at 08:30:15PM -0800, martin_clausen wrote: > To use the zipper library you have to be able to provide branch? children > and make-node functions that apply to your data structure. > > I don't see a way to provide a meaningful branch? or children function for > the structure y

Re: Working with zippers and trees

2013-11-26 Thread dabd
I'm not sure what you mean by not being able to provide a meaningful branch?. I would like to represent a tree such a this: 1 / \ 2 3 / \ 4 5 How can I achieve this using zippers?

Re: Working with zippers and trees

2013-11-26 Thread Carlo Zancanaro
Okay, now after actually reading the documentation I can come back with an actually correct response! You should only have to change one function: > (defn make-node [n children] > (vec (cons (first n) children))) Your issue was that your original `make-node` function didn't return a ve

Re: Working with zippers and trees

2013-11-26 Thread dabd
Thanks. Do you think the call to z/edit in my code could be simplified? To edit a branch node I have to use conj to build a node only to pass it to make-node which will break it apart again. On Wednesday, November 27, 2013 5:53:31 AM UTC, Carlo wrote: > > Okay, now after actually reading the doc

Re: Working with zippers and trees

2013-11-26 Thread Martin Clausen
Yes, for instance like this: (let [vz (z/vector-zip [1 [2] [3 [4 5]]])] (loop [loc vz] (if (z/end? loc) (z/root loc) (recur (z/next (if (and (integer? (z/node loc)) (odd? (z/node loc))) (z/replace loc (* 2 (z/node loc)))

Re: [ANN] fsrun : file change notifier high order lein task

2013-11-26 Thread Deniz Kurucu
Ah yes, sorry it is not on clojars yet. Wanted some feedback before pushing it there :) On Wed, Nov 27, 2013 at 2:26 AM, Plinio Balduino wrote: > Excellent, Deniz > > But I'm getting an error when I try to run for the first time: > > Could not find artifact fsrun:fsrun:jar:0.1.0 in central ( > h

Re: [ANN] Overtone 0.9.0 Released

2013-11-26 Thread Samuel Aaron
Hi Cedric, On 26 Nov 2013, at 16:45, Cedric Greevey wrote: > Is there a turnkey download/install/play with version of this yet, or is that > not until 1.0? For a Clojure developer, Overtone is already as 'turnkey' as it gets. Simply add "overtone 0.9.1" to your dependencies in project.clj, st

Re: Working with zippers and trees

2013-11-26 Thread dabd
The problem is that your vector-zip is not representing the tree I pictured. On Wednesday, November 27, 2013 6:26:12 AM UTC, martin_clausen wrote: > > Yes, for instance like this: > > (let [vz (z/vector-zip [1 [2] [3 [4 5]]])] > (loop [loc vz] > (if (z/end? loc) >