Re: (core.async/go nil) behavior?

2013-12-14 Thread Brandon Bloom
Sounds like a bug to me. A nil value in return position of a go block should probably close the channel. On Saturday, December 14, 2013 2:18:07 PM UTC-5, Stephen Cagle wrote: core.async discourages you from placing nil in a channel, as nil is only taken when the channel has been closed.

Re: [ANN] data.avl 0.0.10 -- fast sorted maps and sets with log-time rank queries

2014-01-05 Thread Brandon Bloom
Michał: This is awesome. Thanks for the continued awesome work on data structures! ;; if the key is not present in the collection, -1 is returned: (avl/rank-of (avl/sorted-set 3 4 5) 0) ;= -1 Curious: Why not return nil instead of -1? -- -- You received this message because

Re: obtain # of elements currently on a channel?

2014-01-11 Thread Brandon Bloom
Any API that lets you peek at the state of a channel is a surefire source of race conditions. So no, public API-wise, there isn't any way to do what you want. In theory, you can peek at the internals using reflection to get that information, but don't do that! Instead, you can simply *count*

Re: concat/forth in -, -

2014-01-19 Thread Brandon Bloom
It's worth noting that the - and - macros are just that: macros. They have lexical extent and are expanded at compile time. Factjor is (essentially) interpreted, but can be used in interesting higher order ways. For example, you can write functions that return lazy sequences of Factjor

Re: ISeq documentation and mutual deftypes.

2014-02-11 Thread Brandon Bloom
The other question: is it possible to have two mutually refering deftype definitions. Although recursive types makes sense on the JVM, it doesn't necessarily make sense on hosts without an explicit type system in which to resolve the mutual recursion; consider ClojureScript. You don't

Re: Call for volunteers to help moderate a ClojureScript Google group

2013-01-23 Thread Brandon Bloom
/me steps forward On Wednesday, January 23, 2013 10:53:34 AM UTC-8, Andy Fingerhut wrote: An interest was expressed by a few in having a separate ClojureScript mailing list. If it is a Google group, that requires moderating messages sent to the group, via manual approval. I suspect

Re: IF?

2013-02-12 Thread Brandon Bloom
Clojure, like most Lisps, has a top-to-bottom, inside-out, left-to-right, eager evaluation strategy. All Clojure forms are expressions, and thus must return a value. Given these two design requirements, (if test then else) is the natural branching primitive. It implies serialize execution

Re: help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread Brandon Bloom
Shameless self-promotion: https://github.com/brandonbloom/backtick On Tuesday, February 19, 2013 1:35:28 PM UTC-5, AtKaaZ wrote: I am trying (but failing) to find a way to have a macro like: = *(xmacro* {:a (+ 1 2) :b ~(+ 1 3)}) {:a (clojure.core/+ 1 2), :b 4} ;*without specifying the

Re: [ClojureScript] features expression

2013-03-05 Thread Brandon Bloom
I personally think the CL feature expression approach is satisfactory. The more I think about it, the less I think that the CL Feature Expression approach is satisfactory as is. I'm now reasonably convinced that, horror of horrors, we should look to the C preprocessor for inspiration. CL's

Re: features expression

2013-03-06 Thread Brandon Bloom
I believe protocols can entirely alleviate the need for feature expressions. How do you figure that? One major incompatibility between Clojure and ClojureScript currently is that the protocols don't match up. If you want a deftype form that is 90% the same, but has a conditional switch for a

Re: What's the point of - ?

2013-03-12 Thread Brandon Bloom
One other thing to consider is partial application. The collection functions tend to put the most-likely-to-be-curried arguments first. For example: (def sum (partial reduce + 0)) Compare to coll-reduce, which dispatches on the type of the first argument: (require '[clojure.core.protocols

Re: [ANN] Instaparse 1.0.0

2013-04-12 Thread Brandon Bloom
Super cool! Nice work. Your readme says I had difficulty getting his Parsing with Derivatives technique to work in a performant way. I was wondering if you could please elaborate. What kind of performance did you achieve? How does that compare to the GLL parser you implemented? Did you

Re: [ANN] Instaparse 1.0.0

2013-04-14 Thread Brandon Bloom
Thanks for the details. You definitely made the right pragmatic decision. What you've said pretty much matches what I expected to hear, although I'm hopeful that the approach can be refined, since it's quite eloquent. Beyond eloquence, the derivatives approach is also interesting for schema

Re: invokedynamic instructions in Clojure

2013-04-16 Thread Brandon Bloom
Do you have any measurements, results, or conclusions to report? On Tuesday, April 16, 2013 12:12:15 PM UTC-4, Ghadi Shayban wrote: I've added a very minimal usage of invokedynamic to the compiler. Basically the smallest delta without having to change internals of ObjExpr or break ABI

Re: defmethod/require race condition

2013-05-09 Thread Brandon Bloom
This is an unfortunate ugly side effect of def and def-like forms being, um, side effectual. In the particular case of defmethod, I think that the general recommendation would be to structure your namespaces such that methods are defined along side the code that could produce dispatch values

Re: I don't feel the absence of a debugger, because I've learnt enough that I don't ever need a debugger.

2013-05-27 Thread Brandon Bloom
Coming from Visual Studio all those years ago, I deeply missed my debugger. These days, I miss my debugger extremely rarely. And when I do use a debugger, I much prefer a non-visual one: Either something like dgb, or something like a hypothetical open-repl-here function, where I can ask

Re: Why the CLR languages fail?

2013-06-06 Thread Brandon Bloom
Alexandru's analysis is spot on. Here's the pithy IRC version I've used in the past: C# has a better type system and compiler, so it doesn't need as good of a JIT. That's a problem for languages that aren't C#, especially dynamic ones. There are lots of caveats, but that more or less covers

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Brandon Bloom
There are currently 4 roles defined: Definer, Asserter, Runner, and Reporter. It looks like the Runner does finding, filtering, and execution. I think you could further break the Runner down into Discoverer and Executor. I might want to just ask What tests do I have? without actually running

Is anyone relying on the js* special form?

2012-09-12 Thread Brandon Bloom
I'm exploring some changes to the ClojureScript compiler backend and am curious if anyone is using one particular implementation detail: The js* special form. Note that I'm not asking about the js/ pseudo-namespace, only the js* special form. Are you using it in your ClojureScript projects?

Re: Is anyone relying on the js* special form?

2012-09-12 Thread Brandon Bloom
, Sep 12, 2012 at 4:12 PM, Brandon Bloom snpr...@gmail.comjavascript: wrote: I'm exploring some changes to the ClojureScript compiler backend and am curious if anyone is using one particular implementation detail: The js* special form. Note that I'm not asking about the js/ pseudo

Re: Is anyone relying on the js* special form?

2012-09-13 Thread Brandon Bloom
Just a reminder that people should not be using it at all. It may be removed at anytime without warning. I'm considering replacing it with a form which must return JS AST nodes, instead of a JS source code string. If people are encountering reasons to use it - something is missing

Re: Is anyone relying on the js* special form?

2012-09-13 Thread Brandon Bloom
Why should the backend have to deal with JS AST nodes? I'm considering changing the emit phase to produce a Google Closure Compiler AST. This would have several benefits: 1. The emit phase would become functional (returning an AST) instead of procedural (printing source). 2. Test

Re: Is anyone relying on the js* special form?

2012-09-16 Thread Brandon Bloom
is copied from https://github.com/netguy204/MOVE/blob/master/src/move/macros.clj On Wednesday, September 12, 2012 7:12:21 PM UTC-4, Brandon Bloom wrote: I'm exploring some changes to the ClojureScript compiler backend and am curious if anyone is using one particular implementation detail

Re: Is anyone relying on the js* special form?

2012-09-24 Thread Brandon Bloom
clojurescript gives no access to javascript's delete operator. There is a js-delete macro in core. It uses the same form as your proposed adel form. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: thinking in data, polymorphism, etc.

2012-10-25 Thread Brandon Bloom
I have a fairly common scenario where I have a set of operations that need to work on two types of data (not data types in the clojure sense) that have different internal structure (i.e. maps with different keys). Could you please be a little more concrete? If you provide a specific example,

Re: thinking in data, polymorphism, etc.

2012-10-25 Thread Brandon Bloom
(fn [_ _] ;dispatch-function checks for OS - ignores args (let [os (System/getProperty os.name)] (if (.startsWith os Mac OS) :Linux (keyword os) This seems like a very poor use of multi-methods. Multi-methods exist to provide both dynamic and open dispatch. In this case, the

core.logic and other types of solvers

2012-10-26 Thread Brandon Bloom
There was a mention of linear programming in this threadhttps://groups.google.com/d/topic/clojure/oFCk5rOQUUo/discussionabout core.logic. I wonder: Is it possible to compose the techniques? I've only just started digging into core.logic (ie today), but I've messed with less-general constraint

Re: Can CLJS functions have metadata?

2012-11-21 Thread Brandon Bloom
Fixed: http://dev.clojure.org/jira/browse/CLJS-359 On Saturday, August 25, 2012 12:49:47 AM UTC-7, Shantanu Kumar wrote: Hi, I noticed that `with-meta` is not working on function objects in CLJS. Compilation fails with the following error: Error: No protocol method IWithMeta.-with-meta

Re: Can anyone point me to that library that supports quasiquoting without full namespace expansion?

2012-12-02 Thread Brandon Bloom
I just published a new 0.2.0-SNAPSHOT that includes a fix parallel to Rich Hickey's change to handling of records in Clojure 1.5. On Sunday, December 2, 2012 10:27:46 AM UTC-8, Conrad wrote: Never mind, I just found it on clojars. It is: https://github.com/brandonbloom/backtick On Sunday,

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-12-09 Thread Brandon Bloom
I wanted something like this to create an AST validator for ClojureScript! Will have to find some time to study your approach. On Sunday, November 25, 2012 3:22:04 PM UTC-8, Alex Baranosky wrote: Clj-schema is a library for defining and validating schemas for maps, as well as for using those

Re: Clojure raytracing scene description language

2012-12-09 Thread Brandon Bloom
Are you only interested in static scenes? Or are you interested in simulations too? On Sunday, December 9, 2012 4:03:36 PM UTC-8, Mikera wrote: Hi all, I'm working on a hobby project to implement a Clojure raytracer, something along the lines of POV-Ray: https://github.com/mikera/enlight

Re: I'm curious if the development of native Clojurescript macros is in progress

2012-12-28 Thread Brandon Bloom
So I'm curious if the adoption of native macros into Clojurescript is in progress by contributors. The only visibile progress I know of here is Kanaka's self hosting fork: https://github.com/kanaka/clojurescript If not, is it on the plan at least? Or is it rejected after some discussion?

Re: What would you use a #[] data literal for?

2012-12-30 Thread Brandon Bloom
Wouldn't it be better to implement this as an automatic optimization, just like PersistentArrayMap vs PersistentHashMap ? fwiw, I'm cautiously in favor of #[] being used for queues. On Sunday, December 30, 2012 3:45:24 AM UTC-8, Jozef Wagner wrote: I use it in Clojurescript for a custom tuple

Re: What would you use a #[] data literal for?

2012-12-31 Thread Brandon Bloom
Significant performance gain is achieved when destructuring by skipping nth and directly calling type fields instead. Have you also patched the destructuring mechanism? Concrete vector implementation is not known when destructuring, so I'm left with a custom reader literal. How does the

Re: Clojure 1.5.0 RC 1

2013-01-01 Thread Brandon Bloom
Please test it. I just tried it out and was really bummed to discover that http://dev.clojure.org/jira/browse/CLJ-873 was not merged. That's the clojure.core// division symbol issue. It's a pretty straightforward patch that fixes a real problem for ClojureScript and a few other random

Re: symbolic protocols

2013-01-08 Thread Brandon Bloom
The defmulti would be closer to (defmulti mm first) because we need to dig into the list to get the first symbol. I don't think that there is anything stopping you from creating such a code walker now. Maybe you should built a proof of concept to demonstrate some use cases

Re: What's the current status of Clojure-in-Clojure?

2013-01-08 Thread Brandon Bloom
ClojureScript has the best chance of forming a base of Clojure-in-Clojure. I believe David Nolen would consider any patches that help decouple us from JavaScript. On Tuesday, January 8, 2013 3:44:16 PM UTC-8, Thor wrote: I think this would be a fun project to contribute to, but a few searches

Re: core.matrix proposal

2013-01-08 Thread Brandon Bloom
There's a bunch of useful operations that games animation systems perform frequently that are less common in other uses of linear algebra. For example: linear and spline interpolations. The DirectXMath library is worth studying:

ANN: fipp - Fast Idiomatic Pretty-Printer

2013-01-11 Thread Brandon Bloom
Hi all, I decided to create a new pretty printer in the spirit of Data All The Things! And it's fast too! Fipp, the Fast Idiomatic Pretty-Printer for Clojure, is a pretty printer with linear runtime and bounded space requirements. Unlike clojure.pprint's side-effectual API, Fipp is configured

Re: ANN: fipp - Fast Idiomatic Pretty-Printer

2013-01-12 Thread Brandon Bloom
Done: https://github.com/brandonbloom/fipp/commit/e7ae2cce42b9f0baf0f8e242b669fc19aad57ed3 Thanks! On Saturday, January 12, 2013 4:23:41 AM UTC-8, Michael Klishin wrote: Brandon, Please provide dependency information in the README, otherwise Clojure beginners won't be able to use your

Re: Better ways of documenting functions with type information?

2013-01-13 Thread Brandon Bloom
You could use type hints and pre/post conditions: (defn foo Gets adjusted pixels or whatever [^BufferedImage screen ^Number x ^Number y] {:post [(foo-map? %)]} ...) (defn foo-map? True if x is a map of maps with pixel colors ... [x] ...) That said, it would be nice if

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-19 Thread Brandon Bloom
For what it's worth, I've submitted 20+ patches to ClojureScript and one or two to Clojure proper. I still find the process to be extremely unpleasant. I consistently avoid interacting with JIRA until the last possible minute: That software is actively user-hostile. Without naming names, I've

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-19 Thread Brandon Bloom
contributions to clojure are definitely less easy to make than to projects that willy-nilly accept any pull request. False dichotomy. Accepting pull requests does not mean you need to be willy-nilly about it. You know how people carefully optimize their signup forms and checkout flows? They

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-19 Thread Brandon Bloom
Aaron, please forgive my failure at formalities: Allow me to add that I agree with the rest of your post. The Linux kernel and Guava guys are absolutely right about patches defaulting to the rejected state. I'm a big believer in the minus 100 points philosophy. It's just that I just really

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-20 Thread Brandon Bloom
There are 176 forks on GitHub. Even assuming that all 51 contributors have a public fork (most probably do), that's 125 potential contributors unaccounted for. Only 29% of those forks account for an accepted contribution. What portion of the remainder might have been contributors? I was

Re: Is contributing to clojurescript is intentionally made hard ?

2013-01-20 Thread Brandon Bloom
I think the inflammatory thread subject didn't help... Java and cross-browser CI both sound great. I don't know if Clojure/core already has CI or what, but maybe you should take these ideas over to another thread? Possibly on the Dev mailing list. Because of the intentionally slow pace of

ClojureScript def, vars, and binding

2012-01-27 Thread Brandon Bloom
The ClojureScript wikihttps://github.com/clojure/clojurescript/wiki/Differences-from-Clojurestates that the user experience of [binding] is similar to that in Clojure but my very first experiment produced wildly different results between platforms. Here's a Clojure on the JVM session: user=

Re: ClojureScript def, vars, and binding

2012-01-28 Thread Brandon Bloom
For anyone else stumbling across this thread, I found a lot more information about dynamic binding with respect to asynchronous code in the Clojure Confluence wiki: http://dev.clojure.org/display/design/State%2C+Concurrency%2C+and+Parallelism In particular, the Asynchronous Events, Blocking vs

Re: ClojureScript def, vars, and binding

2012-01-28 Thread Brandon Bloom
D'oh! That's what I get for assuming I remembered the Java Thread API from several years ago Thanks. -- 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 from new members

Re: ClojureScript def, vars, and binding

2012-02-09 Thread Brandon Bloom
It seems like the missing word from my vocabulary was conveyance. I've spent a fair bit of time toying with Clojure, ClojureScript, and their respective implementations. It seems like Clojure 1.3 augmented futures and agents with binding-conveyor-fn, clojure.lang.Var/getThreadBindingFrame, and

Re: ClojureScript def, vars, and binding

2012-02-14 Thread Brandon Bloom
To redeem myself for the noob threading mistake, *I've implemented Var and friends in ClojureScript*: https://github.com/brandonbloom/clojurescript/compare/8ba4849e60e5957cdac36ef6946c647e824ca3c8...vars This branch includes (almost) the full set of relevant functionality, but for performance

Re: ClojureScript def, vars, and binding

2012-02-14 Thread Brandon Bloom
Can we continue the conversation on this thread while my CA waits on the USPS? Three things to cover: 1) motivation 2) design 3) impact 1. Why do I want this? Why would anyone want this? - Better parity with JVM Clojure - async Javascript (ie. nearly all Javascript) makes the

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
As I experiment with this more, I could see non-dynamic Var objects also being useful once IWatchable is implemented on them. Basically, I'd love to send a defn form to the browser during development and have my UI data-bound to both the data AND *the function that rendered it* :-) My dream is

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
I put your notes here, http://dev.clojure.org/display/design/Dynamic+Binding Thanks! How are you ensuring that the binding frames are local to a particular asynchronous block of code and that they are removed when that asynchronous block of code exits? I don't do anything special for

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
One problem then is that the work becomes explicit instead of implicit as it is in Clojure: future and agent sends setup the machinery for you. You need the ability to explicitly capture and restore the current thread bindings to implement that implicit machinery. The future macro is

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Brandon Bloom
I've updated my fork with IWatchable and validation implemented on Var: https://github.com/brandonbloom/clojurescript/compare/8ba4849e60e5957cdac36ef6946c647e824ca3c8...vars @dnolen I assume I need to wait for my CA to be delivered/approved before I can update that Wiki page? I'd like to add

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Brandon Bloom
Given the single-threaded nature of JavaScript I don't see how future-call or agents could be implemented. There are analogous constructs in a single-threaded, async-callback world. In particular, many Javascript libraries have a concept of promises and futures for managing the async callback

Re: ClojureScript def, vars, and binding

2012-02-17 Thread Brandon Bloom
A robust solution can be implemented via CPS transformation Forgive me for my ignorance, but how exactly would a CPS transformation enable one to capture and restore the current set of dynamic bindings? -- You received this message because you are subscribed to the Google Groups Clojure

Re: ClojureScript def, vars, and binding

2012-02-17 Thread Brandon Bloom
The problem is dealing with with asynchronous code, right? Not capturing / restoring dynamic bindings. No, the problem is that there is no mechanism to capture and restore dynamic bindings. This is a shortcoming irrespective of asynchronous code. It just so happens that such a mechanism

Re: ClojureScript def, vars, and binding

2012-02-18 Thread Brandon Bloom
I think the question is whether ClojureScript needs to support bound-fn at all. But maybe it really is useful in a single-threaded environment! :) I'm already finding it very useful for an experimental UI framework design I'm working on. I have a dynamically bound insert pointer, such that UI

Re: ClojureScript source maps

2012-03-22 Thread Brandon Bloom
SourceMap support is rapidly approaching general availability in Chrome and Firefox: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ I'd love to see this happen and *may* be able to find time to help with implementation. Any intel on existing attempts at this? On Sunday,

Re: why do we need a (require…)?

2012-03-24 Thread Brandon Bloom
This is not a good idea, for many reasons, the simplest of which is: it makes loading a side effect of calling a function in a module. Since loading can have arbitrary effects, it shouldn't be implicit. This isn't warranted by the meager benefits it might provide. -- Rich Hickey

Re: ClojureScript source maps

2012-03-24 Thread Brandon Bloom
The first step would be just to get the compiler to emit an optional source map. That's definitely the first step! After that, there's going to need to be some way to serve those source maps via HTTP upon request from the browser. However, there's a first step to the first step: Getting

Re: SuperDevMode and SourceMaps for ClojureScript debugging

2012-03-24 Thread Brandon Bloom
Any suggestions on how to get started on tackling that? Let's join discussions on this... over here: https://groups.google.com/d/topic/clojure/BUW6-1DqSsI/discussion -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: ClojureScript source maps

2012-03-24 Thread Brandon Bloom
We could also decide to handle multi-mapping ourselves - that is write the code that can produce a merged source map. It seems likely (already done?) for browsers to support the X-SourceMap header and //@ comments for the target use case of CoffeeScript - Javascript - Minified Javascript

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread Brandon Bloom
Awesome work! In particular switching a top level definition from a fn to an object (which implements IFn) can cause problems. The compiler now issues warnings if this happens. I encountered something similar when implementing bound-fn and friends (see:

Re: Comprehensive ClojureScript Optimizations - Please Try!

2012-04-11 Thread Brandon Bloom
I needed a way to get the :dynamic flag when attaching a REPL to an already-compiled front end To clarify: You need the :dynamic flag to know now to emit a direct call. I implemented IFn and IDeref on Var. When emitting :var, I had to check :dynamic to see if I could emit namespace.var

Re: Should read-string support \x.. escaped characters?

2012-04-24 Thread Brandon Bloom
Surprisingly, this differs from JSON, which only supports \u... On Friday, December 23, 2011 5:43:00 PM UTC-8, Dave Sann wrote: When sending data as strings from clojurescript to clojure there will be issues if the source data contains certain unicode characters. (I think in range 128-255 -

CLJS: Cross-namespace analysis (and classpaths?)

2012-04-25 Thread Brandon Bloom
I've noticed that a lot of the new CLJS optimizations, such as direct arity dispatch, don't work correctly across namespaces. Upon deeper investigation, it seems like files are analyzed in an arbitrary order (alphabetically?) during builds. This means that the necessary metadata for such

Re: CLJS: Cross-namespace analysis (and classpaths?)

2012-04-25 Thread Brandon Bloom
The current optimizations are really only guaranteed to work on core.cljs. I encountered the dependency problem while working on the optimizations. It occurs to me that these sorts of optimizations would need to tunable. Direct arity dispatch, for example, eliminates an indirection which

Re: CLJS: Cross-namespace analysis (and classpaths?)

2012-04-25 Thread Brandon Bloom
cljs.closure/build takes a source path parameter where it recursively looks for cljs files. We could use this path for resolution. I've been *mostly* ignoring that file, since I haven't had to change it yet :-) I guess I need to study it some more. -- You received this message because

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-11 Thread Brandon Bloom
Maybe it makes sense to separate out the 'common testing interop' effort from the 'another test framework' effort, so it can can get off the ground? I agree with this. It's easier to solve fewer problems at once. Maybe you should reduce the scope to just the common result reporting schema? At

Re: generating core.logic queries

2013-06-21 Thread Brandon Bloom
Perhaps not, but apparently the developers of core.logic are. That's kinda a funny remark to make to David Nolen, who is *the* developer of core.logic. In this case, he's talking about this wiki page: https://github.com/clojure/core.logic/wiki/Extending-core.logic-(Datomic-example) That's

Re: representing clojure source code as data?

2013-06-21 Thread Brandon Bloom
I think there are 2 representations that could be useful: I think there are really two axis: 1) Shape of the data and 2) Language being described You've outlined 2 out of the 3 interesting (to me) shapes: 1) raw data structures and 2) datoms. I think that the 3rd interesting one is a

Re: representing clojure source code as data?

2013-06-23 Thread Brandon Bloom
By raw data structures, you mean the concrete implementing classes, a la clojure.lang.PersistentVector? Yes. (quote 1) - {:head :list :body [quote 1]} You're not going far enough with this. Here's how my code is representing that: {:composite :list, :items [{:value quote} {:value 1}]}

Re: ANN: ClojureScript release 0.0-1798

2013-06-25 Thread Brandon Bloom
Even if it's horribly broken, maybe we should default it to on for advanced builds anyway? It's not like anything can be harder to debug than raw advanced compilation output. Besides, we might get some more interest and contributions if it *feels* like it's close! On Tuesday, June 25, 2013

Re: core.async

2013-06-28 Thread Brandon Bloom
Are people in love with names like `!` and `!!`, or is there room for rethinking the naming? These operators are important and common enough to justify being *syntax* in Go, which is pretty minimal on syntax overall. Personally, I think the names are pretty good. -- -- You received this

Re: core.async

2013-06-28 Thread Brandon Bloom
CSP proper is amenable to certain kinds of automated correctness analysis. No work has been done on that front for core.async as yet. Although a far cry from Go's race detectorhttp://blog.golang.org/race-detector, Go did ship with one feature that is helpful for preventing a certain class of

Re: core.async

2013-06-29 Thread Brandon Bloom
I don't think it's published to a maven repository yet. You can check it out, install it with `lein install`, then depend on it via [core.async 0.1.0-SNAPSHOT] On Sat, Jun 29, 2013 at 2:50 PM, David Pollak dpollak...@gmail.com wrote: What's the entry in project.clj to use the core.async stuff?

Re: Is there a better way to update a map atom?

2013-06-29 Thread Brandon Bloom
Can anyone explain the relationship between swap! and reset! ? swap! is for CAS See: http://en.wikipedia.org/wiki/Compare-and-swap In the examples here, you're fully replacing a value, so reset! is fine... assuming that the replacement value was not derived from the existing value. If the

Re: Is there a better way to update a map atom?

2013-06-29 Thread Brandon Bloom
Could we please curb the pedantry? On Sat, Jun 29, 2013 at 9:21 PM, Ben Wolfson wolf...@gmail.com wrote: On Sat, Jun 29, 2013 at 6:06 PM, Cedric Greevey cgree...@gmail.comwrote: Who said swap *was* CAS, rather than was implemented *in terms of* CAS? In any event, your claim that no

Microsoft Rx -style operations with core.async

2013-06-30 Thread Brandon Bloom
Hi all, Today, primarily for my own edification, I've been implementing as many Microsoft Reactive Extensions operators as I can using core.async. The results have been *spectacular*. core.async is an absolute pleasure to work with. I'm so happy with how they have turned out, that I really

Re: Microsoft Rx -style operations with core.async

2013-06-30 Thread Brandon Bloom
I don't know the semantics of the MS functions so maybe this mirrors them This code is not an attempt to replicate the semantics of Rx, just provide a comparable set of operators. the implementations of take-while and drop-while remove an extra element from the argument channel, right? Yes.

Re: Microsoft Rx -style operations with core.async

2013-06-30 Thread Brandon Bloom
, if, when, if-let, and when-let are extremely convenient. Unfortunately, they are subtly bugged! You need nil? checks everywhere, cluttering up relatively nice code. On Sun, Jun 30, 2013 at 5:27 PM, Brandon Bloom brandon.d.bl...@gmail.comwrote: Hi all, Today, primarily for my own edification

Re: Microsoft Rx -style operations with core.async

2013-06-30 Thread Brandon Bloom
My understanding with some member of the core.async team is that most channel based APIs fns should *take* a channel and only construct one as a default. Could you elaborate on and motivate that? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Microsoft Rx -style operations with core.async

2013-06-30 Thread Brandon Bloom
Then maybe we need (go-as [c arg] ...) On Sunday, June 30, 2013 8:15:45 PM UTC-4, David Nolen wrote: Because of blocking on read/write on unbuffered channels - users might need more flexibility. On Sun, Jun 30, 2013 at 8:13 PM, Brandon Bloom brandon...@gmail.comjavascript: wrote: My

Re: core.async - question about close!

2013-07-01 Thread Brandon Bloom
close! is a control signal from producer to consumers. It's how you say Nothing else follows. It is not necessary for garbage collection. On Monday, July 1, 2013 2:43:02 AM UTC-4, puzzler wrote: Is close! merely a convenience function to ensure that future puts to a channel will not be

Re: Microsoft Rx -style operations with core.async

2013-07-02 Thread Brandon Bloom
When I first wrote this code, I intentionally avoided any custom syntactical sugar and worked as closely with the primitives as I could. After a few days away, I've used fresh eyes to abstract and revamp. The new code is *dramatically* cleaner and I only needed to introduce a few simple and

Re: core.async: communicating termination

2013-07-11 Thread Brandon Bloom
Wouldn't closed and drained predicates introduce race conditions? (Sorry for brevity, on my phone) -- -- 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 from new members are

Re: core.async: communicating termination

2013-07-12 Thread Brandon Bloom
However, if what one is trying is to *stop* putting values on the channel, I see no possible race conditions. Querying the state of a channel at worst leads to race conditions and at best leads to bad design. You're only supposed to close a channel from the producer side. So if you're the

Re: core.async: communicating termination

2013-07-12 Thread Brandon Bloom
You're only supposed to close a channel from the producer side. Why? First, an appeal to authority: http://golang.org/pkg/builtin/#close Notice the type of the argument: chan- That's a write-only port. Go's type system allows automatic coercion from read/write ports to constrained read or write

Re: [ANN]: Introducing lein-try

2013-07-13 Thread Brandon Bloom
This is awesome! I've totally wanted this. Unfortunately, I can't get it to work... ~ $ lein try '[clj-time 0.5.1]' nREPL server started on port 61689 REPL-y 0.1.10 Clojure 1.5.1 Exit: Control+D or (exit) or (quit) Commands: (user/help) Docs: (doc function-name-here) (find-doc

Re: [ANN]: Introducing lein-try

2013-07-13 Thread Brandon Bloom
-time' '0.5.1]' That seems to work, but it a bit awkward to use. On Sat, Jul 13, 2013 at 12:44 PM, Steven Degutis sbdegu...@gmail.comwrote: It looks like you're not supposed to quote the arguments you pass it. On Sat, Jul 13, 2013 at 11:27 AM, Brandon Bloom brandon.d.bl...@gmail.com wrote

Re: direction of an arrow in core.async

2013-07-14 Thread Brandon Bloom
When I read code like (- 1 2), I tranform it into (1 - 2) in my head I used to do this when I was first learning a lisp, but now I read + as sum instead of plus and - as subtract instead of minus. Similarly, if you see ( x y), you can say x less than y, but what about (= x y z)? Instead, I

subseq, garbage collection, and finalize

2013-07-28 Thread Brandon Bloom
Hi all, I'm trying to understand the object retention behavior when subseq is applied to sorted collections. A quick glance at the source of APersistentTreeMap.javahttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeMap.java suggests that the reified subseq only

Re: subseq, garbage collection, and finalize

2013-07-29 Thread Brandon Bloom
Thanks Cedric Patrick for the WeakReference and ReferenceQueue tips. Will try that next time. There is an initial instance without metadata Oh! That makes a lot of sense. Thanks much for figuring that out and explaining it. We could probably optimize that second allocation away relatively

Re: core.async channel GUID

2013-08-07 Thread Brandon Bloom
You can emulate this relatively easily with a pair of serialize/deserialize functions which read/write to a global atom containing a map. On Wednesday, August 7, 2013 7:15:55 PM UTC-4, David Pollak wrote: Howdy, I'm working on bridging between core.async channels in the browser and on the

Re: core.async - handling nils

2013-08-16 Thread Brandon Bloom
I ran into the other half of this problem: If you expect nils to signify closed channels, then you can't leverage the logically false nature of nil without excluding explicit boolean false values. Given the pleasant syntax of if-let / ! pairs, I reworked my early experiments to use if-recv

Re: core.async - handling nils

2013-08-16 Thread Brandon Bloom
have every other value come wrapped in a Just or Some-like constructor That's what I meant by a pair of quote/unquote operators -- -- 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

Re: core.async - handling nils

2013-08-17 Thread Brandon Bloom
work, but that seems to be a more complex solution (and also potentially with more overhead) than a sentinel value On Saturday, 17 August 2013 07:50:06 UTC+8, Brandon Bloom wrote: I ran into the other half of this problem: If you expect nils to signify closed channels, then you can't

  1   2   >