Re: Why does this overflow? (a try at the sieve of Eratosthenes)

2013-09-05 Thread Cedric Greevey
Deeply nested lazy seq generation? Try wrapping the main sequence in a doall at each iteration of the outer loop. On Wed, Sep 4, 2013 at 11:53 PM, John Gabriele wrote: > I tried implementing the sieve of Eratosthenes in Clojure. The approach is > to loop while (A) keeping my current list of num

Re: let bindings in tree-seq funciton

2013-09-05 Thread Cedric Greevey
More likely it has to do with simply naming many of the intermediate results in a calculation. That often results in long let bindings with short let bodies. I've written many a function that's basically (defn foo [x] (let [stuff more stuff yet more stuff res (Thingy. arg

Re: Screencast: understanding the thread-first and thread-last macros

2013-09-05 Thread Jernau
> This is a pretty good demo of light table as well for people who haven't really been keeping up with it lately. My first Clojure screencast was about test-driving a small project in Light Table: https://www.youtube.com/watch?v=H_teKHH_Rk0 If people would like to see some more Light Table in ac

Re: Clojure On Java Friendly Microcontrollers, Beaglebone, etc

2013-09-05 Thread Kevin Downey
Fiddling with the pins via the filesystem is where I started, but PyBBIO mmaps the pins so you can flip them by reading/writing directly to memory, and I "ported" that to clojure using https://github.com/hiredman/beaglebone-jni-utils and https://github.com/hiredman/blackbox/blob/master/src/blackbox

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Konrad Hinsen
Zach Tellman writes: > I guess I'm confused, then. You contrast "complete recursive > expansion" with what the compiler does, and then say it's recursive > prewalk expansion, which is exactly what the compiler does. Can > you clarify the difference between what you're doing and what the

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread bertschi
Hi Zach, you might want to look at this paper explaining how to write a correct macroexpand-all (which requires a code walker) in Common Lisp: http://www.merl.com/publications/TR1993-017/ The compiler certainly has to do something like that, but might not do all of the macroexpansion before sta

Re: Handling name collisions with clojure.core

2013-09-05 Thread Colin Fleming
This is actually probably not a bad solution. You wouldn't even need to rewrite, couldn't you just expand to a let? (let [* clojure.core.matrix.* + clojure.core.matrix.+] (+ ... (* ...))) Although thinking about it, you'd have to let-bind all possible operators every time, and the compile

Re: Why is clojure so powerful?

2013-09-05 Thread Josh Kamau
The only thing more powerful than Lisp is Lisp on JVM Josh On Thu, Sep 5, 2013 at 2:29 AM, Devin Walters wrote: > Battle-tested libraries are nice, and Java has a lot of them. Clojure > programmers can use all of them with relative ease. I recently tried > Erlang/Elixir and was disappointed in

binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
Hi all, I'm fighting with shoreleave-remote-ring running on a non default context (immutant), and me not being able to rebind shoreleave.remotes.http-rpc/*remote-uri* inside a go block. If you look at https://gist.github.com/mathiasp/6448753, you will find a code snippet in the init function w

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Stathis Sideris
Thanks for this library Zach, It seems that the released version is a bit behind in comparison to the generated documentation [1]. For example, walk-exprs is advertised as being able to accept a special-forms parameter, but that's not the case in the jar that leiningen retrieved when I used [ri

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Tim Visher
On Wed, Sep 4, 2013 at 6:32 PM, Daniel Higginbotham wrote: > With the C-s/C-r keybindings, I think the emacs.d I point has swapped > isearch and regexp search. I'll double-check that. > This is an amazing microcosm of _exactly_ why Rich and others seem to be pointing people away from Emacs lately

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
I allready go some help on IRC, define a function with the binding and rpc call inside it and then calling that function in my go block works. I'm now trying to test a simple code snippet Anderkent gave me to see is this is a bug, but that will have to wait till tomorrow or so... Am Donnerstag,

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Abraham
i liked the emacs chapter . Pl update on how to use emacs with a clojure project structure generated by lein On Monday, September 2, 2013 9:05:52 PM UTC+5:30, Daniel Higginbotham wrote: > > Hi all, > > I've been putting together http://www.braveclojure.com/ and would love > feedback. I've tri

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Mathias Picker
I just tried this test case (from Anderkent on IRC): (def pingc (chan)) (def ^:dynamic *text* "OUPS BAD ASYNC") (binding [*text* "good boy"] (go (while true ( > Hi all, > > I'm fighting with shoreleave-remote-ring running on a non default context > (immutant), and me not being able to

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Jacek Lach
That is not what happens in lein repl: user=> (use 'clojure.core.async) nil user=> (def pingc (chan)) #'user/pingc user=> (def ^:dynamic *text* "OUPS BAD ASYNC") #'user/*text* user=> (binding [*text* "good boy"] #_=> (go (while true #_=> ( (println *text* # user=> (defn p

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
As David said, binding preservation works with Clojure, not with ClojureScript. That being said, while I can see a use for bindings in Clojure (thread-local redef), I fail to see a use-case for binding in ClojureScript. Seems like code could/should be structured in a better way. On Thu, Sep 5, 20

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Meikel Brandmeyer (kotarak)
Hi, Am Donnerstag, 5. September 2013 16:36:37 UTC+2 schrieb Mathias Picker: > > I just tried this test case (from Anderkent on IRC): > > (def pingc (chan)) > > (def ^:dynamic *text* "OUPS BAD ASYNC") > > (binding [*text* "good boy"] > (go (while true > ( (js/alert *text* > >

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Zach Tellman
Hi Konrad, Okay, I think I was just being dense. I thought you were talking about a different macroexpansion strategy, rather than just doing full macroexpansion without interleaved compilation. Thanks for your patience in explaining what you meant. I will note, though, that &env is an implicit

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Zach Tellman
Sorry, that documentation reflected 0.1.1-SNAPSHOT, which I've just released as 0.1.1. Let me know if you have any other issues. Zach On Thu, Sep 5, 2013 at 6:26 AM, Stathis Sideris wrote: > Thanks for this library Zach, > > It seems that the released version is a bit behind in comparison to

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Zach Tellman
Hi Nils, Thanks for the link, I hadn't seen that before. Happily, what you describe is pretty much exactly what Riddley does, in this case by accessing the compiler internals. An example of how macrolet or symbol-macrolet could be implemented using this is linked above in my response to Konrad.

Re: I am trying to use lein uberjar to package as jar file that can be executed. but it's not working for another library is not contained.

2013-09-05 Thread Rooney
It works well. Thank you so much. :) On Thursday, September 5, 2013 2:44:58 PM UTC+9, TheBusby wrote: > > This isn't the solution you were looking for, but it should work; > > 1. Add simmetrics to your local maven repo; > $ mvn install:install-file -Dfile=*simmetrics_jar_v1_6_2_d07_02_07.jar* >

[ANN] Introducing prismatic/schema, a Clojure(Script) library for declarative data description and validation

2013-09-05 Thread Jason Wolfe
We're very excited to announce our first release of prismatic/schema, a cross-platform library for describing and validating data shapes. https://github.com/prismatic/schema http://blog.getprismatic.com/blog/2013/9/4/schema-for-clojurescript-data-shape-declaration-and-validation We'd love to he

Re: ANN Introducing EEP, a young [event] stream processing library

2013-09-05 Thread Oleksandr Petrov
EEP is an appropriate choice when: * you have to do processing on a single machine, or can split processing to several machines using "downstreams" which will forward processing from end-observer to emitter on a different machine * if you want it to be very fast and want to have pluggable backend

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
The Clojure core.async captures bindings at the beginning of the go block. This could be done in ClojureScript core.async as well but it needs language support to do this correctly and efficiently. David On Thu, Sep 5, 2013 at 10:48 AM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Am Donnersta

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
Your example doesn't accomplish what dynamic binding does. You don't need to look much further than Clojure / ClojureScript compilers to see cases where trying to propagate information through an environment like you are with ctx is absolutely too tedious, the aspect oriented nature of binding is r

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
I used to think the same, until I wrote the current incarnation of the go macro in core.async. A few months back I ripped out all global vars (and bindings). The go "compiler" is now functionally pure, except for a single atom on the edge that counts locals. More and more I'm convinced that dynamic

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
On Thu, Sep 5, 2013 at 1:23 PM, Timothy Baldridge wrote: > I used to think the same, until I wrote the current incarnation of the go > macro in core.async. A few months back I ripped out all global vars (and > bindings). The go "compiler" is now functionally pure, except for a single > atom on the

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
Related - does using a purer approach hurt debugging and error comprehension on the host - JVM / JavaScript? On Thu, Sep 5, 2013 at 1:28 PM, David Nolen wrote: > On Thu, Sep 5, 2013 at 1:23 PM, Timothy Baldridge wrote: > >> I used to think the same, until I wrote the current incarnation of the

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Roberto Guerra
I've been wanting to learn clojure for some time. Done some katas here and there, but what has kept me from taking the dive is precisely the attitude in the community that anything but Emacs is wrong. Yes, most clojure devs are already using Emacs, but most newbies are not. And to be honest, I

Re: Handling name collisions with clojure.core

2013-09-05 Thread Armando Blancas
> > I just think the default behaviour should be super-friendly and not spit > out warnings. > If other libs also redefine any of those operators or names, now or in later versions, I'd be glad to know. With last-one-in-wins some will lose. Maybe this will help: mvn clojure:repl 2> /dev/null

how does one unquote a list of records that implement IFn without treating the first item as a function?

2013-09-05 Thread Jim - FooBar();
HI all, I've gotten myself into a weird situation... I'm defining a def-like macro and I want to use 'name-with-attributes'. Consider the following skeleton: (defmacro defX [name & args] (let [[name attrs] (name-with-attributes name args)] `(let [cs-coll# ~attrs] (assert (every? componen

Re: how does one unquote a list of records that implement IFn without treating the first item as a function?

2013-09-05 Thread Dave Ray
~(vec attrs), perhaps? On Thu, Sep 5, 2013 at 12:20 PM, Jim - FooBar(); wrote: > HI all, > > I've gotten myself into a weird situation... > > I'm defining a def-like macro and I want to use 'name-with-attributes'. > Consider the following skeleton: > > > (defmacro defX [name & args] > (let [[na

Re: Handling name collisions with clojure.core

2013-09-05 Thread Sean Corfield
On Wed, Sep 4, 2013 at 11:25 PM, Mikera wrote: > I remember the debates :-) and I don't think there was anything like a > consensus that "don't do that" is the right answer. I didn't say there was consensus or that it was right :) > I'm not against giving the user control. I just think the defau

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Laurent PETIT
2013/9/5 Roberto Guerra : > I've been wanting to learn clojure for some time. Done some katas here and > there, but what has kept me from taking the dive is precisely the attitude > in the community that anything but Emacs is wrong. Yes, most clojure devs > are already using Emacs, but most newbies

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Roberto Guerra
Sorry if my comment came across the wrong way. I wasn't meaning you specifically, just the general clojure community in general. Keep up the good work. BTW, something that confuses me a lot in clojure is 'require' vs 'import'. There seem to be different ways of 'importing' or 'requiring' a pack

Usung atom in pmap

2013-09-05 Thread Kuba Roth
I have a few doubts how to approach updating values inside pmap and a general question if map is ideal to solve the problem. I'd really appreciate to get a review of the following code. The file-seqC and file-seqB is slightly modified version of file-seq. The plan was to spawn subfolders of the

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Daniel Higginbotham
Thanks for all the feedback. I didn't expect there to be such polar opposite reactions to the Emacs content! Roberto - did you notice the links to vim, CCW, and sublime text 2 materials? They are at the bottom of this page: http://www.braveclojure.com/getting-started/ . I'm also curious about y

How to force clojure evaluate all commands?

2013-09-05 Thread Kang Tu
Hi all, Clojure something *automatically" removed my command. These commands have side-effects and the results of the commands are not used. For example, in my seesaw program, when listening action events of one button, the program would change the icon of a group of panels which satisfy some

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Laurent PETIT
2013/9/5 Laurent PETIT : > 2013/9/5 Roberto Guerra : >> I've been wanting to learn clojure for some time. Done some katas here and >> there, but what has kept me from taking the dive is precisely the attitude >> in the community that anything but Emacs is wrong. Yes, most clojure devs >> are alread

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread David Nolen
I actually disagree a here as core.async brings a pretty nice concurrency model into play - I suspect there are instances where you might want to construct a series of go blocks with some shared context that you'd rather not put into every go loop. In anycase improved binding support is something

Re: how does one unquote a list of records that implement IFn without treating the first item as a function?

2013-09-05 Thread Jim - FooBar();
I ended up using (list ~@attrs) which is very similar to what you're suggesting...:) JIm On 05/09/13 20:22, Dave Ray wrote: ~(vec attrs), perhaps? On Thu, Sep 5, 2013 at 12:20 PM, Jim - FooBar(); > wrote: HI all, I've gotten myself into a weird situati

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Alex Baranosky
I'd just use a cond to flatten a nested if. That's usually all you need, imo. On Thu, Sep 5, 2013 at 1:07 PM, Bruno Kim Medeiros Cesar < brunokim...@gmail.com> wrote: > Thanks for your suggestion, didn't know about that! One of the things that > made someone say that "Clojure looks like a langua

wally: a alternative way to discover functions

2013-09-05 Thread Islon Scherer
Hey guys, I don't know about you but when I was a beginner in Clojure (and it still happens every now and then) I had a hard time finding functions using `doc` or `find-doc`, normally because I didn't remember the name of the function or because my only clue was a generic name so find-doc would

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Alex Baranosky
;; Better yet... (if (or (and (multi? graph) (not= 2 (count edge))) (and (looped? graph) (not (distinct? edge graph (let [e (if (directed? edge) (vec edge) (set edge))] (update-in graph [:edges] conj e On Thu, Sep 5, 2013 at 2:22 PM, Alex Baranosky < alexander.baran

Re: [ANN] lein typed - Check Clojure code with core.typed

2013-09-05 Thread JvJ
What's the compatibility with the REPL like? Is there anything like a type-checked REPL initialization, or automatic type checking when loading a namespace? On Tuesday, 3 September 2013 11:18:04 UTC-7, Ambrose Bonnaire-Sergeant wrote: > Hi, > > Announcing lein typed, a tool to use core.typed

Re: How to force clojure evaluate all commands?

2013-09-05 Thread Moritz Ulrich
The only 'implicit' laziness in Clojure comes from lazy lists. map, filter, and others are lazy. If you map over a list for side effects, don't use map, use dolist or wrap the map in a doall. On Thu, Sep 5, 2013 at 9:28 PM, Kang Tu wrote: > Hi all, > > Clojure something *automatically" removed my

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Bruno Kim Medeiros Cesar
Thanks for your suggestion, didn't know about that! One of the things that made someone say that "Clojure looks like a language from the near future". However, I'm having a hard time using it with its full power. Could you recommend any other resource, besides the overview page on github, to lea

Re: Clojure for the Brave and True, an online book for beginners

2013-09-05 Thread Bruno Kim Medeiros Cesar
I would like to add to Roberto's request, a thorough treatment of ns would be great. It has its specific syntax that takes some time to understand, but that you don't use enough to imprint in your brain. It differs between the REPL and the file source, and is a showstopper when you want to try

Re: Why does this overflow? (a try at the sieve of Eratosthenes)

2013-09-05 Thread kawas
I have been bitten by this `thunk` overflow many times in Haskell but rarely in Clojure Just to play with sieve (no optimization, just test and play with functions), I have tried to pile up function calls, but of course recursion of unrelated functions usually ends with a stackoverflow (trampol

Re: let bindings in tree-seq funciton

2013-09-05 Thread Kuba Roth
Thanks, very interesting point. It's a shame this is not available in the clojure docs - very useful for newcomers as me. Is it fair to say that let bindings is good/recomended to put all the code and the main body is used primarily for returning results of the function? Cheers, Kuba -- --

memory profile dominated by lazy seqs from dorun

2013-09-05 Thread Brian Craft
I'm using visualvm to generate a memory profile snapshot with tracebacks. The profile is dominated by clojure.lang.LazySeq. I'm confused that the allocation traces back to clojure.core$dorun.invoke. Attaching a screen shot. The write_data() function is being called repeatedly, and does a dorun

Re: let bindings in tree-seq funciton

2013-09-05 Thread Cedric Greevey
I wouldn't say that. It depends on what the function is doing, and to some extent on your philosophy. Some would suggest breaking functions into very small functions, though I'd mostly only break out separate functions if they are separately useful. If naming the intermediates isn't very useful for

Re: Handling name collisions with clojure.core

2013-09-05 Thread Zach Tellman
Not doing actual replacement via code-walking will prevent any functions with inline definitions actually being able to benefit from this. I'm not sure if those are used in core.matrix, though. On Thu, Sep 5, 2013 at 4:54 AM, Colin Fleming wrote: > This is actually probably not a bad solution.

Re: Improving a nested if, or How to use multimethods the right way.

2013-09-05 Thread Bruno Kim Medeiros Cesar
Thanks, Alex, I was going down an over-engineering rabbit hole. Your solution just lacks a not before multi? and looped?. On Thursday, September 5, 2013 6:24:13 PM UTC-3, Alex Baranosky wrote: > > ;; Better yet... > > (if (or (and (multi? graph) (not= 2 (count edge))) > (and (looped? gra

Re: binding and core.async? (trying to use shoreleave-remote in go block)

2013-09-05 Thread Timothy Baldridge
That can easily be done thusly: (defn do-stuff [ctx c] (go (loop [] (let [v ( wrote: > I actually disagree a here as core.async brings a pretty nice concurrency > model into play - I suspect there are instances where you might want to > construct a series of go blocks with some sha

Re: ANN Introducing EEP, a young [event] stream processing library

2013-09-05 Thread Timothy Pratley
Awesome! Thank you for making this available, neat library - I like it. PS: You can improve your golf score by using rand-nth :) :) (defn gen-events [] (map #(assoc %1 :id %2) (repeatedly #({:host(rand-nth hosts) :status (rand-nth status-codes)

Re: [ANN] lein typed - Check Clojure code with core.typed

2013-09-05 Thread Ambrose Bonnaire-Sergeant
Hi, core.typed is designed to be used at the REPL. Using core.typed at the REPL There is currently no automatic type checking when loading a namespace. Consider a commented out (check-ns), a unit test

Re: Clojure On Java Friendly Microcontrollers, Beaglebone, etc

2013-09-05 Thread Jeremy Wright
Thanks Kevin. I guess it really doesn't have to be an either-or thing. A mix of I2C and PyBBIO could be used as needed. I'm going to start by experimenting a little with I2C and then go from there. On Thursday, September 5, 2013 5:05:55 AM UTC-4, red...@gmail.com wrote: > > Fiddling with the pin

Re: Why does this overflow? (a try at the sieve of Eratosthenes)

2013-09-05 Thread John Gabriele
On Thursday, September 5, 2013 3:01:01 AM UTC-4, Cedric Greevey wrote: > > Deeply nested lazy seq generation? Try wrapping the main sequence in a > doall at each iteration of the outer loop. > > Ah, thanks, Cedric! Changed `(recur (remove-multiples-of new-num new-nums) ...` to `(recur (doall (rem

Re: wally: a alternative way to discover functions

2013-09-05 Thread Mayank Jain
Looks pretty interesting. Thanks for sharing On Fri, Sep 6, 2013 at 2:53 AM, Islon Scherer wrote: > Hey guys, > > I don't know about you but when I was a beginner in Clojure (and it still > happens every now and then) I had a hard time finding functions using `doc` > or `find-doc`, > normally be

Re: wally: a alternative way to discover functions

2013-09-05 Thread Shaun Gilchrist
Very cool! I wonder how hard it would be to have it suggest compositions if it can not find a direct match? On Thu, Sep 5, 2013 at 10:34 PM, Mayank Jain wrote: > Looks pretty interesting. Thanks for sharing > > > On Fri, Sep 6, 2013 at 2:53 AM, Islon Scherer wrote: > >> Hey guys, >> >> I don't

Counterclockwise

2013-09-05 Thread Marc Dzaebel
Hi, I love this Eclipse-plugin, however, there are issues that are not even categorized since April 2013. It might be deliberate but does anyone know the status of this project? Thanks, Marc -- -- You received this message beca

Re: [ANN] riddley: code-walking without caveats

2013-09-05 Thread Konrad Hinsen
Zach Tellman writes: > I will note, though, that &env is an implicit argument to the macros, so > anything which > works "exactly" like the compiler needs to mimic that as well. I certainly agree, and I'll put this on the to-do list for tools.macro (as soon as JIRA will let me in again, but t

Re: Counterclockwise

2013-09-05 Thread Mikera
Counterclockwise is great and it's definitely very actively developed. Laurent does a fantastic job and is very responsive. Perhaps you should be looking at the current GitHub tree rather than the old Google Code one? - https://github.com/laurentpetit/ccw/commits/master On Friday, 6 September