[ANN] com.stuartsierra/component 1.1.0

2022-02-26 Thread Stuart Sierra
Hello everyone, The first change in almost 2 years — it's a new release of Component! Component is a tiny framework for starting and stopping many stateful resources in the right order. This release adds the `subsystem` function

[ANN] [com.stuartsierra/component "0.4.0"]

2018-12-30 Thread Stuart Sierra
Component: managed lifecycles and dependencies for stateful objects https://github.com/stuartsierra/component ### Version 0.4.0 released to Clojars on December 30, 2018 * Add :extend-via-metadata to Lifecycle protocol for C

[ANN] [org.clojure/java.classpath "0.3.0"] with Java 9 support

2018-05-06 Thread Stuart Sierra
https://github.com/clojure/java.classpath - utility functions to search the Java classpath. Build #339 is complete, should be sync'd with the Maven Central repository soon. Release 0.3.0: * Fix [CLASSPATH-8

Re: Any better client then telnet for connecting to a socket repl server?

2018-03-10 Thread Stuart Sierra
I sometimes use inf-clojure mode in Emacs, which can connect directly to a socket REPL. I have a helper Elisp function inf-clojure-to-socket

Re: Is there some central information available on Java 9 compatibility for Clojure and tools

2018-02-25 Thread Stuart Sierra
There's no single source, but you can find issues with Clojure and contrib libraries by searching the Clojure JIRA for "Java 9". Toby Crawley started a small collection of known issues at github.com/tobias/clojure-java-9 –S On Sunday, February 25, 2018 at 11:01:

Re: Understanding remove-ns and require

2017-12-22 Thread Stuart Sierra
> > => CompilerException java.lang.Exception: namespace 'foo.bar' not found > after loading '/foo/bar', compiling:(*cider-repl foo*:65:7) > An error like this usually means that the ns declaration does not match the expected namespace name, based on the file path. Also be aware that AOT-compil

Re: Unexpected behaviour of transient map

2017-11-24 Thread Stuart Sierra
The way I like to think of it, if it helps: Transients are still *immutable*, but they are not *persistent*. Each new value *invalidates* the previous value. –S On Friday, November 24, 2017 at 11:01:48 AM UTC-5, Alex Miller wrote: > > Transients must still be used in the same calling pattern a

Re: Clojure <--> LISP

2017-07-09 Thread Stuart Sierra
Hi, Clojure is syntactically similar to other Lisps, but it is its own language with a unique design. In particular, Clojure emphasizes immutable data structures and a pure functional programming style more than “classic” Lisp does. Familiarity with other Lisp-like languages will make it easi

Re: Simultaneous development of a clojure project and an internal util library

2017-07-04 Thread Stuart Sierra
Hi Istvan, I often work with multiple source directories by temporarily adding them to the :source-paths in a Leiningen profile

Re: topic-fn returning more than one topic

2017-07-04 Thread Stuart Sierra
Hi Oded, I think you would have to implement your own message-routing to achieve this. Create one "output" mult for each topic, subscribe to them with `tap`, and route the messages to the channels as they arrive. Pseudo-code: (go-loop [] (when-some [message (! topic-ch message))) This is qui

Re: Spec's not being checked on macro expansion

2017-07-04 Thread Stuart Sierra
Hi Ed, I could not reproduce the behavior you described with Leiningen. Here is my test script: https://gist.github.com/stuartsierra/ca2b9bd7072224e099beb8b95b49b69c This issue might be caused by some pre-compiled files on the classpath when you run `lein test`. Since macros are evaluated durin

Re: Handling dependency conflicts

2017-03-13 Thread Stuart Sierra
This is a well-known problem in the JVM world, not just Clojure. The most common approach is: Always use the latest versions, and don't break backwards-compatibility. Most open-source Java and Clojure libraries are careful about not breaking backwards-compatibility. So in general, you're safe c

[moderated] I don't understand what (:t :t) means

2016-12-26 Thread Stuart Sierra
As a moderator, I am posting this message on behalf of a new forum user, below. I have edited the message for appropriate language. –Stuart S. From: silver1 silver1 Date: Mon, 26 Dec 2016 22:11:17 +0800 Subject: I don't understand (:t :t)mean ,please help me !! hello,everyOne,i'm a new clojure

Re: Idiom question

2016-09-28 Thread Stuart Sierra
I will answer the clojure.test question, since I wrote it. You can call clojure.test/is with *any* Clojure expression: if the expression returns logical true, the assertion passes. Having just the one expression keeps the scope of the testing library small. The `clojure.test/is` macro was desig

Re: get function

2016-09-13 Thread Stuart Sierra
The `get` function will accept `nil` as the map argument and return `nil`, but invoking `nil` will throw a NullPointerException. By convention, people use `get` when they don't know what the map argument is, since it might be nil. And we use keywords as functions when they are literals, like (:

Re: Deref Nil

2016-09-09 Thread Stuart Sierra
This approach would only work in ClojureScript, where IDeref is defined as a Protocol. In Clojure(JVM), the core functions are defined in terms of Java interfaces, which are not extensible to `nil`. I don't find atom-or-nil to be a common value pattern. But if it's something you encounter frequ

Re: map/filter/remove etc. change underlying structure

2016-09-09 Thread Stuart Sierra
Functions like map/filter/remove are not "collection functions" but rather "sequence functions." The collection functions like conj preserve the type of their argument. Sequence functions, by contrast, coerce any argument to a sequence, and always return a sequence. Since Clojure 1.7, transduce

Re: idiomatic way of counting loop iteration

2016-09-09 Thread Stuart Sierra
loop/recur is more typical for this kind of counting loop, as it avoids the risk of a stack-overflow when the number of iterations is high. Also, I recommend against the [a b & [n]] argument pattern here: https://stuartsierra.com/2015/06/01/clojure-donts-optional-arguments-with-varargs –S On F

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread Stuart Sierra
The first answer: test & measure. Benchmark your code, use a JVM profiler to find hotspots, etc. Test every change you make to see if it has a measurable improvement. Any assumptions about what “should” be faster/slower are likely to be wrong. The long answer: The JVM does not give you much co

Re: Downloading Clojure + Contrib Source

2016-04-04 Thread Stuart Sierra
Hi Chris, No, there is no single command I know of to automatically download all of the contrib libraries. It's something you could do with a shell script, I expect. But you probably don't need to do that if you're just interested in learning Clojure. 'contrib' just means things contributed t

Re: changes in logging in 1.8?

2016-03-15 Thread Stuart Sierra
Not sure, but possible related to http://dev.clojure.org/jira/browse/CLJ-1208 "Namespace is not loaded on defrecord class init" –S On Friday, March 11, 2016 at 12:20:44 AM UTC-5, Andy L wrote: > > Hi, > > I noticed that after upgrade to Clojure 1.8.0 (from 1.7.0) a weird > occurrence of loggin

Re: macro to unwrap a list

2016-02-15 Thread Stuart Sierra
A macro can't do this, it must return a single form. But the `apply` function can do something similar in the context of a function call. (apply foo '(1 2 3)) is the same as (foo 1 2 3) –S On Monday, February 15, 2016 at 2:05:52 PM UTC-5, Sonny To wrote: > > I am trying to write a macro to un

Re: “compiling” stacktrace error

2016-02-12 Thread Stuart Sierra
(.printStackTrace *e) will print the full stacktrace of the most recent exception to the standard error stream (STDERR) of the Java process. Depending on your REPL / tooling environment, stuff printed to standard error may not show up in your REPL. If that happens, try this: (.printStackTrace *

Re: conditional logic implemented as pattern-matching and restructuring in the signature of the function

2016-02-08 Thread Stuart Sierra
Clojure's destructuring is not the same thing as the "pattern matching" found in some other functional languages. Pattern matching can do various conditional checks, destructuring cannot. Clojure's "defn" supports destructuring in the argument list. Full pattern matching is available in Clojure

[ANN] org.clojure/tools.namespace "0.3.0-alpha3"

2016-01-05 Thread Stuart Sierra
tools.namespace https://github.com/clojure/tools.namespace Development tools for managing namespaces in Clojure. Parse ns declarations from source files, extract their dependencies, build a graph of namespace dependencies within a project, update that graph as files change, and reload files in

Re: org-mode Clojure babel

2016-01-03 Thread Stuart Sierra
I recently adapted my Emacs config to work with Org 8.3.2 and CIDER 0.10.0. Here it is.

Re: Possible bug in AOT-compiled Clojure when ns-unmap is used

2015-12-29 Thread Stuart Sierra
AOT-compilation breaks almost any code that tries to redefine Vars. I wouldn't expect this to work. —S On Monday, December 28, 2015, wparker30 wrote: > > I have found what appears to be a bug in AOT-compiled Clojure when > ns-unmap is used. I have the following reduced case: > > (ns unmap-test

Re: how to signal failure to start in Stuart Sierra's Component lib?

2015-12-23 Thread Stuart Sierra
This is an application design decision that will depend on how you want to handle failure in general. If the application cannot run without being able to start the component, then it is appropriate to throw an exception from the component's `start` method. This will abort the system start. The

Re: [Q] What would be the best approach or design for converting this common lisp code?

2015-12-20 Thread Stuart Sierra
Hi Sungjin, Although Clojure draws from the long history of Lisps, it is very much its own language. In particular, the emphasis on immutable data by default makes Clojure very different from both Common Lisp and Scheme. Porting code from another Lisp to Clojure will usually require a complete

[ANN] com.stuartsierra/component "0.3.1"

2015-11-28 Thread Stuart Sierra
https://github.com/stuartsierra/component Bugfix release 0.3.1 contains the following changes: - Fix #40 , incorrect values for ex-data keys in missing-dependency error Leiningen dependency: [com.stuartsierra/component "0.3.1"] Full c

Re: channels 1:1, callbacks many:many ?

2015-11-25 Thread Stuart Sierra
Hi, Channels are many-to-many in the sense that many processes can "put" values on the same channel, and many processes can be waiting to "take" a value. They are one-to-one in the sense that each "put" value will be delivered to exactly one "taker". What you're describing sounds like a typica

[ANN] org.clojure/tools.namespace "0.3.0-alpha2"

2015-11-13 Thread Stuart Sierra
tools.namespace — Parse ns declarations from source files, extract their dependencies, build a graph of namespace dependencies within a project, update that graph as files change, and reload files in the correct order. https://github.com/clojure/tools.namespace Leiningen-style dependency: [

[ANN] org.clojure/java.classpath "0.2.3"

2015-11-06 Thread Stuart Sierra
java.classpath — utilities to examine the Java classpath from Clojure programs. https://github.com/clojure/java.classpath Release 0.2.3. Leiningen dependency: [org.clojure/java.classpath "0.2.3"] This is a bugfix release. Changes: - Fix CLASSPATH-7

Re: org-mode Clojure babel

2015-11-04 Thread Stuart Sierra
Hi, Johannes, Sorry, I don't know. That error looks like an incompatibility of Elisp functions from different libraries. There are just too many different moving pieces here: Emacs, org-mode, CIDER, and nREPL. These projects are not coordinated with regard to version numbers and API incompatib

Re: org-mode Clojure babel

2015-11-03 Thread Stuart Sierra
Hi Johannes I have a working Org babel & Clojure in my Emacs setup. It's idiosyncratic to my preferences, but maybe it will be useful: github.com/stuartsierra/dotfiles

Re: Processing futures and promises asynchronously

2015-10-28 Thread Stuart Sierra
core.async and Transducers target some of this, although in a slightly different way. Instead of clojure.core/future, you can use core.async/thread or core.async/go. Instead of flatMap, you can use a `map` Transducer on a channel or in a core.async/pipeline. –S On Monday, October 26, 2015 at 6

Re: Where do I find javadoc for clojure interfaces?

2015-10-03 Thread Stuart Sierra
Interfaces like ISeq are internal details of Clojure's implementation. They're not part of the public API, so there is no guarantee that they won't change in future releases. –S On Thursday, October 1, 2015 at 4:59:12 AM UTC-4, crocket wrote: > > http://clojure.github.io/clojure/javadoc/ doesn

Re: Question on clojure.test thrown? and clojure.lang.ArityException

2015-09-21 Thread Stuart Sierra
I think this might be a special case related to inlining in the Clojure compiler. It has nothing to do with clojure.test. The hint is the name of the function in the error message: core/quot--inliner--4345 The "inlined" version of `quot` is defined for two arguments: https://github.com/clojure

[ANN] com.stuartsierra/component 0.3.0 now with ClojureScript

2015-09-18 Thread Stuart Sierra
'Component' - lifecycle and dependency management for objects with runtime state. https://github.com/stuartsierra/component Leiningen dependency: [com.stuartsierra/component "0.3.0"] Changes in this release: * Added ClojureScript support via Conditional Read (.cljc) * Minimum Clojure versio

ANN: org.clojure/tools.namespace "0.3.0-alpha1"

2015-08-14 Thread Stuart Sierra
tools.namespace: Parse ns declarations from source files and reload files in the correct order. https://github.com/clojure/tools.namespace This is an ALPHA release with some significant changes, including ClojureScript support (see below). It should be fully backwards-compatible with the 0.2.x s

Re: Atoms, reference to itself cause StackOverflowError

2015-08-07 Thread Stuart Sierra
Hi Simone, The stack overflow here is caused by the REPL trying to print a circular reference. `swap!` always returns the new value of the Atom, and the REPL tries to print it. If you don't print the Atom, this self-reference can still work: user=> (def a (atom {})) #'user/a user=> (do (swap!

Re: Tool authors: ClojureScript support in tools.namespace?

2015-07-28 Thread Stuart Sierra
Thanks for the responses everyone. So far, my general plan is starting to look like this: c.t.n.*dependency* and c.t.n.*track* are platform agnostic. c.t.n.*file* and c.t.n.*parse* can be extended to support Clojure & ClojureScript by adding an optional argument read-opts passed through to too

Re: Tool authors: ClojureScript support in tools.namespace?

2015-07-25 Thread Stuart Sierra
On Sat, Jul 25, 2015 at 11:15 AM, Bozhidar Batsov wrote: > it'd be great if we could provide the same functionality for cljs. I'd like to say I know how to do that, but I just don't think it's possible right now. The way tools.namespace does reloading in Clojure(JVM) depends on implementation de

Re: Tool authors: ClojureScript support in tools.namespace?

2015-07-25 Thread Stuart Sierra
On Sat, Jul 25, 2015 at 10:37 AM, Dylan Butman wrote: > Clojurescript support would be a fantastic improvement for reloading cljs > component systems. As I said, I am not planning a complete port of the reloading functionality of clojure.tools.namespace.repl to work in ClojureScript. The mechan

Tool authors: ClojureScript support in tools.namespace?

2015-07-24 Thread Stuart Sierra
Hello to anyone and everyone writing tools for working with Clojure and ClojureScript source files … I've been looking into adding better support for ClojureScript in tools.namespace. It's not a trivial problem. Lots of places in tools.namespace assume there is only one kind of source file. Fo

Re: Using Hystrix comes at a cost?

2015-07-24 Thread Stuart Sierra
Hi Lawrence, I think Clojure's concurrency primitives are more narrowly scoped than that. Clojure's most significant concurrency features (Atoms, Refs, Vars, Agents) are mostly about managing changes to *shared, mutable state* via pure functions. Hystrix is about managing code with unpredictabl

Re: #{:eduction :performance} Trying to understand when to use eduction

2015-07-20 Thread Stuart Sierra
Thanks for the correction, Alex. On Sunday, July 19, 2015 at 12:34:37 PM UTC-4, Alex Miller wrote: > seqs on eductions *are* chunked - they will fall into this case during > seq: > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L524-L525 > > which produces a chunk

Re: How to implement a distributed and concurrent system in Clojure?

2015-07-19 Thread Stuart Sierra
Absolutely would use again. But I'm biased towards Clojure already. :) –S On Sunday, July 19, 2015 09goral wrote: > > Thanks Stuart for your answer, it is very helpfull. Would you choose > Clojure again ? > > 2015-07-19 17:13 GMT+02:00 Stuart Sierra: > >> >> T

Re: #{:eduction :performance} Trying to understand when to use eduction

2015-07-19 Thread Stuart Sierra
Hi Leon, I think this is an edge case related to how varargs functions are implemented in Clojure. The varargs arity of `max` is implemented with `reduce1`: core.clj line 1088 `red

Re: How to implement a distributed and concurrent system in Clojure?

2015-07-19 Thread Stuart Sierra
This is an old thread, but it showed up in my Google Groups so I figured I would give an answer. I have worked on fairly large (10-50 machines) distributed systems written entirely in Clojure. The language itself doesn't provide an explicit mechanism for communication between machines, so you

Re: component: dynamic configuration

2015-07-07 Thread Stuart Sierra
Hi pyr, There are many downsides to hierarchical structure of components and systems. The effects are complicated and hard to understand. See, for example, the discussion at https://groups.google.com/forum/#!topic/clojure/2-baBp61XTs/discussion I recommend that system maps be kept "flat," witho

Re: component: dynamic configuration

2015-07-07 Thread Stuart Sierra
Not sure if this helps, but remember that components and systems are just records, and records behave like maps. You can construct an empty `system-map` and then `assoc` components or even `merge` other maps into it. –S On Tuesday, July 7, 2015 at 1:00:51 PM UTC-4, Pierre-Yves Ritschard wrote:

Re: Calling an overloaded Scala function

2015-06-25 Thread Stuart Sierra
Scala has to compile down to JVM bytecode just like Clojure, but it may change method signatures along the way. You could try running `javap` to disassemble the compiled Scala bytecode and figure out what the method signatures actually are. Or use Java reflection to examine the objects you have

Re: side-effecting re-/transducers

2015-06-25 Thread Stuart Sierra
Hi Sam, Transducers are a new feature, and best practices are still emerging. Transducing/reducing is always non-lazy, so it's *less* risky to have side effects in a reduce compared with side effects in a lazy sequence. Still, I would offer the same advice I give for lazy sequences. Keep your

Re: Writing REST api the right way

2015-06-24 Thread Stuart Sierra
On Tuesday, June 23, 2015, Mike Grabowski wrote: > ... I just can't stop thinking about non-blocking evented > IO interactions. It just does not feel right to me to > block the thread when e.g. logging in an user. > Unfortunately, there are no NIO drivers for the database > engines I am interested

ANN: org.clojure/tools.namespace "0.2.11"

2015-06-19 Thread Stuart Sierra
tools.namespace: parse namespace declarations and reload files in dependency order. https://github.com/clojure/tools.namespace Release 0.2.11 contains the following changes: * [TNS-34] Support for reader conditionals tools.namespace still works only in Clojure(JVM), not ClojureScript. But it

Re: Problem with loading protocols dynamically from checkouts

2015-06-09 Thread Stuart Sierra
Reloading a protocol definition invalidates any instances of objects which implement the protocol. This may be the problem you are seeing. After reloading a protocol definition, you must also reload any code with `deftype`, `defrecord`, or `reify` which implements the protocol, THEN re-evaluate

Re: Advice when running java -jar rather than a managed server like tomcat?

2015-05-27 Thread Stuart Sierra
JSVC (Apache Commons daemon for Unix) is excellent for this sort of thing. There's a Windows Services version too. –S On Tuesday, May 26, 2015 at 12:38:30 PM UTC+1, Colin Yates wrote: > > Hi, > > I am venturing into new territory using http-kit, as I usually use a > 'managed' web server contain

Re: [Component] - Remove (dissoc) component from system

2015-05-27 Thread Stuart Sierra
Hi Édipo, I'm not sure I understand the question. Why do you want to remove a component from the system after it has been started? Systems are just records, which behave like maps, so `assoc` and `dissoc` should work normally. But the process of starting a system creates copies of components t

Re: what demonstrates Stuart Sierra's "State/Event Pattern"

2015-05-26 Thread Stuart Sierra
2015 at 10:57:22 PM UTC+1, piastkrakow wrote: > > Stuart Sierra, > > Thank you for the response. I won't take that talk as encyclopedic. > The 'chain-consequences' function is very interesting, though it is > unfamiliar to me. I am still learning about Clojure.

Re: what demonstrates Stuart Sierra's "State/Event Pattern"

2015-05-25 Thread Stuart Sierra
This is a pattern I have used **occasionally**. That whole talk is just patterns that were in my head at the time. Take whatever you find useful from it, but don't treat it as a universal or complete list. If you squint, that 'chain-consequences' function behaves sort of like a monad, but I wo

Re: Using :refer 'sparingly'

2015-05-17 Thread Stuart Sierra
Just like the rest of the article, it's about readability. With `:refer` you don't know where a symbol came from when you encounter it in the middle of the code. –S On Sunday, May 17, 2015 at 4:05:14 PM UTC+1, Akiva Schoen wrote: > > In Stuart Sierra's article here > (http://stuartsierra.com

Re: Managing database schema

2015-05-14 Thread Stuart Sierra
You can put a .sql file in /resources and read it with clojure.java.io/resource. –S On Thursday, May 14, 2015 at 9:45:31 AM UTC+1, Colin Yates wrote: > > Is there a lib that will allow me to have my sql defined in a file which I > can reference from Clojure? I cannot use one of the existing mig

Re: separation of concerns w/o encapsulation

2015-05-10 Thread Stuart Sierra
I find it's really the same as in any other language. Certainly if you don't have any clearly-defined boundaries at all, you'll get a big ball of mud. Encapsulation is about code organization and self-discipline. Define module responsibilities and boundaries in your developer documentation. Mak

Re: Adding components to a stuartsierra/component system at runtime

2015-05-03 Thread Stuart Sierra
Hi Chap, There isn't, unfortunately, a good way to modify systems after they have are started. I have put a fair amount of thought into this but never come up with a solution I was satisfied with. In your case, I think I would suggest creating one system just to load the configuration data an

Re: Minimum Viable Database Component

2015-04-30 Thread Stuart Sierra
Hi Andy, That was just an example I made up for the slides, and not a very good one. Usually, the functions/protocols you implement for your components are specific to your application. –S On Thursday, April 30, 2015 at 4:54:38 AM UTC+1, Andy Chambers wrote: > > Hi All, > > I'm trying to foll

Re: wondering the reasons to choose defrecord vs reify in stuartsierra/component

2015-04-29 Thread Stuart Sierra
Hi Juan, Components are records in order to support the dependency-injection features of `component/start-system`, which work via `assoc`. There are potentially many other ways to do dependency injection, but I found `assoc` to be practical. If you want to create a component that has a Lifecyc

Re: Explicitly document return values in some core.async functions?

2015-04-22 Thread Stuart Sierra
core.async is still technically alpha, so everything is potentially subject to change. Rich H. wrote[1] most of those core.async functions, and he tends to treat the docstring as the only contract for future releases. If you want to be safe, make a unit test in your app that specifically tests

Re: Composing Stuart Sierra's components

2015-04-16 Thread Stuart Sierra
tem at :dep >>> >>> This happens because of the following: >>> 1. Dependency :*dep* of *sys1* is started in *hsys* >>> 2. *sys1* is started (:*dep* is started again, so the start/stop should >>> be idempotent) >>> 3. Dependency :*sys1*

Re: Datomic namespaced idents question

2015-04-06 Thread Stuart Sierra
On Sunday, April 5, 2015, Stig Brautaset wrote: > I understand that you must use namespaces in idents for > logically distinct types of entities. ... > My question is: do you expose this namespacing outside the > model layer when working in Clojure? I find it easier when there are as **few** trans

Re: Composing Stuart Sierra's components

2015-03-18 Thread Stuart Sierra
On Tue, Mar 17, 2015 at 5:47 PM, James Gatannah wrote: > FWIW, we've been using something that smells an awful lot like nested > systems for months now. I never realized we weren't supposed to. > It's not that nested systems *never* work, but from what I've seen they cause more complications th

Re: Composing Stuart Sierra's components

2015-03-12 Thread Stuart Sierra
On Wednesday, March 11, 2015, Colin Yates wrote: > I can't merge the two systems because the reusable > component is chocka full of very fine grained command > handlers and both the internal and external systems will > have their own 'bus' for example. I could namespace the > keys but that again fe

Re: Could use a better error message here (using a list in update-in)

2015-03-10 Thread Stuart Sierra
Please file a ticket in JIRA and tag it with "errormsg" http://dev.clojure.org/display/community/Creating+Tickets –S On Tuesday, March 10, 2015 at 3:13:36 PM UTC, John Gabriele wrote: > > In Clojure v1.6.0. This one confused me when I'd accidentally passed a > list in to `update-in` instead of

ANN: [com.stuartsierra/component "0.2.3"]

2015-03-03 Thread Stuart Sierra
A tiny update to my "Component" library. https://github.com/stuartsierra/component Leiningen: [com.stuartsierra/component "0.2.3"] Changes in this release: * More-specific error message when a component returns nil from start or stop -- You received this message because you are subscribed t

ANN: org.clojure/tools.namespace "0.2.9"

2015-02-01 Thread Stuart Sierra
tools.namespace: parse namespace declarations and reload files in dependency order. https://github.com/clojure/tools.namespace Release 0.2.9 contains the following changes: * Fix [TNS-20]: Undefined 'unload' order after namespaces are first added to an new, empty tracker. * Improvement

Re: When to use metadata

2015-01-30 Thread Stuart Sierra
Almost never. Seriously, anything important enough to be included in your program's input or output is almost certainly important enough to be *data*, not metadata. And the non-equality-checking semantics of metadata are confusing. About the only place I've found metadata to be worthwhile is m

[ANN] org.clojure/tools.namespace "0.2.8"

2014-12-19 Thread Stuart Sierra
tools.namespace: parse namespace declarations and reload files in dependency order. https://github.com/clojure/tools.namespace Release 0.2.8 contains the following changes: * Improvement [TNS-31]: Specific error message when `:after` symbol passed to `refresh` cannot be resolved. * Fix

Re: clojure.edn won't accept clojure.java.io/reader? How to work around this and why isn't this documented anywhere?

2014-12-08 Thread Stuart Sierra
As the original author of the function that eventually became clojure.java.io/reader, it was one of those unfortunate decisions that seemed like a good idea at the time and cannot be changed without breaking backwards compatibility. Long before EDN existed, I wrote clojure.contrib.io https://g

Re: Function order in Clojure vs scripting languages

2014-12-07 Thread Stuart Sierra
Yes, it's about the size of a compilation unit and how to handle undefined references. Rich Hickey posted this https://news.ycombinator.com/item?id=2467359 detailing the trade-offs involved in choosing Clojure's strategy. -S On Sunday, December 7, 2014 9:37:40 AM UTC-5, Ashton Kemerling wrote:

Re: Core.async unordered pipeline-blocking ?

2014-11-29 Thread Stuart Sierra
Here's a version I did that only uses as many threads as necessary to keep up with the input, subject to an upper bound: http://stuartsierra.com/2013/12/08/parallel-processing-with-core-async –S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

Re: Idiomatic way to return a single value from an async function

2014-11-11 Thread Stuart Sierra
Similarly, but I would be explicit about the different arities, to avoid the intermediate sequence created by [arg & [option]] and to get errors if there are too many arguments. (defn foo ([input] (foo input (chan 1)) ([input ch] ... do something and put to ch ...)) If your function ca

Re: For async, expose the channel directly or expose a function?

2014-10-04 Thread Stuart Sierra
On Sat, Oct 4, 2014 at 12:31 AM, Brian Guthrie wrote: > But I'm troubled by the idea of accepting channels as arguments, even > though there's a lot to be said for consumer control of buffer sizes (to > say nothing of providing potential fakes for test purposes). In that > scenario you'd essentia

Re: For async, expose the channel directly or expose a function?

2014-10-03 Thread Stuart Sierra
You generally provide more power and flexibility to consumers by handing them channels. That way the consumer can use things like transducers and pipelines. For maximum flexibility, allow the consumer to *pass in* the channels to be used for input / output. That way the consumer gets to decide

Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-22 Thread Stuart Sierra
I'm not sure I understand what you mean. `remove-ns` does not remove the namespace from the set of "loaded" namespaces kept by `require`. tools.namespace has a hack

[ANN] org.clojure/tools.namespace "0.2.7" fixes broken 0.2.6

2014-09-20 Thread Stuart Sierra
tools.namespace: parse namespace declarations and reload files in dependency order. https://github.com/clojure/tools.namespace Release 0.2.7 reverts a bad commit, mistakenly included in 0.2.6, which could cause the 'unload' order of namespaces to be incorrect. The impact of this bug is minimal,

ANN: org.clojure/tools.namespace "0.2.6"

2014-09-08 Thread Stuart Sierra
tools.namespace: parse namespace declarations and reload files in dependency order. https://github.com/clojure/tools.namespace Release 0.2.6 contains the following bugfixes: * `clojure.tools.namespace.parse/read-ns-decl` asserts that its argument is a PushbackReader, instead of silently re

ANN: [com.stuartsierra/component "0.2.2"]

2014-09-07 Thread Stuart Sierra
Component: managed lifecycle and dependency injection for stateful objects https://github.com/stuartsierra/component Release 0.2.2 contains the following minor enhancements: * System maps print as `#` to avoid trying to print huge objects in the REPL. * Added error helpers `ex-component

Re: clojure + clojure-contrib offline documentation

2014-08-01 Thread Stuart Sierra
I think clojure.github.io is just the gh-pages of all the individual projects under github.com/clojure, so you should be able to grab the gh-pages of each one. For example, https://github.com/clojure/tools.namespace/tree/gh-pages The root index at clojure.github.io is just another repo at http

Re: clojure.stacktrace/root-cause VS clojure.repl/root-cause, are they redundant?

2014-07-24 Thread Stuart Sierra
They're just different versions of the same thing, written at different times by different people, that both got merged into Clojure at different times. Speaking as the original author of clojure.stacktrace, I now think neither one of them should exist. The .printStackTrace method on an excepti

[ANN] tools.namespace 0.2.5

2014-07-16 Thread Stuart Sierra
*tools.namespace:* finding, parsing, and reloading Clojure namespaces in correct dependency order https://github.com/clojure/tools.namespace *Release 0.2.5* Leiningen dependency: [org.clojure/tools.namespace "0.2.5"] This release contains bugfixes, performance enhancements, and minor featu

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Stuart Sierra
On Tuesday, June 17, 2014 6:14:27 PM UTC-4, Gary Trakhman wrote: > > I'm not sure if the STM guarantees any ordering, but you'd probably want > to be explicit. > Two or more `send`s or `send-off`s from the *same* thread will be delivered in the order they were sent. There are no guarantees abou

[ANN] data.json 0.2.5

2014-06-13 Thread Stuart Sierra
data.json: parsing and generating JSON in pure Clojure https://github.com/clojure/data.json Leiningen dependency information: [org.clojure/data.json "0.2.5"] This is a bugfix release. Changes: - DJSON-17: do not print Infinity or NaN floating-point values This is a clojure-contri

Re: Registering commands in a command language

2014-05-31 Thread Stuart Sierra
You can use the namespace itself as the mapping. For example: (ns app.commands) (defn dothis [& args] ...) (defn dothat [& args] ...) (ns app) (defn execute-command [name & args] (let [var (ns-resolve 'app.commands

Re: Using records as handles vs. complete representations

2014-05-23 Thread Stuart Sierra
I would say do one of: - define your own constructor functions like (defn user [id] ...) - use the map->User constructors created by defrecord - do not specify the non-required keys as fields in the defrecord - use plain maps On Friday, May 23, 2014 4:47:43 PM UTC-4, Elliot wrote: > > There see

Re: Headless server, no GUI, no idea

2014-05-09 Thread Stuart Sierra
This sounds more like a problem with remote access to X-Windows (the Unix graphical back-end) than a Clojure-specific problem. You might find some helpful answers in Ubuntu docs, forums, or chat rooms. -S On Friday, May 9, 2014 6:57:26 AM UTC-4, stiffyrabbit jr wrote: > > Hi, > > What should my

Re: Managing State Changes, using Component

2014-05-07 Thread Stuart Sierra
y printing them, which shows a unique hash of each Atom's identity. -S On Monday, May 5, 2014 6:25:55 PM UTC-4, frye wrote: > > Ahh, so that was it then. Yeah, I definitely created that atom in the > start method. > > > On Mon, May 5, 2014 at 3:27 PM, Stuart Sierra &g

Re: Managing State Changes, using Component

2014-05-05 Thread Stuart Sierra
At what point did you **create** the Atom in :a? Any mutable references which need to be shared among all usages of a component must be created in the **constructor**, not the `start` or `stop` methods. -S On Wednesday, April 30, 2014 5:13:15 PM UTC-4, frye wrote: > > Hi all, > > I'm having a

Re: How to troubleshoot FileNotFoundException: Could not locate clojure/tools/namespace/parse...?

2014-04-03 Thread Stuart Sierra
On Wednesday, April 2, 2014 7:49:07 AM UTC-4, Jakub Holy wrote: > > When starting lein (namely lein ring server) I got a little helpful > exception and stack trace with the key line being: > > FileNotFoundException: Could not locate > clojure/tools/namespace/parse__init.class or > clojure/tool

Re: [ANN] Clojure 1.6

2014-03-31 Thread Stuart Sierra
Yes, during the upgrade to the new Nexus release plugin (required by Sonatype OSS) we forgot to include the "distribution" profile, which builds the ZIP, in the Hudson configuration for Clojure. I've updated the Hudson configuration, so future releases should get a ZIP. I will manually build a ZI

Re: [ANN] Clojure 1.6

2014-03-31 Thread Stuart Sierra
Oof, it's been ages since I looked at that stuff. I'll take a look. -- 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 moderated - please be patient with y

  1   2   3   4   5   6   7   8   9   10   >