Re: Extending IAssociative/Associative in clj and cljs

2016-04-16 Thread Timothy Baldridge
You have to do it with CLJC. Not optimal, but that's the way it goes right now. And yeah Associative.java is broken up into multiple smaller protocols in CLJS. Timothy On Sat, Apr 16, 2016 at 8:19 PM, JvJ wrote: > > I was attempting to create a cross-platform (clojure and clojurescript) > datat

Re: Pmap on hash maps

2016-04-17 Thread Timothy Baldridge
The cost of creating that extra collection will be vastly overshadowed by the cost of running pmap. pmap involves the use of several locks, and thread co-ordination primitives, these will most likely be orders of magnitude more expensive than an extra allocation. Timothy On Sun, Apr 17, 2016 at 1

Re: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
assoc-in is defined in terms of assoc: https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901 And this structure is fairly common these days, it's basically a index of tuples [e a v], and you're creating a eav index and then an av index. Datomic does this same sort of

Re: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
And by "fairly common these days", I mean that I run into this sort of structure a lot in clojure with anything that is trying to logic or query operations. Probably isn't that common outside of projects in that domain. On Mon, Apr 18, 2016 at 5:28 PM, Timothy Baldridge wrote:

Re: Possible to override assoc-in or update-in?

2016-04-18 Thread Timothy Baldridge
in that domain. >> >> On Mon, Apr 18, 2016 at 5:28 PM, Timothy Baldridge >> wrote: >> >>> assoc-in is defined in terms of assoc: >>> https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L5901 >>> >>> And this st

Re: How to forward-declare deftypes

2016-04-21 Thread Timothy Baldridge
Few things to consider: code against protocols where possible (removes the need to forward declare methods). Forward declare the constructor functions: (declare ->Foo) ... (defn some-code [] (->Foo 1 2)) (defrecord Foo [x y]) If you need to do type checks check for a protocol instead. Timot

Re: Transient Collection Identity

2016-04-22 Thread Timothy Baldridge
The answer is that you should treat them as you would persistent structures. It's true that they don't always change, but they may eventually change and without notice. For vectors this will be somewhere in the range of once every 32 conj! calls, but could change in a future version of clojure, so

Re: Unexpected nullpointer while processing a transient vector

2016-04-24 Thread Timothy Baldridge
Transients are not thread safe. http://clojure.org/reference/transients On Sunday, April 24, 2016, Vandr0iy wrote: > Hi, Clojurists! > > I'm writing some clojure in these days, and I stumbled upon an error that > I'm unable to easily understand. > My goal is to asynchronously process a 2D vector

Re: Unexpected nullpointer while processing a transient vector

2016-04-24 Thread Timothy Baldridge
Ack I somehow missed the code sample On Sunday, April 24, 2016, James Reeves wrote: > On 25 April 2016 at 03:27, Timothy Baldridge > wrote: > >> Transients are not thread safe. http://clojure.org/reference/transients > > > It doesn't appear that they're being

Re: Porting Clojure to Native Platforms

2016-04-25 Thread Timothy Baldridge
As someone who has spent a fair amount of time playing around with such things, I'd have to say people vastly misjudge the raw speed you get from the JVM's JIT and GC. In fact, I'd challenge someone to come up with a general use, dynamic language that is not based on the JVM and comes even close to

Re: Porting Clojure to Native Platforms

2016-04-25 Thread Timothy Baldridge
e you'd run in a webserver. That sort of stuff just has so many if statements that the JIT almost always optimizes the wrong thing. On Mon, Apr 25, 2016 at 3:12 PM, lvh <_...@lvh.io> wrote: > Hi Tim, > > On Apr 25, 2016, at 3:50 PM, Timothy Baldridge > wrote: > > A

Re: Porting Clojure to Native Platforms

2016-04-26 Thread Timothy Baldridge
> Ask all the game people who use Lua big time See that's the problem. When we say "horses for courses" we have to actually dig down into what we're saying there. The reason Lua is used in the gaming community is that it's quite fast, very very small, and simple for what it does. It also has a

Re: Lazy evaluation of arguments

2016-04-26 Thread Timothy Baldridge
Congradulations! You've discovered Fexprs! An ancient technology from a by-gone age: https://en.wikipedia.org/wiki/Fexpr On Tue, Apr 26, 2016 at 2:23 PM, Olek wrote: > Yes, the delay and force does the job. Now it would be nice to hide delay > declaration in arguments destruction as already prop

Re: Porting Clojure to Native Platforms

2016-04-26 Thread Timothy Baldridge
I wouldn't underestimate ClojureScript running on V8. That's another platform that's quite fast. And there are a lot of people trying very hard to make JS engines fast, could consider leveraging that. On Tue, Apr 26, 2016 at 3:09 PM, Raoul Duke wrote: > > Sorry, never heard of horses for courses

Re: Porting Clojure to Native Platforms

2016-04-26 Thread Timothy Baldridge
>> would you consider a Clojure port to Erlang VM a viable idea for production workloads? I know Elixir comes pretty close, but I still prefer Lisp : ) . I looked into that at one point, but sadly the Erlang VM is a really poor platform for a Clojure port. Here are a few reasons why: Unit of comp

Re: is reduce/reduced faster than loop/recur?

2016-04-29 Thread Timothy Baldridge
Yes, and it happens for most collections. Vectors, maps, etc. There's even a fast path for reduce-kv on maps that doesn't create key value entry objects. Timothy On Fri, Apr 29, 2016 at 6:06 PM, Mark Engelberg wrote: > So you're saying that this is an optimization that is automatically called

Re: which GC optimizations work better with Clojure?

2016-04-30 Thread Timothy Baldridge
I should mention here that if you are tuning the GC anywhere except at the end of your development cycle you're probably doing it wrong. 99% of the time you'll get better performance by reviewing your algorithms, running a CPU profiler, generating less garbage (via transients or something like that

Re: Best practice for calling Clojure from Java

2016-05-01 Thread Timothy Baldridge
Take a look at this class: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/java/api/Clojure.java It was added in Clojure 1.6 exactly for this use-case, and will be quite fast, especially if you store the vars somewhere and only look them up once. Timothy On Sun, May 1, 2016 at 6:28

Re: Best practice for calling Clojure from Java

2016-05-01 Thread Timothy Baldridge
Ah apparently someone also added a section to the docs on it: http://clojure.org/reference/java_interop#_calling_clojure_from_java On Sun, May 1, 2016 at 7:06 PM, Timothy Baldridge wrote: > Take a look at this class: > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/ja

Re: Simple memory usage tuning for clojure

2016-05-03 Thread Timothy Baldridge
YourKit has the ability to take memory snapshots then analyze those snapshots to find retention paths. So it'll help you see things like "500MB of data is held by this single reference". Getting up-to-speed on YourKit isn't bad if you're familiar with profilers. If not...maybe try learning it anyw

Re: Simple memory usage tuning for clojure

2016-05-03 Thread Timothy Baldridge
Yes, it stops working after X number of days, although there is a open source license available as well. There are other profilers that may help and may be cheaper/free, but I've found YourKit to be one of the best. It's always a question of time/money in my mind. If your time is cheap enough, then

Re: Transducers improve performance more than expected

2016-05-10 Thread Timothy Baldridge
In addition, as of 1.7, (range 1000) no longer creates a lazy sequence. It creates something that acts a bit like a sequence, but is reducable. So doing something like (reduce + 0 (range 1000)) is super fast and creates almost no garbage at all. On Tue, May 10, 2016 at 5:46 PM, Alan Thompson wrot

Re: Is java.lang.Class not a dependable map key?

2016-05-18 Thread Timothy Baldridge
Or define components to have a member called (name-as-kw [this]) returning a keyword version of the name of the type. On Wed, May 18, 2016 at 1:31 PM, James Reeves wrote: > Why not use the name of the class as the key? > > - James > > On 18 May 2016 at 20:02, JvJ wrote: > >> I'm creating an ent

Re: Is java.lang.Class not a dependable map key?

2016-05-18 Thread Timothy Baldridge
Well, if you store it in metadata you'll have to look it up in the metadata which is a hashmap lookup. As a method on a class it's a method call that returns a constant. On Wed, May 18, 2016 at 3:12 PM, JvJ wrote: > Will it be much better than type metadata, though? > > On Wednesday, 18 May 2016

Re: [ANN] Clojure 1.9.0-alpha1

2016-05-24 Thread Timothy Baldridge
The output of `spec/form` is helps a bit with this, as it namespaces vars, keywords and symbols correctly. I've had it on my list to write a translator for specs sometime in the near future, but I haven't done it yet. True the output of `form` isn't as uniform as I would like (sexprs instead of map

Re: map semantics

2014-02-08 Thread Timothy Baldridge
they allow the input and output data structures to drive how processing is handled. http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html And as the article states, reducers "use(s) regular data structures, not 'parallel collections'

Re: cljs, binding, async/go

2014-02-09 Thread Timothy Baldridge
Gos work with bindings on CLJ, CLJs biding support is different enough that it doesn't currently work with gos. Timothy On Sun, Feb 9, 2014 at 7:33 AM, t x wrote: > Hi, > > > ## Consider this block of code: > > (defn init [] ;; called from window.onload >(def ^:dynamic *dvar*) > > (bi

Re: [ANN] Clojure 1.6.0-beta1

2014-02-14 Thread Timothy Baldridge
+1 to everything Dom Kiva-Meyer said. On Fri, Feb 14, 2014 at 2:13 PM, Andrey Antukh wrote: > Awesome! Thanks! > > > 2014-02-14 21:47 GMT+01:00 Daniel : > > Thanks to everyone involved! >> >> >> On Friday, February 14, 2014 1:04:09 PM UTC-6, Alex Miller wrote: >>> >>> Clojure 1.6.0-beta1 is no

Re: weird bug with cljs.core.async + macros

2014-02-18 Thread Timothy Baldridge
I'm unable to decipher from these examples exactly what is expected and what is going on. Can someone write me a concise 1 paragraph description of the problem. Something like: "When a case is emitted from a macro into the body of a go, . happens" I think it's probably something related to ho

Re: weird bug with cljs.core.async + macros

2014-02-18 Thread Timothy Baldridge
"When a macro expands to case inside of a go-block, it appears that the _ELSE_ clause of the case is always run. (Even after a previous clause has matched.)" Thanks, I'll get a test in the project for this, it'll probably be fixed in the next alpha release. Until then, cond or condp might work? T

Re: weird bug with cljs.core.async + macros

2014-02-18 Thread Timothy Baldridge
Firstly, I think you over estimate the cost of an if. Ifs are very very fast, especially if you are doing identical? checks (like a case is doing). A simple pointer comparison such as (keyword-identical? :foo :foo) is going to be way faster than a hashmap lookup. Secondly, ifs are very JIT friendl

Re: why Clojure/Lisp is so fast

2014-02-18 Thread Timothy Baldridge
Clojure IMO is not truly dynamic, at least not to the extent of Python/Ruby. I like to refer to Clojure as a "dynamic enough" language. For example, once defined, types cannot be modified by adding new members (deftype that is). If you want to add a new field to a deftype in Clojure, you have to r

Re: core.async as a rate-limiter

2014-02-19 Thread Timothy Baldridge
Yes, this pattern is pretty common. Create the timeout first, then do some work, then take from the timeout to wait for the remaining time. Looks good to me. Timothy On Wed, Feb 19, 2014 at 10:27 AM, Kris Jenkins wrote: > Hey folks, > > Can someone sanity check this for me, please? > > I want t

Re: Clojure performance question

2014-03-02 Thread Timothy Baldridge
How are you running these tests? The "correct" way to benchmark such things is via a real benchmark framework (such as criterium) then compile your clojure app to a jar (perhaps via lein uberjar) and finally run it via a bare java invocation: java -jar my.jar. Lein for example sometimes uses sub-p

Re: core.async is very slow for some cases, what to do?

2014-03-11 Thread Timothy Baldridge
You can take the CSP out of core.async, but then it really isn't the same thing. Your version with promises still allows for async, but in the process removes most of the benefits of CSP. Timothy Baldridge On Tue, Mar 11, 2014 at 12:29 PM, Ben Mabey wrote: > I've also ran into

Re: jquery/$ in cljs

2014-03-12 Thread Timothy Baldridge
I think this should work: (.bullet js/$ arg1 arg2) Although this might not work with advanced compilation. In that case you may need to provide extra info to the CLJS compiler to keep .bullet from getting renamed. Timothy On Wed, Mar 12, 2014 at 11:14 AM, t x wrote: > Hi, > > Consider > ht

Re: Help a Startup use Clojure!

2014-03-12 Thread Timothy Baldridge
This case study from Roomkey.com is a awesome starting place for a conversation: http://www.colinsteele.org/post/23103789647/against-the-grain-aws-clojure-startup http://www.colinsteele.org/post/27929539434/60-000-growth-in-7-months-using-clojure-and-aws Timothy On Wed, Mar 12, 2014 at 6:47 PM,

Re: core.async is very slow for some cases, what to do?

2014-03-13 Thread Timothy Baldridge
>> Instead (! channel val) you do ( wrote: > You could also try out: > http://docs.paralleluniverse.co/pulsar/ > > > Am Dienstag, 11. März 2014 18:39:54 UTC+1 schrieb Эльдар Габдуллин: > >> Each go block is executed via thread pool. On a channel side, producers >> and consumers are also decoupled.

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

2014-03-13 Thread Timothy Baldridge
I talked to Martin after a CodeMesh, and had a wonderful discussion with him about performance from his side of the issue. From "his side" I mean super high performance. You have to get a bit of background on some of his work (at least the work he talks about), much of what he does is high throughp

Re: Calling from a macro to a private macro

2014-03-17 Thread Timothy Baldridge
Don't use private vars. Instead move the macro to a sub namespace called "internals" or "impl" or something like that and make it public. Prefer trusting your users instead of limiting them. my $0.02 Timothy On Mon, Mar 17, 2014 at 11:33 AM, Yoav Rubin wrote: > I'm familiar with that trick, b

Re: Calling from a macro to a private macro

2014-03-17 Thread Timothy Baldridge
The problem is in the way lisp compilers work. Example: The public macro gets analyzed first and runs, and emits the code required to call the private macro. Then the compiler analyzes the output of the first macro and discovers that the code now calls a new macro. It analyzes this code and finds

Re: [GSoC] Mentor for self-hosting ClojureScript compiler project?

2014-03-18 Thread Timothy Baldridge
"large code sizes" as the minification provided by google closure is a major boon to performance. Just some thoughts Timothy Baldridge On Tue, Mar 18, 2014 at 12:42 AM, Max Kreminski wrote: > Hello all, > > I'm applying to GSoC this year, and I'm interested in taking

Re: local mutable state

2014-03-20 Thread Timothy Baldridge
Not to mention that this isn't local mutation. You are handing the atom to a closure that then gets wrapped by lazy-seq and returned. So the atom may actually sit around for some time. On Thu, Mar 20, 2014 at 2:26 PM, James Reeves wrote: > There are a few reasons to reject this style of code: >

Re: rant / cljs in cljs ? :-)

2014-03-21 Thread Timothy Baldridge
are you using "lein cljsbuild auto" ? That's what I use, and I get about 1-3 sec recompile times for stuff that uses core.async. Timothy On Fri, Mar 21, 2014 at 12:48 AM, t x wrote: > Hi, > > * I'm already using: > > :incremental true > :compiler { :optimizations :none } > > * I'm also aw

Re: Unexpected core.async timeout behaviour

2014-03-28 Thread Timothy Baldridge
This is a caused by an interesting interaction of two things: 1) channels can have no more than 1024 pending takes at a time. and 2) (timeout) "caches" it's return value for a given ms + window size of time. At the moment, window is about 5-10ms. This error message is normally the result of a bug.

Re: Lazy evaluation

2014-04-01 Thread Timothy Baldridge
The question is "replace them with what"? I remember with not so fond memories the days of using IEnumerable in C#, there was no immutability and no caching. So if you created a massive chain of data and iterated over it twice you would have to execute the entire chain of functions twice. With Lazy

Re: remove first?

2014-04-02 Thread Timothy Baldridge
I don't know of anything built-in, but this should do the trick: (defn remove-first [f [head & tail]] (if (f head) tail (cons head (lazy-seq (remove-first f tail) Timothy On Wed, Apr 2, 2014 at 1:44 PM, Christopher Howard wrote: > Is there some like "remove", but only removin

Re: Changing a value in let

2014-04-04 Thread Timothy Baldridge
This is not modifying the value it's creating a new scope with a new version of x. The binding above is shorthand for: (let [x 3] (let [x 42] (println x)) (println x)) ;; prints: 42 3 Timothy On Fri, Apr 4, 2014 at 10:23 AM, Plínio Balduino wrote: > Hi there > > I wrote this code ex

Re: Changing a value in let

2014-04-04 Thread Timothy Baldridge
hadowing > the first, there's no way to access the first value, right? > > Plínio > > > On Fri, Apr 4, 2014 at 1:26 PM, Timothy Baldridge wrote: > >> This is not modifying the value it's creating a new scope with a new >> version of x. The binding

Re: alternative syntax for Clojure? Haskell?

2014-04-05 Thread Timothy Baldridge
I find Haskell syntax completely unreadable. Just saying On Apr 5, 2014 11:36 AM, "Travis Wellman" wrote: > When I started learning Haskell after a year or more of Clojure, the > syntax was refreshing, and I found myself wishing I could write Clojure > with Haskell syntax. > > Later I left Cl

Re: Core.async nil on unclosed channels

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

Re: Core.async nil on unclosed channels

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

Re: Core.async nil on unclosed channels

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

Re: Core.async nil on unclosed channels

2014-04-07 Thread Timothy Baldridge
constantly tries to read from the output channel? > > On Apr 7, 2014, 1:39 PM, Timothy Baldridge wrote: > > That's the case with clojure.core.map as well, don't consume the lazy > seq the side effects aren't run...in short, map is not for side effects. > > &g

Re: "true" lightweight threads on clojurescript?

2014-04-08 Thread Timothy Baldridge
What is going to fulfill a promise? How will you know when a promise is fulfilled. In a single threaded VM like JS you're stuck with callbacks. Nothing short of full program transformation will give you any better experience than core.async. A good way to look at it is this...if you do this in Clo

Re: "true" lightweight threads on clojurescript?

2014-04-09 Thread Timothy Baldridge
> However, it's currently Firefox only and no Chrome. > > > > On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge > wrote: > >> What is going to fulfill a promise? How will you know when a promise is > >> fulfilled. In a single threaded VM like JS you'r

Re: "true" lightweight threads on clojurescript?

2014-04-09 Thread Timothy Baldridge
;> suffices. > >> > >> However, it's currently Firefox only and no Chrome. > >> > >> On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge > wrote: > >>> What is going to fulfill a promise? How will you know when a promise is > >>>

Re: Using parallellisation

2014-04-10 Thread Timothy Baldridge
Some would also argue that any parallelism system is going to slow down code as trivial as this. Never underestimate the power of properly optimized single threaded code :-). But yes, futures are the way to go if you want to execute a given expression on a different thread. On Thu, Apr 10, 2014

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

2014-04-19 Thread Timothy Baldridge
When people say "killer app" what they mean is "silver bullet". The problem with silver bullets, is while they are quite exceptional at killing vampires, they are often somewhat subpar when it comes to dispatching other monsters of the night, such as ogres. Or at least so I've been told by my frien

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

2014-04-19 Thread Timothy Baldridge
" I have dozen colleagues that can't foster clojure because they want a language with tools that fits every day." Can you explain this statement? I'm not sure I understand. I haven't touched any language but Clojure for "every day work" in months (years?). I can write a game in Clojure, I can writ

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

2014-04-19 Thread Timothy Baldridge
"But something or some things that mostly pushes people to use the language." If that's the case, then building cool stuff is probably the correct answer. And in that case, this probably applies quite well to Clojure: http://paulgraham.com/avg.html On Sat, Apr 19, 2014 at 3:24 PM, Paulo Suzart

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

2014-04-19 Thread Timothy Baldridge
Timothy On Sat, Apr 19, 2014 at 3:26 PM, Paulo Suzart wrote: > Yes. > > That's the point. You are taking about a bunch of wrappers. They are not > bad, but will not make these people to move their asses from java. Even if > they can introduce clojure in their tools set. >

Re: Clojurescript: getting the value out of go-block

2014-04-23 Thread Timothy Baldridge
What you want is not possible since core.async does not do full program rewriting, only code within a go is transformed. This is for both performance and practical reasons. So yes, wrapping a go in a go may seem a bit pointless, but that's exactly the semantic that you want, in a single threaded e

[ANN] New core.async release

2014-04-25 Thread Timothy Baldridge
cro and not the ClojureScript macro. This is due to the fact that tools.analyzer.cljs doesn't exist yet. There is a GSOC project for this, once we have an analyzer for cljs that supports passes, I'll update the CLJS side of things as well. Thanks! Timothy Baldridge -- You received this message b

Re: [ANN] New core.async release

2014-04-25 Thread Timothy Baldridge
eaks let me know. >> >> As the astute reader will notice, the go macro changes apply only to the >> Clojure go macro and not the ClojureScript macro. This is due to the fact >> that tools.analyzer.cljs doesn't exist yet. There is a GSOC project for >> this, once we h

Re: [ANN] New core.async release

2014-04-25 Thread Timothy Baldridge
In the mean time if you add this dependency to your project.clj file it should fix the errors: [org.clojure/tools.analyzer.jvm "0.1.0-beta12"] Timothy On Fri, Apr 25, 2014 at 9:05 AM, Timothy Baldridge wrote: > There's a problem with the deployment process. It seems tha

Re: [ANN] New core.async release

2014-04-25 Thread Timothy Baldridge
The new (with fixed deps) version is out and available: core.async-0.1.298.0-2a82a1-alpha On Fri, Apr 25, 2014 at 9:06 AM, Timothy Baldridge wrote: > In the mean time if you add this dependency to your project.clj file it > should fix the errors: [org.clojure/tools.analyzer.jvm "0

Re: [ANN] New core.async release

2014-04-25 Thread Timothy Baldridge
I've confirmed this as a bug, it's a problem with functions inside the body of a go when used along with an async op inside the body of a loop. Thanks for the report, I've fixed it in master, and once we get a bit more feedback, I'll create a new release. Should be out sometime in the next few days

Re: core.async and Joy of Clojure

2014-04-28 Thread Timothy Baldridge
I'm not sure if you have watched it yet, but my Clojure/Conj talk includes quite a few examples: https://www.youtube.com/watch?v=enwIIGzhahw The code from all the examples is available here: https://github.com/halgari/clojure-conj-2013-core.async-examples Timothy On Mon, Apr 28, 2014 at 8:42 AM

Re: Clojure for web project? Talk me into it!

2014-04-29 Thread Timothy Baldridge
One of the biggest value propositions of Pedestal has always been that it's the only Clojure web server library to support end-to-end async operations. You can do things like have a handler return a core.async channel, or pause/resume the entire web stack multiple times during a single request. Oth

Re: The Box

2014-04-29 Thread Timothy Baldridge
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java#L141 On Tue, Apr 29, 2014 at 1:21 PM, Plínio Balduino wrote: > Hi there > > Where is the class clojure.lang.Box used in Clojure? > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Bo

Re: What to use use for writing GUI's

2014-05-04 Thread Timothy Baldridge
I highly recommend taking a look again at JavaFX2. The latest version (released as part of Java 8 or as a separate jar with Java 7) has a very unified API and is a joy to work with. I've been hacking on a library that provides a data centric API to JavaFX2. The cool thing is that most of it is sel

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-05 Thread Timothy Baldridge
Can you put the sourcecode in refheap or gist? I can't make sense of your initial post. Timothy On Mon, May 5, 2014 at 11:03 AM, Valentin Luchko wrote: > Could you explain me why after > clients;; => {# /0:0:0:0:0:0:0:1%0:<->/0:0:0:0:0:0:0:1%0:60071> true} > (into {} clients) ; => # clojur

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-06 Thread Timothy Baldridge
First of all, this shouldn't work at all, since you aren't requiring core.async, so you shouldn't be getting anything about that library at all. Perhaps you need to reload your repl, or perhaps there's something missing in your gist? Thanks, Timothy On Mon, May 5, 2014 at 3:15 PM, Valentin Luch

Re: Immutable or Effectively Immutable?

2014-05-06 Thread Timothy Baldridge
And hash codes are not final as they are calculated on-the-fly on most of the Clojure data structures. Timothy On Tue, May 6, 2014 at 5:49 PM, Alex Miller wrote: > The Clojure persistent data structures are truly immutable - all fields > are final and referred objects are not mutated after con

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

2014-05-06 Thread Timothy Baldridge
>> Clojure is being reworked into literate form already Proof of this claim? On Tue, May 6, 2014 at 7:32 PM, Gregg Reynolds wrote: > On Tue, May 6, 2014 at 2:22 PM, Tim Daly wrote: > >> Gregg, >> >> > My original comment on litprog ("bad bad bad") was admittedly a little >> > strong. I thi

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-07 Thread Timothy Baldridge
core.async provides its own implementation of merge that returns a ManyToMany channel. So that's why the call to merge is returning a channel. But why I haven't a clue. I still claim that you have a dirty repl or something. Timothy On Wed, May 7, 2014 at 6:11 AM, Valentin Luchko wrote: > Sorry

Re: Reduce vs. Comp

2014-05-07 Thread Timothy Baldridge
If you read the source for comp, you'll find that anything more than 3 args gets turned into something like reduce anyways: (defn comp "Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of f

[ANN] Hermod a core.async message passing library

2014-05-09 Thread Timothy Baldridge
rmod There are most likely some bugs still left, but give it a whirl and let me know what you think. Thanks, Timothy Baldridge -- 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

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

2014-05-10 Thread Timothy Baldridge
If you plan on having this documentation apply to clojure.core.* you'll probably want to pull in Alex Miller or start a conversation in clojure-dev. I'd hate to see a bunch of decisions made, just to find out that Rich has a completely different view, a view that might have been nice to know before

Re: [ANN] Hermod a core.async message passing library

2014-05-13 Thread Timothy Baldridge
gt; > In general is hard to understand how its possible to guarantee > delivery of the parts of the message, but not of the message itself. > > thanks! > > > > > > > > > > > > > > > > On Fri, May 9, 2014 at 1:27 PM, Timothy Baldridge >

Re: [ANN] tools.analyzer(.jvm) 0.1.0-alpha1

2014-05-13 Thread Timothy Baldridge
My Clojure/West talk covers how to write such a pass, and the comments on this video include a link to the source code. https://www.youtube.com/watch?v=KhRQmT22SSg On Tue, May 13, 2014 at 1:16 PM, Max Kreminski wrote: > Hi Greg, > > I wrote a quickref to the AST node structures that also descri

Re: "in Clojure I rarely find myself reaching for something like the state monad, as I would in Haskell"

2014-05-16 Thread Timothy Baldridge
When I first wrote the core.async go macro I based it on the state monad. It seemed like a good idea; keep everything purely functional. However, over time I've realized that this actually introduces a lot of incidental complexity. And let me explain that thought. What are we concerned about when

Re: clojurescript, sourcemaps, and debugging info

2014-05-18 Thread Timothy Baldridge
>> foo.cljs >> foo/whatever.cljs >> bar.cljs >> bar/stuff.cljs yes, do this, it also matches what most of the Clojure community does. On Sun, May 18, 2014 at 4:16 AM, Thomas Heller wrote: > Don't think plugins can touch the devtools. > > I tend to organize my code that the public "interface" o

Re: Re-evaluating recuring go blocks

2014-05-18 Thread Timothy Baldridge
Also, go blocks that are waiting on channels that are garbage collected will be garbage collected themselves. This means I often just re-compile an entire namespace, this redefines the channel, re-binds the def the channel is attached to, and recreates all gos. The channel is now free go be GC'd al

Re: Re-evaluating recuring go blocks

2014-05-19 Thread Timothy Baldridge
Channels are not tied to anything, so once your code stops referencing them, they are garbage collected. Go blocks are actually nothing more than pretty callbacks that are attached to channels. So if a go is waiting for a put or a take from a channel, it will be GC'd with the channel. I could go i

[ANN] core.async (and more) video tutorials

2014-05-21 Thread Timothy Baldridge
is a small charge for the majority of the videos, but think of it as a way to prod me to make more tutorials. Thanks! And hopefully this will be useful to some. Timothy Baldridge -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: [ANN] core.async (and more) video tutorials

2014-05-22 Thread Timothy Baldridge
I'm using Cursive Clojure (Intelij). It has a "Presentation Mode" which is pretty good, but I use Cursive as my main IDE these days. On Thu, May 22, 2014 at 7:41 PM, Jason Gilman wrote: > Thanks for the videos. The first one was good. What text editor are you > using in the videos? I haven't see

Re: [ANN] core.async (and more) video tutorials

2014-05-24 Thread Timothy Baldridge
A Cursive Clojure video is in the pipeline. Thanks for the idea! Timothy On Fri, May 23, 2014 at 9:25 AM, Juan Manuel Gimeno Illa wrote: > The videos look very good and seem very interesting. > > One idea: some video about how to create & configure a project in cursive > would be helpful as we

Re: What is fn* ?

2014-05-26 Thread Timothy Baldridge
All functions are eventually created via fn*. If you look for the source code of fn it's a macro that emits a call to fn*. It's done this way so that things like destructuring can be defined in clojure.core (and in Clojure) instead of in Compiler.java (and in java). On Mon, May 26, 2014 at 9:08 A

Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread Timothy Baldridge
for breaking up the pace a bit. Thanks again, Timothy Baldridge On Tue, May 27, 2014 at 4:22 AM, Ivan Ryakhov wrote: > Greate work, Tim! > My advice is to split the screen by vertical but not horisontal. Your code > are not so wide and there is a lot of empty space on the right side

Re: core.async pipeline from Baldridge video hangs with onto chan, but not using doseq

2014-05-30 Thread Timothy Baldridge
I'm not sure I understand this statement: "I need to be message dependencies in the pipeline which may not be the best idea" Can you explain? Thanks, Timothy On Fri, May 30, 2014 at 4:59 PM, Sean Shillo wrote: > https://gist.github.com/sshillo/492e441d2d94745560c1#file-gistfile1-clj-L49 > >

Re: protocol order

2014-06-02 Thread Timothy Baldridge
>From clojure.org/protocols : " if one interface is derived from the other, the more derived is used, else which one is used is unspecified." Since multi-methods use "isa?" and not "=" perhaps use multi-methods and specify order via "prefer-method"? Timothy On Mon, Jun 2, 2014 at 6:57 AM, Phi

Re: Top-down code in namspaces

2014-06-03 Thread Timothy Baldridge
Another way of looking at Clojure code is not a "top down abstraction first" view, but as the building of a system from smaller parts. The best example of this is clojure/core.clj . Sure it's bootstrap code so it can be a bit verbose at times, but you start with nothing and end up with a complete s

Re: Advice on implementing atomic read/write socket operations

2014-06-03 Thread Timothy Baldridge
" every write must be followed by a read before another write is performed." I won't assume for the moment that this is exactly what you need. If it is, disregard my reply. Another option is to simply use an agent to send data, and register callbacks in an atom. Each sent message gets an ID (auto

Re: Clojure on iOS devices - Swift as a host?

2014-06-04 Thread Timothy Baldridge
I'm starting to feel like a broken record, but here we go. Some things to think about: 1) Why do you want this? The JVM GC and JIT are some of the fastest (if not the fastest) on the planet, so performance will never be a good reason to do this. 2) Do you want something like eval? As far as I can

Re: store a value in a PersistentVector and PersistentHashMap

2014-06-04 Thread Timothy Baldridge
If you've read those sites, then read the source. It's not that hard to understand once you understand that Vectors are trees: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java On Wed, Jun 4, 2014 at 7:46 AM, sorin cristea wrote: > > > On Wednesday, June

Re: [ANN] clj-generators - generator magic inspired by Python

2014-06-04 Thread Timothy Baldridge
A little known fact is that the guts of the go macro are quite flexible. We use this in the test framework: https://github.com/clojure/core.async/blob/master/src/test/clojure/clojure/core/async/ioc_macros_test.clj#L17 I also spent some time once and created a yield like macro: https://github.com

Re: non-lazy clojure?

2014-06-04 Thread Timothy Baldridge
Although your original complaint was about clojure seqs being lazy. It should be noted that reducers are also lazy down to the point of a fold or reduce, so I'm not sure what you're really getting there. It wouldn't be hard at all to write map, filter, remove, etc. in terms of list operations. Perh

Re: [ANN] core.async (and more) video tutorials

2014-06-05 Thread Timothy Baldridge
Code is here: https://github.com/halgari/clojure-tutorial-source I'll try to get a forum setup soon, or at least some sort of mailing list Timothy Baldridge On Thu, Jun 5, 2014 at 6:15 PM, Dylan Butman wrote: > Thanks for doing these Tim! Very good stuff. >> >> Would li

<    1   2   3   4   5   6   7   8   9   >