Re: Using xlisp assoc-lists in clojure

2013-11-20 Thread Gary Trakhman
'Relatively bad at lists' ? I think the thing that clojure's intentionally bad at is arbitrary nested mutation, so you're forced to be recursive about things and return values (this is how update-in and assoc-in are implemented), but this has nothing to do with data type. Clojure provides simple

Re: Clojure style

2013-11-25 Thread Gary Trakhman
Yes, I'd consider this bad style, for one, you don't get the arglists metadata showing the names of variables during a repl session. That metadata is on the var, and not the function itself. I'm not familiar with Math/pow's function signature off the top of my head. I would consider it only in

Re: How would I do this in Clojure?

2013-12-05 Thread Gary Trakhman
This is possible with atoms and refs and such, but I wonder if the use-case can't simply be handled with existing seq functions? This is going against the grain of clojure's FP approach. Since no one's mentioned it yet, if it's possible for the caller of this function to be defined in terms of

Re: Is Clojure right for me?

2013-12-26 Thread Gary Trakhman
Encapsulation: a) I don't miss it. b) Functions/private-namespaces/maps/deftypes can serve this purpose. Inheritance: Clojure provides ad-hoc hierarchies, which give you the desired tree structure of a type-hierarchy, but it is decoupled from implementation details. You can inherit

Re: Is Clojure right for me?

2013-12-26 Thread Gary Trakhman
If I were to implement something (complex enough) in C and C++ the differences between my implementations would be far from superficial. Those are both inexpressive in different ways. In my opinion java is closer to lisp than C++, given garbage collection, closures (even faked by objects),

Re: Namespaces [was Re: Is Clojure right for me?]

2013-12-27 Thread Gary Trakhman
I can think of a couple more alternatives to consider: ;; Turns out you don't need vars for everything. (let [state {:some :data}] (defn do-stuff [] (func-of state))) ;; Shifts some burden to the client code (defn do-stuff-fn [state] (fn [] (func-of state)) The issue as I see it is a

Re: Is Clojure right for me?

2013-12-27 Thread Gary Trakhman
brain-dump TLDR: I like clojure's costs-to-benefits.. and it's successful because it's what the industry needs. I wouldn't say lisp family langs are the 'best' languages, but I would say its tradeoffs maximize the power of the individual, which interests me since I am one :-). Talking about

Re: protocols and overloading

2013-12-30 Thread Gary Trakhman
There's been a trend against overuse of inheritance, first with java removing multiple-inheritance and the various private/protected nuanced inheritances, then generally accepted advice like 'prefer composition over inheritance'. Some people were still feeling the pain, and some of those are now

Re: Migrating from nrepl.el to cider

2013-12-31 Thread Gary Trakhman
I've seen the pprint error on startup often. On Tue, Dec 31, 2013 at 9:47 AM, mwillson cdr@gmail.com wrote: Folks, I've recently migrated to cider on two platforms, Mac OS X (Mavericks) and Debian Wheezy. With each, I encountered one issue, but different in each case. If these are

Re: some clojure experience

2013-12-31 Thread Gary Trakhman
hallucinated interfaces : I like it :-). I think of it as 'data shapes', or implicit contracts. The added value/cost over explicit types is it's open to interpretation and the reader's subjectivity. Let me tell you, when you work with large amounts of uncommented clojure code, the flexibility

Re: Future of performant software: cores or memory?

2014-01-01 Thread Gary Trakhman
It depends on your workload and use-cases, and you could fill many textbooks with a discussion of the tradeoffs, but I can think of some rules of thumb that point in clojure's favor. The most essential metric for me to see has been Amdahl's Law: http://en.wikipedia.org/wiki/File:AmdahlsLaw.svg

Re: Require namespace

2014-01-02 Thread Gary Trakhman
There's a reasonable blog post here on the matter: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html It's a bit complicated to regurgitate it all in a mailing list response :-). On Thu, Jan 2, 2014 at 8:33 AM, jianghui8...@gmail.com

Re: Memory usage of basic Luminus web app

2014-01-02 Thread Gary Trakhman
Luminus isn't doing anything bad here, and 180MB is actually pretty small for a clojure heap. I hit the limits of my laptop's 8GB of memory recently while running a number of repls simultaneously, with heaps over 700MB*4 or so. The simplest win for me was to enable the G1 collector by default

Re: Clojure deployment questions w.r.t. jars, clojure source files, compiled class files

2014-01-07 Thread Gary Trakhman
AOT in my experience is a little dicey and complicated. On Tue, Jan 7, 2014 at 7:26 PM, Dave Tenny dave.te...@gmail.com wrote: So if I sample some clojure jars in my local maven .m2 directory, most of the jar files have only clojure code, and a project.clj. If I look at the org.clojure

Re: Clojure/Luminus memory footprint

2014-01-08 Thread Gary Trakhman
you're still missing some basics about java memory management. In another thread, I mentioned the java VM will take more memory than it needs, that is because it prioritizes throughput over footprint. There are knobs for all of that. It's not clear what's taking so much memory, but it's

Re: Clojure/Luminus memory footprint

2014-01-08 Thread Gary Trakhman
11% byte[]11% int[] 6% main: char[] 24% byte[] 17% java.lang.object 14% java.util.TreeMap$Entry 10% java.io.ObjectStreamClass$WeakClassKey 10% int[] 6% Heap size: 366Mb Used heap: 85Mb gvim On 09/01/2014 04:32, Gary Trakhman wrote

Re: Clojure/Luminus memory footprint

2014-01-09 Thread Gary Trakhman
Heap figures to 14Mb and 13Mb but I now see these climbing to new heights while the app is completely idle. JVM and main are now both using 75Mb each and climbing. This does not inspire confidence for an app which is sitting idle. gvim On 09/01/2014 06:27, Gary Trakhman wrote: what

Re: Clojure/Luminus memory footprint

2014-01-09 Thread Gary Trakhman
and memory allocation doesn't seem to be necessary with Elixir on the Erlang VM which borrows a lot from Clojure yet retains the syntax style of Ruby. gvim On 10/01/2014 01:46, Gary Trakhman wrote: Yes, this is exactly the behavior I was expecting. 14Mb is your actual memory footprint

Re: Clojure/Luminus memory footprint

2014-01-09 Thread Gary Trakhman
to consider all the pros/cons before locking onto a single one (like perceived memory usage). Timothy On Thu, Jan 9, 2014 at 8:24 PM, Gary Trakhman gary.trakh...@gmail.comwrote: Elixir's pretty neat. Apologies for the jvm :-). On Thursday, January 9, 2014, gvim wrote: After careful consideration

Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?

2014-01-10 Thread Gary Trakhman
I loved the 'Joy of Clojure' as my first clojure book, but it was a little over my head at the time I started reading it, so it took subjectively quite a while to internalize everything. Since I didn't need to 'get stuff done' immediately, I think, in the end, it's great to learn things with such

Re: ClojureScript integration with Emacs/Cider ?

2014-01-11 Thread Gary Trakhman
In response to this thread, I've hacked lein-cljsbuild to dump the compiler state, and built a version of autodoc to parse it and generate api docs. I'm trying to figure out how exactly cider and austin will talk to each other so I can make it happen, and I approach that I'm considering now is to

Re: ClojureScript integration with Emacs/Cider ?

2014-01-13 Thread Gary Trakhman
I've released a cljs port of clojure-complete: Here's the mailing list announcement, also inlined. https://groups.google.com/forum/#!topic/clojurescript/Dt1s4laHFXc cljs-complete, A Clojure library designed to auto-complete clojurescript based on cljs compiler state. - With leiningen:

Re: ClojureScript integration with Emacs/Cider ?

2014-01-13 Thread Gary Trakhman
session state). Ac-nrepl shouldn't be able to eval code, that means it's being coupled to the JVM state, which won't do for cljs or other sorts of repls-on-repls. On Mon, Jan 13, 2014 at 9:03 AM, Gary Trakhman gary.trakh...@gmail.comwrote: I've released a cljs port of clojure-complete: Here's

Re: ClojureScript integration with Emacs/Cider ?

2014-01-13 Thread Gary Trakhman
design decisions. -- Cheers, Bozhidar On Monday, January 13, 2014 at 4:55 PM, Gary Trakhman wrote: On talking to Chas, https://github.com/cemerick/piggieback/issues/22 it seems like the right approach is to reify ac-nrepl's use of eval into a real complete op, and reimplement it to use

Re: Effects of diving into Clojure

2014-01-14 Thread Gary Trakhman
Maybe don't switch mindset? Write code that looks like idiomatic ruby but has what appears to rubyists as QWAN. I think it's possible and maybe even desirable for bad things to feel more foreign when your understanding increases. On Tue, Jan 14, 2014 at 2:01 PM, gvim gvi...@gmail.com wrote: I

Re: ClojureScript integration with Emacs/Cider ?

2014-01-18 Thread Gary Trakhman
as this stuff is finalized, I'll package everything up nice and make a first release. On Mon, Jan 13, 2014 at 10:21 AM, Gary Trakhman gary.trakh...@gmail.comwrote: Austin's lein-plugin already manipulates project middlewares, so that's an easy target. Onward! On Mon, Jan 13, 2014 at 10:10 AM

Re: Security implications of code is data/data is code

2014-01-21 Thread Gary Trakhman
Not every input is through the reader. For instance, Integer.parse takes a string argument and returns a java object. So there's no security problem there, unless it's a problem with the Integer class itself. Another piece of the puzzle, Clojure needs a way to represent objects and code as

Re: ClojureScript integration with Emacs/Cider ?

2014-01-24 Thread Gary Trakhman
(my knowledge of it is pretty basic). I guess this was something to do with piggieback, right? -- Cheers, Bozhidar On Saturday, January 18, 2014 at 8:56 PM, Gary Trakhman wrote: Bozhidar, I had to slightly modify cider-interaction.el to make autocomplete work for cljs. --- cider

Re: Coverage tools in Clojure

2014-02-04 Thread Gary Trakhman
In clojure, generally I've found Unit-tests are often significantly harder to write than the corresponding implementing code, idiomatic code rarely has silly problems, and integration tests are enough to shake out bad behavior. So, the end result is constraining our codebase at API boundaries

Re: how to use the G1 garbage collector

2014-02-07 Thread Gary Trakhman
I do it like this: in my .bashrc export JVM_OPTS=-XX:+UseG1GC export LEIN_JVM_OPTS=-XX:+UseG1GC You can verify that it's working by checking jvisualvm's view of the jvm-opts on the relevant processes. Running it system-wide has given me reduced memory-pressure on my lappie with no downside.

Re: What's the status of clojure for Android?

2014-02-08 Thread Gary Trakhman
if Qt supports js's eval, then it's also possible to support a repl. On Sat, Feb 8, 2014 at 10:29 PM, Zach Oakes zsoa...@gmail.com wrote: That might work for some people, but as you mentioned, you wouldn't get to build your app in a REPL. Also, you'd lose access to the concurrency features

Re: How would I write it with concurrency

2014-02-10 Thread Gary Trakhman
(apply concat (session))? or consider mapcat.. if the thing behind session needs to be concurrent, it needs to be concurrent at that point, not in the code that calls it. There's no way to generally make it concurrent from above unless you know more about what's happening below. On Mon, Feb

Re: How would I write it with concurrency

2014-02-10 Thread Gary Trakhman
Reducers might be a good fit if you want to parallelize a concat. http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html On Mon, Feb 10, 2014 at 4:28 PM, Gary Trakhman gary.trakh...@gmail.comwrote: (apply concat (session))? or consider mapcat

Re: ANN: ring-http-response, ring-Swagger, ring-swagger-ui compojure-api

2014-02-16 Thread Gary Trakhman
I was inches away from reinventing something like this for our company's codebase. Maybe you saved us the trouble :-). Will definitely check it out. On Sun, Feb 16, 2014 at 3:20 PM, Tommi Reiman tommi.rei...@gmail.comwrote: Hi all. We here at Metosin have been developing and using a bunch

Re: Latest web framework for clojure

2014-02-25 Thread Gary Trakhman
Luminus is a batteries-included leiningen project template that includes compojure and other things to get started. http://www.luminusweb.net/ On Tue, Feb 25, 2014 at 8:18 PM, haosdent haosd...@gmail.com wrote: Maybe you could try compojure. On Wed, Feb 26, 2014 at 9:13 AM, Aravindh S

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 wee@gmail.com wrote: Good point, Thanks a lot. Shall we improve the str

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 lspec...@hampshire.edu wrote: FWIW I'm not crazy about these suggestions because they seem to me to be mostly

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

Re: More functional Quil

2014-03-10 Thread Gary Trakhman
, 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 gary.trakh...@gmail.comwrote: FWIW, I've got an example of a decoupled update/draw loop here: https://github.com/gtrak/quilltest/blob/master/src

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

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

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 rao...@gmail.com 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

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 rao...@gmail.com 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

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

2014-03-14 Thread Gary Trakhman
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 Trakhman gary.trakh...@gmail.comwrote

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 rao...@gmail.com 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

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

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 andy.coolw...@gmail.com wrote: I've never heard of imperative model. I'm

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 jesseluisd...@gmail.com 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

Re: How should I begin this project?

2014-03-20 Thread Gary Trakhman
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 11:47 AM, Gary Trakhman gary.trakh

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

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 rao...@gmail.com wrote:

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.

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

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 jules.gosn...@gmail.com 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!

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 cmhowa...@alaska.eduwrote: Hi. I'm still fairly new to Clojure. I was wondering: What's the easiest way to make a

Re: generators...?

2014-03-26 Thread Gary Trakhman
repeatedly and get a different answer each time. On Wed, Mar 26, 2014 at 1:05 PM, Gary Trakhman gary.trakh...@gmail.comwrote: 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

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.com Note that

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 cmhowa...@alaska.eduwrote: 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

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 a.webb@gmail.com wrote: On Tuesday, April 1, 2014 11:00:37 AM UTC-5, Andreas Liljeqvist wrote: Is there any good reason for not

Re: REPL: viewing data structures containing infinite lists

2014-04-01 Thread Gary Trakhman
*print-length*. Basically it seems less harmful to set it to a nice value by default(42?) than possible locking up the REPL. On Tue, Apr 1, 2014 at 2:49 AM, Gary Trakhman gary.trakh...@gmail.com wrote: http://clojuredocs.org/clojure_core/clojure.core/*print-length* On Mon

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

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

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))

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

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 gary.trakh...@gmail.comwrote: I'm currently running into a bug where it seems like channels aren't being closed down like

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

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 txrev...@gmail.com wrote: Hi, * I am aware of core.async. However, I don't like the fact that (go ... )

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. -- You

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

2014-04-08 Thread Gary Trakhman
#(remove (fn [x](= (:id x) id)) %)) From your statement 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 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
schrieb 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

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

2014-04-08 Thread Gary Trakhman
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 3 4] [0] (constantly 1)) [1 2 3 4] (update-in [[] 2 3 4] [2] (constantly 1)) [ [ ] 2 1 4] (update-in [[] 2 3 4] [1] (constantly 1)) [ [ ] 1 3 4

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 gary.trakh...@gmail.comwrote: My response had the assumption that this is an example of an X-Y problem :-). If you want to literally do what

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

2014-04-08 Thread Gary Trakhman
, updates are O(log32 n), which is much better. On Tue, Apr 8, 2014 at 7:18 PM, Gary Trakhman gary.trakh...@gmail.comwrote: 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 gary.trakh

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

Re: My experiments with concurrent programming

2014-04-12 Thread Gary Trakhman
is what executors need. On Sat, Apr 12, 2014 at 11:19 AM, Gary Trakhman gary.trakh...@gmail.comwrote: 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

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 cldwester...@gmail.comwrote: 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

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 gary.trakh...@gmail.comwrote: Oh man, please consider using leiningen. It's a whole new world :-) http://leiningen.org/ On Sat, Apr 12, 2014 at 11:49 AM

Re: My experiments with concurrent programming

2014-04-12 Thread Gary Trakhman
, 2014 at 3:18 PM, Cecil Westerhof cldwester...@gmail.comwrote: 2014-04-12 17:19 GMT+02:00 Gary Trakhman gary.trakh...@gmail.com: 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

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

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 alex.vzo...@gmail.com 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

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

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

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

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 ismael.vc1...@gmail.com wrote: Hello

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 ja...@booleanknot.com wrote: Why

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 ismael.vc1...@gmail.com 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]

Re: Clojure/West 2013 videos?

2013-03-25 Thread Gary Trakhman
I've volunteered on the pycon AV team, in 2009, it's 1000x more work than what you described further up in the thread, a minimum wage worker holding something steady. It requires a lot of coordination, and I think the cost to the conference would be much higher than InfoQ as well. On Monday,

ANN: no.disassemble, a runtime bytecode disassembler

2013-03-30 Thread Gary Trakhman
I made a little proof of concept last night. You could always look at bytecode that clojure emits in few ways, you can either hack the compiler yourself, or force AOT in your project and use javap. The first approach is a bit intrusive, and the second has a somewhat annoying turnaround time,

Re: ANN: no.disassemble, a runtime bytecode disassembler

2013-03-30 Thread Gary Trakhman
https://github.com/gtrak/no.disassemble/ On Saturday, March 30, 2013 9:06:25 AM UTC-4, Gary Trakhman wrote: I made a little proof of concept last night. You could always look at bytecode that clojure emits in few ways, you can either hack the compiler yourself, or force AOT in your project

Re: ANN: no.disassemble, a runtime bytecode disassembler

2013-03-31 Thread Gary Trakhman
? On Saturday, March 30, 2013 2:31:36 PM UTC-4, Hugo Duncan wrote: Gary Trakhman gary.t...@gmail.com javascript: writes: I made a little proof of concept last night. You could always look at bytecode that clojure emits in few ways, you can either hack the compiler yourself, or force AOT

Re: Good Clojure style?

2013-04-14 Thread Gary Trakhman
I started writing clojure full-time a year and a half ago. At first, it was a terrifying freedom that I could only write a few lines of code a day, and each line was so packed with meaning it makes your head spin. It took an incredibly long time to understand the terseness of code. Maybe

Re: Clojure on top of ObjC?

2013-04-23 Thread Gary Trakhman
It's already possible via https://github.com/takeoutweight/clojure-scheme Gambit scheme provides objective-C interop. The author demonstrated this stuff at Clojure/West this year. One difference between your proposed approach is it's both compiled and highly optimized. On Tue, Apr 23, 2013

Re: Clojure on top of ObjC?

2013-04-23 Thread Gary Trakhman
as an embedded scripting language inside an ObjC app. On Tue, Apr 23, 2013 at 2:50 PM, Gary Trakhman gary.trakh...@gmail.com wrote: It's already possible via https://github.com/takeoutweight/clojure-scheme Gambit scheme provides objective-C interop. The author demonstrated this stuff at Clojure

Re: How to import classes from a runtime-defined ClassLoader?

2013-04-24 Thread Gary Trakhman
There's a lib for this, we've used it in anger, and it seems to work: https://github.com/flatland/classlojure/blob/master/src/classlojure/core.clj On Wed, Apr 24, 2013 at 12:01 AM, tbatchelli tbatche...@gmail.com wrote: This worked for me: (with-bindings {clojure.lang.Compiler/LOADER dcl}

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Gary Trakhman
You could come up with definline yourself by thinking about what inlining is and wrapping things in macros, it seems to me the real problem definline solves is to also be able to use the output as a function, which is more about keeping convenience than performance gains. I think the people who

Re: Do functions never get inlined by jvm?

2013-04-25 Thread Gary Trakhman
Good vinyls are considered higher quality by audiophiles, because there are less stages in between the mastering and amplification. There is more potential of better performance. It can be considered a real-world case of inlining. On Thu, Apr 25, 2013 at 3:16 PM, Softaddicts

Re: What Slows Down clojure-hadoop?

2013-04-26 Thread Gary Trakhman
this doesn't quite make sense: Since Clojure is well-known for its concurrency feature, running in the same JVM should be out of question. All the concurrency features built in to clojure are concerned with things that happen in the same process, unless you consider things like 'making it easier

Re: What Slows Down clojure-hadoop?

2013-04-28 Thread Gary Trakhman
We use clojure on hadoop by using the Cascading framework, it would be hard to see the influence of clojure on performance because the code is complicated. But, that means clojure is used mostly to specify the Flow (a DAG construct) that Cascading provides. That's a way to use clojure that

  1   2   3   4   5   >