Re: [ANN] dag-runner -- automatically aggregate and execute functions that depend upon each other

2014-04-07 Thread Hesen Peng
Hey Leif, Thanks a lot for pointing this out! I did some rudimentary search before writing dag-runner and missed this one [shy] Prismatic Graph looks like a very comprehensive implementation. I'll play with the code and try to learn the way they implement the idea. Thanks a lot. Hesen On

Re: Lazy sequence - how they work internally

2014-04-07 Thread sorin cristea
Hi James, I'm new to clojure and maybe for this reason it's possible to put some 'stupid' questions, I came for Java so for me it's normal when I call a fc/method to execute the body of that fc/method and return a result; this is the reason for why I expect a result when I call (test-fc (ran

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-07 Thread Peter West
Carlo, See below. On Tuesday, 8 April 2014 12:20:16 UTC+10, Carlo wrote: > > On Mon, Apr 07, 2014 at 04:08:03AM -0700, Peter West wrote: > > I'm trying to understand the difference between two alternatives in the > > following code that reads from a resource file. > > > > (defn vcf-res-reader

Re: [ANN] Taoensso library updates / Apr 2014

2014-04-07 Thread Peter Taoussanis
You're very welcome Leif, cheers :-) -- 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

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-07 Thread Carlo Zancanaro
On Mon, Apr 07, 2014 at 04:08:03AM -0700, Peter West wrote: > I'm trying to understand the difference between two alternatives in the > following code that reads from a resource file. > > (defn vcf-res-reader > [res] > (->> res >io/resource >io/reader)) > > (defn lines-only >

What's the difference between -?> and some-> ?

2014-04-07 Thread Plínio Balduino
Hi there It's being hard to find updated documentation with 1.5+ features and I'm confused about as-> and some->. Basically, what's the difference between the contrib -?> and the core some-> ? Thank you Plínio -- You received this message because you are subscribed to the Google Groups "Cloju

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-07 Thread Peter West
Thanks for the suggestion, but it doesn't work. With alternative 1, I still get the Unbound error, but I then get the same error with alternative 2. That is, they now both throw the same error. Any other suggestions? On Monday, 7 April 2014 23:21:12 UTC+10, mlimotte wrote: > > To use alterna

Re: Treating mutable Java objects as values

2014-04-07 Thread Mikera
You can usually get away with treating mutable Java objects as immutable values providing that you strictly limit where / how they can be mutated. This means: - Knowing where / when the Java library might mutate the value (usually this is pretty obvious) - Not mutating the value yourself I use

Re: [ANN] dag-runner -- automatically aggregate and execute functions that depend upon each other

2014-04-07 Thread Leif
Hi, Hesen. Your library sounds like a good idea. And because it is, I believe it has already been implemented as Prismatic's Graph (https://github.com/prismatic/plumbing). You may want to use/extend that instead of writing your own library. But if you continue with your own library, one goo

[ANN] dag-runner -- automatically aggregate and execute functions that depend upon each other

2014-04-07 Thread Hesen Peng
Hi everybody, You might have experienced writing up multiple functions which depend upon the result of each other to execute. To make things more complicated you might even wanna split the result from one function and feed them separately into two other functions, while potentially combining

Re: [ANN] Taoensso library updates / Apr 2014

2014-04-07 Thread Leif
Very nice. Thanks for all your hard work, Peter! On Monday, April 7, 2014 11:52:31 AM UTC-4, Peter Taoussanis wrote: > > Hi all, quick batched update on some libs that I put out. Hope someone > finds these useful. As usual, API docs are available on each GitHub page. > > Have fun, cheers :-) > >

OT: Wiki Use Survey

2014-04-07 Thread Rich Morin
My spouse (Vicki Brown) has put together a very short survey on wiki use. If this is of possible interest to you, read on... -r The SurveyMonkey page for the "Wiki Use Survey" is located at: https://www.surveymonkey.com/s.aspx?sm=17tHn4bsQ98%2fV6zkaM3gAw%3d%3d Quoting from the survey's pre

Re: Lazy sequence - how they work internally

2014-04-07 Thread A. Webb
The point was you aren't using lazy-seq as intended here since you are always creating a singleton sequence. What's going on behind the scenes here is in effect just trampolining thunks. (defn thunked-sum [sum coll] (if-let [[x & more] (seq coll)] (fn [] (thunked-sum (+ sum x) more))

Re: Lazy sequence - how they work internally

2014-04-07 Thread James Reeves
Why do you expect (test-fc (range 210432423543654675765876879)) to return a result? Even if each iteration of the loop takes only 1 nanosecond, your function would take 6 billion years to complete. - James On 7 April 2014 21:01, sorin cristea wrote: > > Hi Gianluca, > > I have a question ; w

Re: Lazy sequence - how they work internally

2014-04-07 Thread sorin cristea
Hi Gianluca, I have a question ; why when a run/execute command/code line (test-fc (range 210432423543654675765876879)) it's not executed the function test-fc and return the sum for all 210432423543654675765876879 elements? why should I put the test-fc reference to a variable, x, like you pr

Re: [ANN] reloadable-app - lein template for component apps and reloaded workflow

2014-04-07 Thread Adrian Mowat
Hi James I fired up a repl and tried to replicate the warning I was seeing but I couldn't make it happen again. I must have done something one of my test projects that broke my repl session so I'll keep an eye out for it happening again and see if I can debug the problem. Thanks for your help

Re: Lazy sequence - how they work internally

2014-04-07 Thread sorin cristea
Hi Ginaluca, I have a question ; why when a run/execute command/code line (test-fc (range 210432423543654675765876879)) it's not executed the function test-fc and return the sum for all 210432423543654675765876879 elements? why should I put the test-fc reference to a variable, x, like you p

Re: clojure.core/Format Bug?

2014-04-07 Thread Paul Umbers
I have the same version of LightTable and the binary, using Clojure 1.6.0 and Java 1.7.0_51 under Ubuntu 13.04. I've attached a screenshot of the output I get.

Re: clojure.core/Format Bug?

2014-04-07 Thread Thomas Hicks
If I copy and paste your format s-exp into LT, I see the correct result, displayed correctly. Same for a plain lein repl using Clojure 1.6.0. I'm using LightTable 0.6.5, binary 0.8.4. (On OSX 10.8.5 using Java 1.7.0_60-ea-b12). HTH, -tom On Sunday, April 6, 2014 2:00:55 PM UTC-7, Paul

Re: How do I detect the end of a file without catching an exception?

2014-04-07 Thread Simon Brooke
Thank you, that's neat! On Monday, 7 April 2014 19:14:40 UTC+1, guns wrote: > > On Mon 7 Apr 2014 at 11:07:37AM -0700, Simon Brooke wrote: > > OK, the second question I've sort of answered for myself, by riffing on > the > > source of line-seq: > > > > (defn expr-seq > > "Returns forms fr

Re: How do I detect the end of a file without catching an exception?

2014-04-07 Thread A. Webb
On Monday, April 7, 2014 1:14:40 PM UTC-5, guns wrote: > > On Mon 7 Apr 2014 at 11:07:37AM -0700, Simon Brooke wrote: > > OK, the second question I've sort of answered for myself, by riffing on > the > > source of line-seq: > > > > (defn expr-seq > > "Returns forms from src (assumed to b

Re: How do I detect the end of a file without catching an exception?

2014-04-07 Thread guns
On Mon 7 Apr 2014 at 11:07:37AM -0700, Simon Brooke wrote: > OK, the second question I've sort of answered for myself, by riffing on the > source of line-seq: > > (defn expr-seq > "Returns forms from src (assumed to be Clojure source) as a lazy sequence > of expressions" > [^java.io.Pushbac

Re: How do I detect the end of a file without catching an exception?

2014-04-07 Thread Simon Brooke
OK, the second question I've sort of answered for myself, by riffing on the source of line-seq: (defn expr-seq "Returns forms from src (assumed to be Clojure source) as a lazy sequence of expressions" [^java.io.PushbackReader src] (when-let [expr (read src)] (try (cons expr (lazy

Re: Core.async nil on unclosed channels

2014-04-07 Thread Timothy Baldridge
(async/into []) is probably the closest thing to doall On Mon, Apr 7, 2014 at 11:46 AM, Alejandro Ciniglio wrote: > Sure, except you can use doall to realize the sequence from map, but > there's no equivalent for core.async.map<. I guess you could wrap it in > something that constantly tries to

Re: Core.async nil on unclosed channels

2014-04-07 Thread Alejandro Ciniglio
Sure, except you can use doall to realize the sequence from map, but there's no equivalent for core.async.map<. I guess you could wrap it in something that constantly tries to read from the output channel? -- You received this message because you are subscribed to the Google Groups "Clojure" gr

How do I detect the end of a file without catching an exception?

2014-04-07 Thread Simon Brooke
I've written a pair of functions which read a stream of Clojure source and identify the var[*] definitions. They work, but the way they work seems clumsy to me. Here they are: (defn find-vars-in-reader [eddi] "Return a list of names of vars declared in the stream this reader reads"

Re: Core.async nil on unclosed channels

2014-04-07 Thread Timothy Baldridge
That's the case with clojure.core.map as well, don't consume the lazy seq the side effects aren't run...in short, map is not for side effects. On Mon, Apr 7, 2014 at 11:32 AM, Alejandro Ciniglio wrote: > Yeah, that seems to be the best practice that's promoted as well. Another > gotcha with thi

Re: Core.async nil on unclosed channels

2014-04-07 Thread Alejandro Ciniglio
Yeah, that seems to be the best practice that's promoted as well. Another gotcha with this implementation is that since it's done via extending the channel protocol (specifically take!), it doesn't actually apply the functions effects unless someone is reading from the channel. This could be an

Re: Fn as value matcher in core.match

2014-04-07 Thread A. Webb
It is always matching the first clause because it is getting translated into a `let` binding. In match, the left-hand side `get` is just a symbol, not the `var` it resolves to, so might as well be `(let [fun assoc] (match fun foo "foo!"))` where `foo` will just be bound to `assoc`. Match does n

Re: Core.async nil on unclosed channels

2014-04-07 Thread Gary Trakhman
Ah, scratch that. I see from the source it indeed closes the source channel. Was hoping that was the clue I needed. On Mon, Apr 7, 2014 at 11:52 AM, Gary Trakhman wrote: > I'm currently running into a bug where it seems like channels aren't being > closed down like they should. This manifests

Re: Core.async nil on unclosed channels

2014-04-07 Thread Gary Trakhman
I'm currently running into a bug where it seems like channels aren't being closed down like they should. This manifests in everything blocking up after many websocket connections. map< and pipe are involved, I think this is the clue I needed :-). #(async/map< pr-str (async/tap a-mult (async/chan

[ANN] Taoensso library updates / Apr 2014

2014-04-07 Thread Peter Taoussanis
Hi all, quick batched update on some libs that I put out. Hope someone finds these useful. As usual, API docs are available on each GitHub page. Have fun, cheers :-) *Sente - v0.9.0 / 2014 Mar 29 (NEW)* *==* *Realtime web comms for Clojure* https://github.com/pta

Re: Core.async nil on unclosed channels

2014-04-07 Thread Timothy Baldridge
But yes, we should probably at least put a note in the docs for map< stating "returning nil from the mapping function can result in undefined behavior". Or add an assert somewhere perhaps. Timothy On Mon, Apr 7, 2014 at 9:36 AM, James Reeves wrote: > This looks like a bug to me. A lot of the i

Re: Core.async nil on unclosed channels

2014-04-07 Thread Timothy Baldridge
This is a interesting side-effect of the way that map< is implemented. Internally map< is not actually using channels, but is using the channel protocols. It's creating something that looks like a ReadPort, but before handing values to callbacks it applies a function to the value. So map< doesn't a

Re: Core.async nil on unclosed channels

2014-04-07 Thread James Reeves
This looks like a bug to me. A lot of the internal core.async functions rely on nil values indicating the channel is closed. - James On 7 April 2014 16:26, Alejandro Ciniglio wrote: > Using core.async, I've understood the convention to be that if you take > nil from a channel, that channel is

Core.async nil on unclosed channels

2014-04-07 Thread Alejandro Ciniglio
Using core.async, I've understood the convention to be that if you take nil from a channel, that channel is closed. This seems to hold for most cases, but I've found a corner case when using map< that lets you pull nil from a channel that is not closed. (def a (chan)) (def c (map< seq a)) (go

Functional Software Engineering Posts

2014-04-07 Thread Khushil Dep
*Symphonic Solutions Ltd* (www.sphonic.com) is a disruptive technology company that leverages *functional paradigms* to enable *engineered innovation*. In real terms, we build *high performance*, *low latency* platforms that integrate to a plethora of third party API’s and apply intelligent

Fn as value matcher in core.match

2014-04-07 Thread Serzh Nechyporchuk
How can I match fns as values? For example: (let [fun assoc] (match [fun] [get] "get" [assoc] "assoc" :else "other")) The example above is not match correctly. It always matches on first clause. Thank you. -- You received this message because you are subscribed to the Google G

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-07 Thread Marc Limotte
To use alternative 1, you need ~lineseq in your eval: (eval `(def ~(symbol varname) ~lineseq)) If you don't unquote lineseq like this, then you are def'ing "cards" to the *symbol* lineseq. When you later access "cards", it is evaluated to returns the symbol lineseq. But since lineseq was a lo

Re: Thoughts on a curly-infix reader macro?

2014-04-07 Thread Simon Brooke
I think this comes down to learning to speak Lisp. Everyone's first few months of learning to speak Lisp are painful. And then quite suddenly it becomes natural. Yes, it's possible to write infix notation for Lisp - I first saw this in InterLisp's CLISP (I think) back in 1985 or so, but it's ol

Re: alternative syntax for Clojure? Haskell?

2014-04-07 Thread Colin Fleming
> > There's MLj http://research.microsoft.com/en-us/um/people/nick/mlj.htm > Unfortunately MLj is almost totally bit-rotted at this stage. I made a valiant attempt to get it going a couple of years back but it would be a lot of work, and once you have it working it doesn't fully support SML. It's

(eval `(def ~(symbol varname) lineseq)

2014-04-07 Thread Peter West
I'm trying to understand the difference between two alternatives in the following code that reads from a resource file. (defn vcf-res-reader > > [res] > > (->> res > >io/resource > >io/reader)) > > >> (defn lines-only > > [varname prom resource] > > (with-open [r (vcf-res-

Re: Proxy vs. glue class

2014-04-07 Thread Phillip Lord
Mikera writes: > +LOTS for this. I have wanted to extend a Java abstract base class *many* > times in Clojure. It's a real pain point, right now. Especially for interop > with Java libraries that expect you to extend base classes in order to > write plugins etc. Currently when this comes up I j

Re: Online Gorilla REPL worksheet viewer

2014-04-07 Thread Jony Hudson
Hi Paul, the viewer code is pretty much all in the main project, as it shares much of its code with the editor. You can run your own instance of the viewer just by serving up the (static) files in the 'resources/public' directory of the gorilla-repl jar - no server side code is needed - and vi

Re: Leiningen: referring to another project on local disc

2014-04-07 Thread Simon Brooke
Many thanks. This solutions worked for me. I note that it also auto-builds a pom.xml! On Sunday, 6 April 2014 14:31:55 UTC+1, Luc wrote: > > Use lein install > > This command will "install" your testgen jar in your local repo folder. > This local repo is hit first when searching for a dependenc

Re: alternative syntax for Clojure? Haskell?

2014-04-07 Thread Paul deGrandis
What projects specifically do you find lack documentation and well-organized code? If the problem statement is: "Some projects have code that is not easily comprehended," the solution is contribution. If the problem statement is: "Clojure lends itself to writing code that is not easily comprehe

A different sort of FizzBuzz

2014-04-07 Thread Joshua Ballanco
My intention is to write up a full blog post explaining how I arrived at this answer, but as I am horribly delinquent in updating my personal site, I figured I would share this directly with the community: https://github.com/jballanc/logicbuzz Comments, questions, and incredulous cock-eyed sta

Re: Treating mutable Java objects as values

2014-04-07 Thread David Koontz
Could you go into more details on what you mean by "model how they change". I'm unsure of how to see changes over time without recording all the current values and comparing them later. On Saturday, April 5, 2014 10:42:54 AM UTC-7, Travis Wellman wrote: > > If it were my project I would simply