Re: lein cljsbuild once works, but another build method doesn't -- ?

2015-12-28 Thread Erik Price
The -cp flag should be passed a colon-separated list of entires to search for dependency code. Each entry in the list can be either a directory (in which case the contents of the directory must immediately contain Java or Clojure source files) or a JAR file. So the command you’re currently using

Re: Clojure Dev Environment

2015-10-05 Thread Erik Price
vim-fireplace lets you compile individual S-expressions into an existing nREPL (one in which the rest of your code is typically also loaded and available), so I typically make all my code changes right in the editor against the actual file I'm working on. Then I just compile the function I'm

Re: Origin for Clojure using the term 'vector' instead of 'array'?

2015-10-03 Thread Erik Price
I always assumed it was because vectors have similar properties to the classic java.util.Vector: they’re variable-length, contain heterogenous objects accessible by integer index, and safe for concurrent access from multiple threads: http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html

Re: Opinion on core.async vs callbacks in abstract APIs?

2015-06-02 Thread Erik Price
On Tue, Jun 2, 2015 at 3:17 AM, Christopher Small metasoar...@gmail.com wrote: Additionally, I feel it worth responding to some of Timothy's comments about the difficulty of getting a core.async centric API right. While I agree that in general (and particular with more complicated APIs) getting

Re: Opinion on core.async vs callbacks in abstract APIs?

2015-06-02 Thread Erik Price
Oh, so the events are for all intents and purposes infinite? On Tue, Jun 2, 2015 at 11:10 AM, Christopher Small metasoar...@gmail.com wrote: @Erik: I should clarify in this situation, the _user_ of the API would decide whether they want to stop listening to events. So there's not so much that

Re: separation of concerns w/o encapsulation

2015-05-14 Thread Erik Price
On Thu, May 14, 2015 at 12:14 PM, Sean Corfield s...@corfield.org wrote: In an environment where you can’t trust your co-workers(!), you certainly want to hide *mutable* data so they can’t modify your objects’ state. When you remove mutability, there’s a lot less damage they can do and they

Re: contains? on String

2015-05-13 Thread Erik Price
(get the char at index 4) \c e ​ On Wed, May 13, 2015 at 9:55 PM, Sam Raker sam.ra...@gmail.com wrote: I always assumed (contains? foo 2) worked because strings are arrays (i.e. vectors) of characters, on some level. -- You received this message because you are subscribed to the Google

Re: Anyone Worked with NW.js and ClojureScript

2015-04-07 Thread Erik Price
These are cool too: https://github.com/frankhale/hello-atom-shell https://github.com/oakmac/cuttle/ e On Tue, Apr 7, 2015 at 8:03 AM, JPatrick Davenport virmu...@gmail.com wrote: Well don't that beat all? Thanks. It looks good. If anyone else wants to add something, please do. On

Re: is ok use a blocking get !! at the end of sequence of async calls

2015-03-25 Thread Erik Price
There is no best approach for this. Yes, you do end up blocking the request thread, but that’s what needs to happen if you the response requires the value returned by the channel. You can’t return a response to the browser and then change it later when the channel sends its value. (You’d have the

Re: Border cases for doseq

2015-02-25 Thread Erik Price
Another way to structure this problem is as sequences: 1. Start with a sequence of tables. (show-tables db-spec) 2. Filter down to only the tables you care about. (filter my-pred tables-seq) 3. Take only the first of these. (take 1 filtered-tables-seq) 4. If there is a table, do

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Erik Price
We tried Korma but found it too limiting for our needs. Later, I saw this tweet: https://twitter.com/ibdknox/status/557236505639665664 We are currently using HoneySQL to generate SQL which then gets passed to clojure.java.jdbc. e ​ On Tue, Feb 24, 2015 at 9:04 AM, Colin Yates

Re: Is there a way to stop a long running expression in the REPL

2015-02-23 Thread Erik Price
Vim Fireplace https://github.com/tpope/vim-fireplace supports Ctrl-c without killing its REPL host. Highly recommended if you are a Vim user. e ​ On Sat, Feb 21, 2015 at 7:32 AM, Shawn Rasheed unsh...@gmail.com wrote: If it's the clojure repl this might work:

Re: core.async: Deprecated - this function will be removed. Use transducer instead

2015-02-18 Thread Erik Price
(let [out (async/chan 0 (map inc))] (async/pipe in out) out) Earlier in your email you mention printing, however. If you have I/O to perform (like printing), I’m told that you don’t want to do it in a transducer. You can use pipeline-async for this instead: (defn f [v ch] (async/go

Re: core.async -- lazy evaluation on take

2015-02-16 Thread Erik Price
Yes, the producer’s put will block until the consumer takes, but doesn’t this still involve an eager initial request (so that the producer will have something to put in the first place, so that it can block)? e ​ On Mon, Feb 16, 2015 at 5:52 PM, janpaulbultm...@googlemail.com wrote: Make the

Re: simple procedure for updating a value one level down

2015-01-26 Thread Erik Price
Many functions that affect keyed collections will work on vectors if you supply the numeric index as a key. e On Monday, January 26, 2015, Josh Stratton strattonbra...@gmail.com wrote: I'm new to clojure and FP in general. One thing that has always been a little confusing for me is working

Re: channels operations

2015-01-10 Thread Erik Price
Not sure if it’s “proper”, but you could just alts! twice on all three channels: (let [[_ p1] (alts! [player1-ch player2-ch timeout-ch]) [_ p2] (alts! [player1-ch player2-ch timeout-ch])] (cond (= p1 timeout-ch) No players played. (= p2 timeout-ch) (str p1 played, and the other

Prefer non-daemon threads in clojure.core.async/thread?

2015-01-07 Thread Erik Price
Howdy, I see that the ThreadFactory used by clojure.core.async/thread‘s Executor accepts a daemon parameter, to specify whether the threads are daemon or not. But from reading the source, I don’t see any obvious way to specify this for individual calls to clojure.core.async/thread. Is it

Re: beginner (fn) doubt

2015-01-03 Thread Erik Price
((fn [x] (* 5 x)) 5) is the same as (def my-function (fn [x] (* 5 x))) (my-function 5) ​ On Fri, Jan 2, 2015 at 8:13 PM, novato biofob...@gmail.com wrote: I choose clojure as my first programming language after some research. I am learning by doing Clojure Koans http://clojurekoans.com/

Re: Please critique my code (barber problem with core.async)

2015-01-02 Thread Erik Price
;(async/timeout (* 10 1000)) ;; not sure why this doesn’t work here, would make it portable to clojureScript I think Did you forget to use ! on that line? e ​ On Fri, Jan 2, 2015 at 11:04 AM, Thomas th.vanderv...@gmail.com wrote: Happy New to all of you!!! Recently I came across the

Re: [ClojureScript] Re: [ANN] cuerdas 0.1.0: A string manipulation library for clojure and clojurescript.

2014-12-24 Thread Erik Price
Note that there is precedent for this in clojure.string/blank? http://clojuredocs.org/clojure.string/blank_q. ​ On Wed, Dec 24, 2014 at 7:58 AM, Andrey Antukh n...@niwi.be wrote: Hi! Thank you very much! You are right about nil handling, it should be documented and proper handled. But

Re: core.async go-loop questions

2014-12-20 Thread Erik Price
Part of what makes core.async great is that you don't have to use atoms to communicate between threads in every case. For your case, I don't see what using an atom gets you. It seems like you could replace the atom with a channel, and put values on the channel whenever mail is sent. Your code will

Re: perform action after events stop for some period

2014-12-03 Thread Erik Price
) (recur) (apply f args))) will allow the go-loop to return when the channel is closed. On Monday, December 1, 2014 8:33:10 PM UTC-5, Erik Price wrote: Coincidentally, we recently wrote code to do something very similar. The following function will invoke f after

Re: perform action after events stop for some period

2014-12-02 Thread Erik Price
On Tue, Dec 2, 2014 at 12:22 PM, Brian Craft craft.br...@gmail.com wrote: It does seem like a single-thread solution would be better, not creating so many futures. Polling seems pretty crude, but I don't see another way of doing it with clojure abstractions. Maybe a pure java solution.

Re: perform action after events stop for some period

2014-12-01 Thread Erik Price
Coincidentally, we recently wrote code to do something very similar. The following function will invoke f after period milliseconds, unless a value is sent on events-ch, in which case the timeout is reset (and starts counting down again): (defn invoke-after-uninterrupted-delay ([period

Re: Naming Functions...

2010-02-04 Thread Erik Price
What kind of naming convention is appropriate for a function that operates on a sequence, and, as one of its return values, returns a new head for (or in other words a subsequence within) that sequence? For example, a function that consumes some portion of a stream. Or is it not conventional for a

Re: Domain Modelling

2010-02-01 Thread Erik Price
On Sun, Jan 31, 2010 at 10:33 PM, Barry Dahlberg barry.dahlb...@gmail.com wrote: Perhaps I'll write up my findings once the language stops intimidating me. At the moment I'm writing an account object.  I have some standard CRUD type functions which operate on a map behind the scenes.  I would

Re: Clojure Kata

2010-01-28 Thread Erik Price
Thanks Sean, this was a great exercise. I'm comfortable reading Clojure code, but writing it requires thinking differently from what I am used to. My solution is clunky and less elegant than most of the other submissions in this thread, but I avoided reading any of them until I had implemented the

Re: Question about Responsiveness of Garbage Collection

2010-01-22 Thread Erik Price
On Jan 20, 7:22 pm, CuppoJava patrickli_2...@hotmail.com wrote: Some articles I read point to Java's use of garbage collection as the culprit, and I'm wondering whether that is true. I know Scheme and Common Lisp also use garbage collection, so do gui programs written those languages also

Re: Good refs on concurrency?

2010-01-18 Thread Erik Price
On Sat, Jan 16, 2010 at 7:02 PM, David Beckwith thirdreplica...@gmail.com wrote: Hi, Can you guys recommend any good books, articles or code on concurrency?  I'm new to concurrency issues, and just finished the Halloway book, so it would be great to have an introductory reference with lots

Re: Good refs on concurrency?

2010-01-18 Thread Erik Price
On Sat, Jan 16, 2010 at 7:02 PM, David Beckwith thirdreplica...@gmail.com wrote: Can you guys recommend any good books, articles or code on concurrency?  I'm new to concurrency issues, and just finished the Halloway book, so it would be great to have an introductory reference with lots of

Re: Parenthesis Inference

2009-12-19 Thread Erik Price
Personally, I don't think the problem for non-Lispers is with the number of parentheses so much as with the *depth* of parens-nesting and having to invert the reading order, starting from the deepest s-expr and reading your way back out. I'm still very new to Clojure (basically I have only been

Re: mapmap

2009-12-17 Thread Erik Price
On Thu, Dec 17, 2009 at 12:16 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 17 Dec 2009, at 15:44, Sean Devlin wrote: (defn map-vals [f coll]  (into {} (map (juxt key (comp f val)) coll)) vs: (defmethod fmap clojure.lang.IPersistentMap   [f m]   (into (empty m) (for [[k v] m]

Re: more dumb noob pain (2dplot.clj)

2009-12-11 Thread Erik Price
On Fri, Dec 11, 2009 at 12:15 PM, rebcabin bc.beck...@gmail.com wrote: Any hints for me? I'm sure it's because I really don't know at all how to find out where java things are installed and how to refer to them if they're installed in weird places yadda yadda. Are the Java 3D jar files in

Re: What about contains? for lists

2009-12-02 Thread Erik Price
On Wed, Dec 2, 2009 at 10:10 AM, Stefan Kamphausen ska2...@googlemail.comwrote: OK, the doc of contains? told me that for indexed collection-types it will only check, whether the index is within the valid range. So maybe: user (contains? (list 1 2 3) 1) false At that point I dived into