Re: Clojure performance question

2014-03-01 Thread Gary Trakhman
Core fns should be simple, unsurprising, and general. 'Improving' str may hurt simplicity, make behavior more surprising and unexpected, and less general unless proven otherwise. On Sat, Mar 1, 2014 at 7:02 PM, bob wrote: > > Good point, Thanks a lot. > > Shall we improve the str fn in the core

Re: More functional Quil

2014-03-09 Thread Gary Trakhman
FWIW, I've got an example of a decoupled update/draw loop here: https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj On Sun, Mar 9, 2014 at 10:16 PM, Lee Spector wrote: > > FWIW I'm not crazy about these suggestions because they seem to me to be > mostly cosmetic, and actually

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Gary Trakhman
1. Read a good book. 'Clojure Programming' has a good reputation. 'Joy of Clojure' is a good second book. 2. Do some small examples, 4clojure is great for this. 3. Build up larger programs from smaller chunks. Learning another lisp at the same time is going to distract more than help, clojure doc

Re: More functional Quil

2014-03-10 Thread Gary Trakhman
e the idea or would rather keep old good quil as it is. > > > Gary, > Thank you. It might be useful in future if we decide to implement similar > thing. > > > Thank you, > Nikita > > > On Mon, Mar 10, 2014 at 4:27 AM, Gary Trakhman wrote: > >> FWIW, I've

Re: Need help understanding a lazy sequence function

2014-03-10 Thread Gary Trakhman
If you haven't seen the impl yet, it's relatively small and simple: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L642 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java Chunked seqs are more complex, but they're basically a performance optim

Re: Help a Startup use Clojure!

2014-03-11 Thread Gary Trakhman
Some Observations: We took on a relatively inexperienced java developer, threw her into emacs, gave her 'Joy of Clojure', and she was able to make contributions within a month or two. It doesn't have to be Clojure-everything, maybe PHP would be a great fit for the front-end web/templating based on

Re: STM and persistent data structures performance on mutli-core archs

2014-03-14 Thread Gary Trakhman
On Fri, Mar 14, 2014 at 12:58 PM, Raoul Duke wrote: > cough cough erlang cough ahem > > Care to elaborate? :-) > -- > 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 fr

Re: STM and persistent data structures performance on mutli-core archs

2014-03-14 Thread Gary Trakhman
Shared memory is kind of a degenerate case of message-passing when you think about cache-coherency protocols and such. I'd argue erlang's message-passing isn't inherently superior, but kind of obfuscates the issue. What's the sequential fraction of an arbitrary erlang program, can you even know (

Re: STM and persistent data structures performance on mutli-core archs

2014-03-14 Thread Gary Trakhman
On Fri, Mar 14, 2014 at 1:35 PM, Raoul Duke wrote: > i am probably out of my depth here, i do not have extensive real-world > experience with the various ways to approach parallelism and > concurrency (to be distinguished of course), more run of the mill > stuff. so if i sound like i'm missing yo

Re: STM and persistent data structures performance on mutli-core archs

2014-03-14 Thread Gary Trakhman
bility to do this sort of thing is a tradeoff from using abstractions (threads, OS threads, Java threads) that closely match or can be massaged to match or 'have sympathy' for the hardware realities. I think this can get lost when we stray too far. On Fri, Mar 14, 2014 at 1:46 PM, Gary Trak

Re: STM and persistent data structures performance on mutli-core archs

2014-03-14 Thread Gary Trakhman
Yes I agree, that was my next thought. I wish we could do these knobs in a single JVM. On Fri, Mar 14, 2014 at 2:20 PM, Raoul Duke wrote: > > that closely match or can be massaged to match or 'have sympathy' for the > > hardware realities. I think this can get lost when we stray too far. > >

Re: STM and persistent data structures performance on mutli-core archs

2014-03-18 Thread Gary Trakhman
Martin, You recommend message-passing approaches like Erlang's as generally superior, but I'm curious if there's any more specific thoughts to the relative tradeoffs from shared-memory by default vs message-passing, ie, where you might rely on hardware-level copies (cache coherence) for coordinati

Re: STM and persistent data structures performance on mutli-core archs

2014-03-18 Thread Gary Trakhman
If it's any consolation, queues or delays are used in hardware to overcome limitations in hardware, too :-). Specifically, I'm thinking of anti-jitter stuff in audio circuits. On Tue, Mar 18, 2014 at 12:45 PM, Andy C wrote: > >> I've never heard of "imperative model". I'm aware of imperative

Re: How should I begin this project?

2014-03-20 Thread Gary Trakhman
This sounds like exactly what doodle does: http://doodle.com/en/ On Thu, Mar 20, 2014 at 11:43 AM, kurofune wrote: > Thanks for the responses. I looked into google calendar but I couldn't > find anything about this feature. I agree that things can get complex and > unwieldy really quick. I am o

Re: How should I begin this project?

2014-03-20 Thread Gary Trakhman
ugh ramifications. Eventually you'll have an idea of what 'complex' feels like, with language to explain it, and techniques to avoid it. I draw boxes with inputs and outputs on them in a make-up-as-I-go-along notation.. that's beneficial for me usually. On Thu, Mar 20, 2014 at

Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
It doesn't need to be simultaneous within the actual update function (the function that's passed in to swap!), it needs to be simultaneous just as far as the atom state-change is concerned. A faster update function means less contention and restarts. On Fri, Mar 21, 2014 at 4:13 PM, Jacob Goodso

Re: Concurrently updating two structures

2014-03-21 Thread Gary Trakhman
Check out my collision detection here: https://github.com/gtrak/quilltest/blob/master/src/quilltest/balls.clj#L117 I build a map of collided pairs first, then I run through the whole thing to update the relevant stuff. On Fri, Mar 21, 2014 at 4:37 PM, Raoul Duke wrote: > > update them one at a

ANN: no.disassemble 0.1.3 - data disassembler

2014-03-23 Thread Gary Trakhman
A Clojure library designed to let you inspect bytecode of functions and things. https://github.com/gtrak/no.disassemble This release: I've merged Aphyr's data disassembler implementation which converts the underlying eclipse disassembler's class hierarchy into standard clojure data structures. It

Re: How did you learn Clojure?

2014-03-24 Thread Gary Trakhman
For me, it went like this, but I had the luxury of a full time clojure job that gave me some space to learn: 1. Read Joy Of Clojure. I got the philosophy and background knowledge that informed further study out of it. Felt like I understood the theory and motivations, but I was missing the 'musc

Re: ANN: no.disassemble 0.1.3 - data disassembler

2014-03-24 Thread Gary Trakhman
I'll fix that up for the next release. Thanks! On Mon, Mar 24, 2014 at 5:24 PM, Jules wrote: > Firstly - I use this package - it is exactly what I need and it just works > :-) - thanks, Gary > > now, some constructive criticism ... > > I build all my code with (set! *warn-on-reflection* true)

Re: generators...?

2014-03-26 Thread Gary Trakhman
cycle - http://clojuredocs.org/clojure_core/clojure.core/cycle And generally, this class of functionality is called lazy-seqs. On Wed, Mar 26, 2014 at 3:59 PM, Christopher Howard wrote: > Hi. I'm still fairly new to Clojure. I was wondering: What's the > easiest way to make a generator (or some

Re: generators...?

2014-03-26 Thread Gary Trakhman
at can be called repeatedly and > get a different answer each time. > > > On Wed, Mar 26, 2014 at 1:05 PM, Gary Trakhman wrote: > >> cycle - http://clojuredocs.org/clojure_core/clojure.core/cycle >> >> And generally, this class of functionality is called lazy-se

Re: looking for a lzw decompress routine written in clojure

2014-03-27 Thread Gary Trakhman
Why? A java one exists. On Thu, Mar 27, 2014 at 6:09 PM, bww00amd...@yahoo.com < bww00amd...@yahoo.com> wrote: > > > Thanks > Bryan > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.co

Re: REPL: viewing data structures containing infinite lists

2014-03-31 Thread Gary Trakhman
http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon, Mar 31, 2014 at 8:49 PM, Christopher Howard wrote: > Is there some kind of "safe" function for printing representations of > lazy, infinite data structures? I'm finding I like using them inside > other data structures here a

Re: REPL: viewing data structures containing infinite lists

2014-04-01 Thread Gary Trakhman
Yea, print is generalized to a java PrintWriter class, I think, the requirements of repl usage are not the only ones. On Tuesday, April 1, 2014, A. Webb wrote: > > > On Tuesday, April 1, 2014 11:00:37 AM UTC-5, Andreas Liljeqvist wrote: >> >> Is there any good reason for not providing a default

Re: REPL: viewing data structures containing infinite lists

2014-04-01 Thread Gary Trakhman
; *print-length*? > >> I think that if you *really* want to print a list containing 100K items, > >> you would have to set *print-length*. > >> > >> Basically it seems less harmful to set it to a nice value by > default(42?) > >> than possible locking up the

Re: Treating mutable Java objects as values

2014-04-05 Thread Gary Trakhman
I don't think there is a general answer to this fundamental impedance mismatch, but you might want to look at the implementation of clojure.core/bean: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_proxy.clj#L372 That doesn't provide a deep view but it's a start for approaches

Re: alternative syntax for Clojure? Haskell?

2014-04-05 Thread Gary Trakhman
I always felt that clojure compared to java is about 10x more dense, but only 3x harder to read and write in lines, and the overhead is dependent on the level of abstraction, as it should be. Having only the essence removes noise. Also, in java, raising the level of abstraction generally creates

Re: alternative syntax for Clojure? Haskell?

2014-04-05 Thread Gary Trakhman
At least in my case, this process of mental macro/functioncall expansion, or 'abstraction-surfing' as I like to call it, got easier over time. I feel like it's been a general skill to hone for programming in general, and lisp emphasizes this more than anything else I've seen, but maybe I just dran

Re: Composability of Clojure in math-heavy hot loops

2014-04-06 Thread Gary Trakhman
You can possibly get rid of the var dereference by dereferencing at compile-time. Of course this means you lose the benefits of vars, too. It's just super-easy when needed :-). (defn a [] 1) (defn b [] (dotimes [_ 10] (a))) (time (b)) "Elapsed time: 1097.082556 msecs" (time (b)) "Elap

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

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 th

Re: REPL

2014-04-08 Thread Gary Trakhman
Leiningen is really the place to start, it bundles REPL-y, which includes these features. Follow the instructions to install: http://leiningen.org/ Then you can simply 'lein repl' in a project root (with the project's dependencies) or it'll just open up a basic repl. On Tue, Apr 8, 2014 at 8:01

Re: "true" lightweight threads on clojurescript?

2014-04-08 Thread Gary Trakhman
I think you might be able to use put! with a callback, or (go (>! ..)) within foo for a transient go process. Not sure if there's any ill effects. On Tue, Apr 8, 2014 at 4:51 PM, t x wrote: > Hi, > > > * I am aware of core.async. However, I don't like the fact that (go > ... ) is a macro, th

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
> > > But 1. Can't find examples with records, 2. Not sure if I can use it to > update a different field than the one I'm using to do the query. In the > examples fields seem to be the same. > > > Leave off the last path segment and return the full updated record, not just the new field's value. -

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
ate, but >> I don't know the syntax. Something like >> >> (commute dataprovider/products #(update-in % {:id id} (->Item ???) )) >> >> >> >> >> Am Mittwoch, 9. April 2014 00:01:00 UTC+2 schrieb Gary Trakhman: >>> >>> >

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
ment I understand update-in would work for the update, >>> but I don't know the syntax. Something like >>> >>> (commute dataprovider/products #(update-in % {:id id} (->Item ???) >>> )) >>> >>> >>> >>> >>> Am Mit

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
gt; > This gives me the element I need to update, but I still don't know how I > update this element in the vector. > > > > Am Mittwoch, 9. April 2014 00:27:41 UTC+2 schrieb Gary Trakhman: >> >> Maybe this will help: >> >> > (update-in [[] 2

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
Alternatively, you could sprinkle (into [] ..) to feed the result of remove/filter back into a vector. On Tue, Apr 8, 2014 at 7:16 PM, Gary Trakhman wrote: > My response had the assumption that this is an example of an X-Y problem > :-). > > If you want to literally do what you sa

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Gary Trakhman
to record, updates are O(log32 n), which is much better. On Tue, Apr 8, 2014 at 7:18 PM, Gary Trakhman wrote: > Alternatively, you could sprinkle (into [] ..) to feed the result of > remove/filter back into a vector. > > > On Tue, Apr 8, 2014 at 7:16 PM, Gary Trakhman wrote:

Re: My experiments with concurrent programming

2014-04-12 Thread Gary Trakhman
I'd recommend running a doall on concurrent-list in order to realize the futures, if you simply deref as you are, then you're going to delay the execution of futures down the line as the sequence is realized bit by bit (except chunking helps you here by accident). You are effectively preventing la

Re: My experiments with concurrent programming

2014-04-12 Thread Gary Trakhman
Which is what executors need. On Sat, Apr 12, 2014 at 11:19 AM, Gary Trakhman wrote: > I'd recommend running a doall on concurrent-list in order to realize the > futures, if you simply deref as you are, then you're going to delay the > execution of futures down the line as th

Re: Get rid of the clojure.jar

2014-04-12 Thread Gary Trakhman
Oh man, please consider using leiningen. It's a whole new world :-) http://leiningen.org/ On Sat, Apr 12, 2014 at 11:49 AM, Cecil Westerhof wrote: > I am not so far yet that I need it, but it never hurts to look ahead. > > When compiling your Clojure program you call it with: > > java -clas

Re: Get rid of the clojure.jar

2014-04-12 Thread Gary Trakhman
In your case, once you've created a leiningen project, it's as easy as 'lein uberjar'. On Sat, Apr 12, 2014 at 11:56 AM, Gary Trakhman wrote: > Oh man, please consider using leiningen. It's a whole new world :-) > > http://leiningen.org/ > > > On Sat

Re: My experiments with concurrent programming

2014-04-12 Thread Gary Trakhman
hrough reducers/fold. On Sat, Apr 12, 2014 at 3:18 PM, Cecil Westerhof wrote: > 2014-04-12 17:19 GMT+02:00 Gary Trakhman : > > I'd recommend running a doall on concurrent-list in order to realize the >> futures, if you simply deref as you are, then you're going to d

Re: cljs, websocket, autoreconnect

2014-04-14 Thread Gary Trakhman
Oh good. I don't think I'd stop using jetty for the sake of websockets. If sente has a backend impl that can be made compatible with it, then is consider that, but the jetty-websockets-async lib is relatively straightforward. This reconnecting closure websocket fixes my last major issue. On Monda

Re: How to work with variables that need to change

2014-04-15 Thread Gary Trakhman
One nitpick I noticed, reduce is eager, not lazy. On Tue, Apr 15, 2014 at 9:25 AM, Alex Vzorov wrote: > Hi, Cecil. > > The difference is that doseq is used to produce side-effects, which is > idiomatic, which is exactly what you did. When using doseq you can be > sure that it's body will evalua

Re: Helping newcomers get involved in Clojure projects

2014-04-15 Thread Gary Trakhman
Is there a generalized framework we can use for such 'codeacademy' sites? The closest thing that already exists I think is 4clojure, perhaps adding a tracks-navigation sort of thing would address that specific need? Though, I think my criticism with these things, is the best way to learn really de

Re: Why I'm giving Clojure a try

2014-04-16 Thread Gary Trakhman
What's harder than parentheses is the fact that any sort of semantics can be hidden under simple words in the call position, and everything looks the same. It changed how I read code, and it took a while to get used to that. I wonder if there's a study somewhere on the ergonomics of lisp. Code d

Re: Code snippets to attract new users

2014-04-18 Thread Gary Trakhman
I think doing some XML manipulation with clojure.data.xml, tree-seq and basic data structures shows a lot of the benefits in a little bit of code, and is pretty persuasive in my experience. This thing correlates paths from openstreetmap via unique node-ids to give you a way to find intersecting ro

Re: How to import under an alias?

2014-04-19 Thread Gary Trakhman
Clojure namespaces do not interop with java objects like that except for the 'import' statement. The best you can do: (import '[javax.swing JOptionPane]) (JOptionPane/showMessageDialog nil "Hello Clojure") On Sat, Apr 19, 2014 at 1:34 PM, Ismael VC wrote: > Hello everyone! I'm reading the clo

Re: What's clojure killer app? I don't see any.

2014-04-19 Thread Gary Trakhman
Clojure's killer app is immutable datastructures. Libraries can interoperate extremely easily because their interface is described with simple data structures. What's Java got for this? Spring? Design Patterns? On Sat, Apr 19, 2014 at 2:47 PM, James Reeves wrote: > Why does Clojure need a sin

Re: How to import under an alias?

2014-04-19 Thread Gary Trakhman
There's no drawback. On Sat, Apr 19, 2014 at 8:49 PM, Ismael VC wrote: > Thanks Gary! > > My intention is to have an alias, so making a new function, seems to be > the best option: > > (defn dialog > "Shows a dialog and asks for confirmation." > [message] > (javax.swing.JOptionPane/showMe

Re: lein uberjar much faster as lein run

2014-04-22 Thread Gary Trakhman
https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/project.clj#L415 TieredCompilation is the relevant one. On Tue, Apr 22, 2014 at 10:01 AM, Jony Hudson wrote: > I recall reading that `lein run` uses JVM options optimised for startup > time, not performance

Re: Books for learning Clojure

2014-04-22 Thread Gary Trakhman
JoC is like SICP, just really worth doing, not necessarily immediately practical. On Tue, Apr 22, 2014 at 3:16 PM, Plínio Balduino wrote: > Exactly, Thiago. > > I just understood Clojure after dive into Clojure. The books helped a lot, > but alone they are almost useless. > > Plínio > > > On Tue

Re: Which linux distro has intelij ?

2014-04-22 Thread Gary Trakhman
In general, there's always a mismatch between linux package managers and the realities of java stuff. So, I use apt-get (in ubuntu) to install java itself, and I throw everything else java-related (maven, ant, eclipse, whatever) in $HOME/opt, with symlinks to $HOME/bin (that's also where I put the

Re: Clojure cons vs. conj

2014-04-24 Thread Gary Trakhman
Conj is polymorphic on its first argument. If you pass it a vector, it'll add to the back, if a list, the front. The collection is responsible for deciding the most efficient way to add an element. Cons always adds to the front, creating a linked-list node pointing to the rest. Also, cons takes

Re: Clojure cons vs. conj

2014-04-24 Thread Gary Trakhman
k.How should I do? > Another question: why clojure need both cons and conj? In mit-lisp cons > just do all things. > > > On Thursday, April 24, 2014 11:12:49 PM UTC+8, Gary Trakhman wrote: > >> Conj is polymorphic on its first argument. If you pass it a vector, it'll >

Re: Clojure cons vs. conj

2014-04-24 Thread Gary Trakhman
Well, maybe I shouldn't bash MIT-scheme unintentionally :-). I bet some people use it for serious stuff, and I have no bad experiences with it. On Thu, Apr 24, 2014 at 11:33 AM, Gary Trakhman wrote: > MIT-lisp is more for teaching than industrial use.. > > We also have hash-maps,

Re: Improving pprint behavior for anonymous functions

2014-04-25 Thread Gary Trakhman
That's not going to work, all the return classes of partial are the same class. On Fri, Apr 25, 2014 at 5:26 PM, Greg D wrote: > I don't know if this is considered good Clojure, but you could define a > print-method within a macro to set up the normal string representation for > the partial fun

Re: Improving pprint behavior for anonymous functions

2014-04-25 Thread Gary Trakhman
; #'user/p10 > user=> (class p10) > clojure.core$partial$fn__4196 > > user=> p6 > (partial + 1 2 3) > user=> p10 > (partial + 1 2 3 4) > user=> (p6 100) > 106 > user=> (p10 100) > 110 > > On Friday, April 25, 2014 2:33:50 PM UTC-7, Gary Trakhman wro

Re: Improving pprint behavior for anonymous functions

2014-04-25 Thread Gary Trakhman
fn__4194 > user=> (def p10 (partial* + 1 2 3 4)) > #'user/p10 > user=> (class p10) > clojure.core$partial$fn__4196 > user=> p6 > (partial + 1 2 3) > user=> p10 > (partial + 1 2 3 4) > user=> (p6 100) > 106 > user=> (p10 100) > 110 > > On Fr

Re: Kwargs vs explicit parameter map for APIs?

2014-04-25 Thread Gary Trakhman
If it's more than a few parameters, I prefer maps.. It enables the possibility of things like merge. On Fri, Apr 25, 2014 at 6:56 PM, Andrey Antukh wrote: > Hi! > > I have the same doubt! > > However, At this time, I prefer use a explicit map instead keywords, > because for me is much clear th

Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-26 Thread Gary Trakhman
This is a lovely idea. I think prismatic schema is one well-accepted way to document data shapes, but it's expected to be used inline. It would be nice to have flexibility in what description systems are used in addition to flexibility of where the docs live. I agree that being able to see and re

Re: Update

2014-04-28 Thread Gary Trakhman
Seen: https://github.com/clojure/tools.emitter.jvm ? Here's the actual ASM emit: https://github.com/clojure/tools.emitter.jvm/blob/master/src/main/clojure/clojure/tools/emitter/jvm/transform.clj On Mon, Apr 28, 2014 at 5:43 PM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > ---IDEA---

Re: Update

2014-04-29 Thread Gary Trakhman
The hard part with other runtimes will be details around things like garbage collection for the implementation of persistent data structures. Clojurescript is a better example of how this is done since most of the impls are implemented in the language itself, different from clojure-proper. Grante

Re: multiple browsers, live.js -> repl

2014-04-29 Thread Gary Trakhman
It's possible, if 'possible' includes the possibility of writing some extensions to austin to eval across multiple sessions :-). On Tue, Apr 29, 2014 at 8:43 AM, Timothy Washington wrote: > Hey, > > I haven't tried live.js. But these tools might be of interest. > >- Austin

Re: Kwargs vs explicit parameter map for APIs?

2014-04-30 Thread Gary Trakhman
I think they're unaware of the change, as it resulted from a recent conversation on IRC that same day, where sentiment indicated that kwargs are generally more trouble than they're worth and there's still confusion around it. What started it: the example of keys-destructuring on a list in a let bi

Re: twitter-api and streaming calls

2014-05-01 Thread Gary Trakhman
I fixed this in my implementation about a week ago, have a look: Basically, JSON might be split across multiple chunks. You can assemble it back with a PipedReader/Writer and then use cheshire's lazy seq. https://github.com/gtrak/dashboard/blob/master/src/gtrak/dashboard/twitter.clj#L94 On Thu

Re: twitter-api and streaming calls

2014-05-01 Thread Gary Trakhman
Oh, nice, I was concerned about reconnections and backfill issues, if I have to change anything substantial again I'll reimplement on top of the java api that provides this out of the box. On Thu, May 1, 2014 at 9:13 PM, Andrew Fitzgerald < andrewcfitzger...@gmail.com> wrote: > I had the same (v

Re: Converting sequence from sort into a list

2014-05-02 Thread Gary Trakhman
I believe what he wants is a persistentlist. You could get one from (apply list) or more succinctly/esoterically (list* ..) Sort returns a seq view over the array returned by java.util.Array.sort() (defn sort "Returns a sorted sequence of the items in coll. If no comparator is supplied, use

Re: Converting sequence from sort into a list

2014-05-02 Thread Gary Trakhman
Ah, scratch that, list* returns a seq as well. On Fri, May 2, 2014 at 11:07 AM, Gary Trakhman wrote: > I believe what he wants is a persistentlist. You could get one from > (apply list) or more succinctly/esoterically (list* ..) > > Sort returns a seq view over the array

Re: Achieving structural sharing when composing data

2014-05-04 Thread Gary Trakhman
Have you looked at core.memoize, which uses core.cache under the hood? It allows for pluggable caching strategies that might suit your use-case. https://github.com/clojure/core.memoize On Sat, May 3, 2014 at 10:27 PM, Mike Fikes wrote: > Are there common techniques or idioms for achieving stru

Tools.nrepl middleware-dependency sorting issues

2014-05-04 Thread Gary Trakhman
... inspired this workaround, is there a better way? Essentially, :expects and :requires are breaking the sort order when they shouldn't, causing certain middlewares to just be in totally the wrong place. I couldn't find the pattern after staring at for a bit. Since leiningen calls linearize-mid

Re: Tools.nrepl middleware-dependency sorting issues

2014-05-04 Thread Gary Trakhman
interruptible-eval pr-values wrap-load-file add-stdin wrap-stacktrace session wrap-inspect wrap-classpath wrap-trace) Which means nothing hits pr-values, which means everything breaks :-). On Sun, May 4, 2014 at 9:47 PM, Gary Trakhman wrote: > ... inspired this workaround, is ther

Re: Clojure compiled without Eval

2014-05-05 Thread Gary Trakhman
There's a GSOC project to this effect: http://dev.clojure.org/display/community/Project+Ideas#ProjectIdeas-LeanJVMRuntime Reid McKenzie's going to be working on it. On Mon, May 5, 2014 at 1:06 PM, Andrew Stine wrote: > I'm wondering if there is a way to generate Clojure executables/jars > with

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-05 Thread Gary Trakhman
Sometimes you do want a mutable thing with thread-local binding, noir does this for it's mutable session-flash stuff: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/session.clj#L95 I don't really recommend the approach, but I could see it being convenient. On Mon, May 5, 2014 at 1

Re: CompilerException java.lang.IllegalArgumentException: Mismatched argument count to recur

2014-05-06 Thread Gary Trakhman
Last + butlast? On Tuesday, May 6, 2014, Roelof Wobben wrote: > Found the answer : > > (defn secondlast [coll] > (let [number 0 > counter (- (count coll)2) ] > (loop [coll coll counter counter number number] > (if (= counter number) > (first coll) >

Re: Functional programming and security

2014-05-06 Thread Gary Trakhman
My 'Network Security' Professor once said to the class, 'There is no security without physical security'. Protecting data from being read in memory means you've already lost. On Tue, May 6, 2014 at 5:19 AM, Luc Prefontaine wrote: > Reading this thread convinced me. > I will not write any infor

Re: Nominalization

2014-05-09 Thread Gary Trakhman
Never thought of it that way, I always verb the noun. Did you learn about reductions, yet? It's clear that the name corresponds to the intended output at least in that case. On Friday, May 9, 2014, Mike Fikes wrote: > I am new to functional programming and caught myself reading “reduce” as > “t

Re: Gradle: how to deal with it

2014-05-10 Thread Gary Trakhman
I'm in the process of writing up a procedure for the latest cider with alternative repls. Here's the relevant bits of how leiningen starts a repl: https://github.com/technomancy/leiningen/blob/master/src/leiningen/repl.clj#L116 https://github.com/technomancy/leiningen/blob/master/src/leiningen/rep

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
Did you try to clean out ~/.lein/profiles.clj? On Thu, May 15, 2014 at 2:34 PM, Mark Watson wrote: > I'm running Leiningen on CentOS 6.5. Everything was working fine, and > today when I try "lein run" it just hangs. It takes about 15 minutes for > "lein version" to return. > > The project works

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
ving ~/.m2 >> >> On 15 May 2014, at 20:56, Mark Watson wrote: >> >> I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen >> files, tried with a fresh install, still no luck. >> >> >> >> On Thursday, May 15, 2014 2:38:34

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
Oh yea, GC churn can take up a lot of time. The illusion of 'infinite memory' :-). On Thu, May 15, 2014 at 3:47 PM, Armando Blancas wrote: > I've had this problem and I suspect is low memory. It happened often with > an old box with 1G running Fedora 20, but I've also seen it with my laptop > i

Re: I'm reading the book "Web Development with Clojure...". On page 4 I entered the command 'leon ring server' and it returns an error message: 'ring' is not a task. See 'lein help'.

2014-05-16 Thread Gary Trakhman
you have to be inside the guestbook dir. On Fri, May 16, 2014 at 7:50 PM, patrick lynch wrote: > I'm going thru the book "Web Development with Clojure...". > I entered the following commands: > > lein new compojure-app guestbook > > It ran ok. > > I then ran: > > > lein ring server > > It retu

Re: Client side tools for Clojure web app (back end questions as well, especially Pedestal)

2014-05-20 Thread Gary Trakhman
Om/Reagent are wrappers over React.js with slightly different approaches, and are the bees-knees. The React.JS rendering approach is a great idea in general, and a great fit for Clojurescript, and discussed elsewhere: http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/ I've tri

Re: stderr with repl development

2014-05-21 Thread Gary Trakhman
I use this trick pretty much all the time. (alter-var-root #'*out* (constantly *out*)), same for *err*, though I'll wire *err* to *out* (future (println "blah3")) works because *out* is conveyed to the future via binding-conveyor-function. That's not the case in the first. On Wed, May 21, 201

Re: stderr with repl development

2014-05-21 Thread Gary Trakhman
s binding), but *out* shows up fine. On Wed, May 21, 2014 at 5:38 PM, Brian Craft wrote: > > > On Wednesday, May 21, 2014 2:10:06 PM UTC-7, Gary Trakhman wrote: >> >> I use this trick pretty much all the time. >> >> (alter-var-root #'*out* (constantly

Re: stderr with repl development

2014-05-21 Thread Gary Trakhman
you probably want to use set! for that instead of alter-var-root. On Wed, May 21, 2014 at 5:44 PM, Gary Trakhman wrote: > Ah, so in my case, I run that snippet when I want *other* threads to write > to stdout/stderr buffers instead of showing up in the terminal. In your > case,

Re: ANN: [prismatic/plumbing 0.3.0] release adds ClojureScript support

2014-05-29 Thread Gary Trakhman
I was also wondering about this, several people on the #reactjs IRC channel were wondering why they were getting e-mails and had no recollection of signing in to prismatic. On Wed, May 28, 2014 at 9:21 PM, Atamert Ölçgen wrote: > Whoever thought it would be a good idea to farm emails (possibly

Re: Is it the right Clojure group for a newbie

2014-06-02 Thread Gary Trakhman
Check out the 'online resources' section: http://clojure.org/getting_started On Mon, Jun 2, 2014 at 5:36 PM, wrote: > All, >If this is the right Clojure group for a newbie, I would like to ask > for the best online resources to begin with. I am new to programming, > having recently switched

Re: Top-down code in namspaces

2014-06-03 Thread Gary Trakhman
It takes a while (a couple months) to get used to reading things upside-down, but I wouldn't want to go back. Knowing with certainty that some called method is defined above in the compilation strategy simplifies code-reading and comprehension by minimizing where you have to look, and it also make

Re: Checking: Java 8 and Clojure

2014-06-03 Thread Gary Trakhman
I've used Java 8 for testing on a large codebase with Clojure 1.5.1, works fine. On Tue, Jun 3, 2014 at 12:17 PM, Dave Tenny wrote: > The clojure site says 1.6.0 is supported with java 6 and higher. > > I just wanted to double check whether people have been using it with Java > 8 and whether it

Re: Top-down code in namspaces

2014-06-03 Thread Gary Trakhman
I just turn the monitor upside-down ;-). On Tue, Jun 3, 2014 at 1:50 PM, Luc Prefontaine wrote: > Yeah, it's certainly hard, just tried it, > blood pressure increases in the head > and my eyes were bulging out of their > sockets. > > A bit easier using these chairs > that allow you to flip upsi

Re: loop/recur being functional

2014-06-03 Thread Gary Trakhman
Have you considered the similarity between loop-recur and sequence operations? IE, tail-recursion turns the call stack into a sequence of states. The nice trick you can play in clojure is to reify this sequence as a lazy sequence. (take 5 ((fn this-fn [last] (cons (inc last) (lazy-seq (this-fn (

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Gary Trakhman
Twitter's a more organic way to do this. Your followers can read it, decide to retweet or not. On Thu, Jun 12, 2014 at 5:37 PM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > Sorry if you feel that way. Thought i could share my thoughts and start an > interesting discussion. > That is

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Gary Trakhman
post their blogs here regularly. Because each message is a > tiny little distraction. I'm willing to pay the price because when a really > cool library is announced for example, I get a big reward. Let's keep the > benefit/cost ratio, time-wise & attention-wise, high. > > &

Re: macro question

2014-06-16 Thread Gary Trakhman
Yes, you need to revisit the fundamentals of macros. Macros are functions that take in data (the forms), and return data (possibly altered forms). In your example, you're checking if the expression itself, a list or some kind of value or something is equal to the value 0, at compile-time, then yo

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Gary Trakhman
Agent send operations inside a transaction get queued up and don't actually get sent until the transaction commits, that's probably what you want, it's meant for side-effects. On Tue, Jun 17, 2014 at 5:43 PM, Hussein B. wrote: > Hi, > > I have a ServerSocket that stores the client ID and the cl

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Gary Trakhman
> be delivered before [4 5]? > > I'm talking about production and really concurrent system. > > > On Tuesday, June 17, 2014 11:45:52 PM UTC+2, Gary Trakhman wrote: > >> Agent send operations inside a transaction get queued up and don't >> actually get sent

<    1   2   3   4   5   >