Re: hashmap keys

2017-11-09 Thread Timothy Baldridge
Most Clojure collections cache their hashcode, so that improves things quite bit. Also, very large collections are rarely used as *keys* in other maps. Most of the time key collections are one or two values. This means that what we're really talking about is combining the hash values of a few value

Re: functional implementation of core.async primitives

2017-11-12 Thread Timothy Baldridge
If you're looking for feedback, the input I gave on Reddit seems like a good place to start ( https://www.reddit.com/r/Clojure/comments/7c0p3c/functional_implementation_of_coreasync/dpmvjpp/). Like I said, it's not really comparable to core.async at all, since it doesn't properly support thread syn

Re: functional implementation of core.async primitives

2017-11-15 Thread Timothy Baldridge
I don't think the go blocks play well with the back-pressure. The code I present here deadlocks the scheduler: https://github.com/divs1210/functional-core-async/issues/1 On Wed, Nov 15, 2017 at 2:17 PM, Jay Porcasi wrote: > interested to hear any feedback on these features > > > On Wednesday, No

Re: spec for an agent

2017-11-17 Thread Timothy Baldridge
All clojure ref types have validators that are perfect for this use case: https://clojuredocs.org/clojure.core/set-validator! On Fri, Nov 17, 2017 at 1:58 PM, Peter Hull wrote: > I am using agents whose state is a map. I have a spec for this map, > ::agent-state. What's the best way to validate

Re: spec for an agent

2017-11-17 Thread Timothy Baldridge
And google doesn't like that link, copy-paste that URL including the "!" On Fri, Nov 17, 2017 at 2:00 PM, Timothy Baldridge wrote: > All clojure ref types have validators that are perfect for this use case: > https://clojuredocs.org/clojure.core/set-validator! > > O

Re: functional implementation of core.async primitives

2017-11-22 Thread Timothy Baldridge
I'm not exactly sure how the library works, honestly. It's seems that we still don't have parking take, instead we have callbacks again? I'd love to see an implementation of something like this with your library: (go (println "Count" (loop [acc 0] (if-some [v ( wrote: > Thanks for the

Re: Unexpected behaviour of transient map

2017-11-24 Thread Timothy Baldridge
But this behavior is already documented in the official transients overview at http://clojure.org/transients On Fri, Nov 24, 2017 at 5:46 PM Matching Socks wrote: > I would go so far as to (light-heartedly) call the "assoc!" docstring > booby-trapped. > > There is an open issue in Jira for it.

Re: Unexpected performace of transducers

2017-11-27 Thread Timothy Baldridge
>> Also, I think the transducer version should always be faster, no matter the size of the source collection (no threshold). It's a bit more complicated than that, mostly because transducer pipelines require about 2 allocations per step during creation. Also, most of the performance boost from tra

Re: State & GUIs

2017-12-02 Thread Timothy Baldridge
I think the major leap functional languages (esp. CLJS because that's where it started) have made in the UI world is in the area of React-style virtual DOM setups. The overall view is this: datamodel -> view generation -> dom differ -> UI -> events -> datamodel The idea being that you can code in

Re: IF, WHEN or SOME

2017-12-11 Thread Timothy Baldridge
I talked a bit about this in my video on Boolean Blindness: https://www.youtube.com/watch?v=K1LaaJMscCc Might be worth a watch. On Mon, Dec 11, 2017 at 4:56 PM, Stephen Feyrer wrote: > Hi there, > > I have been trying to shake this thought for a while now. Essentially, my > thought was if you

Re: functional implementation of core.async primitives

2017-12-13 Thread Timothy Baldridge
Great! So while this works, you'll still have a few problems, namely in places that are not in a tail call position. For example, core.async support this sort of behavior ;; inside an argument list (not a let) (go (println "GOT Value" ( wrote: > I just added `goloop` and `goconsume` to the Cloj

Re: Slow -main function termination by pmap

2017-12-19 Thread Timothy Baldridge
Sometimes there's some weird interop with stuff like pmap and program termination. What happens if you end your program with this function: https://clojuredocs.org/clojure.core/shutdown-agents On Tue, Dec 19, 2017 at 1:05 PM, Jacek Grzebyta wrote: > Hi, > > I have multi -mains project. Thus the

Re: Officially support Vert.x

2017-12-30 Thread Timothy Baldridge
Multi-process polyglot systems I understand, they aren't common, but I've seen them. In most cases, immutable queues and HTTP APIs work great. But (and pardon my bluntness), why would I ever want a polyglot single process system? That sounds like a major design mis-step. The overhead of mental cont

Re: Officially support Vert.x

2018-01-10 Thread Timothy Baldridge
A few other points of design: 1) Move the requires into the `ns` form: (ns example.simple-http-server (:require [io.vertx.clojure.core.core :as core] [io.vertex.lang.clojure.vertx :as vertx])) 2) If you make sure that your functions always return the first argument passed to th

Re: If Clojure is to blame for the majority of the startup time, why doesn't ClojureScript proportionally slow down the JavaScript startup time also?

2018-01-25 Thread Timothy Baldridge
Really, any comparisons between JS and JVM startup times are not useful at all. For a long list of reasons, not limited to: * CLJS doesn't have Vars, CLJ does * JS VMs are highly tuned for excellent startup times * JVM Bytecode is a binary format expressing classes, JS files are text files express

Re: If Clojure is to blame for the majority of the startup time, why doesn't ClojureScript proportionally slow down the JavaScript startup time also?

2018-01-25 Thread Timothy Baldridge
ms in play here are completely different. So I re-state what I said before: it's apples-to-oranges. But I'd love to see more benchmarks in this thread, so far we only have opinions. On Thu, Jan 25, 2018 at 9:37 PM, Timothy Baldridge wrote: > >> If Var reification is part of the s

Re: If Clojure is to blame for the majority of the startup time, why doesn't ClojureScript proportionally slow down the JavaScript startup time also?

2018-01-25 Thread Timothy Baldridge
>> If Var reification is part of the slowness of Clojure startup over Java's It's really not. If you completely removed vars from Clojure on the JVM, Clojure wouldn't be faster by any measurable amount. If someone has benchmarks that say that Vars themselves are the cause of Clojure JVM's slower s

Re: transients problem

2018-02-24 Thread Timothy Baldridge
Yes, transients mutate when updated. Seqs over sets are a immutable view over a collection. So if someone did get this to work, the implementation could be incorrect. And you could get something really strange like this: (def s (transient #{1 2})) (def sq (seq s)) (first sq) => 1 (disj s 1) (secon

Re: transients problem

2018-02-24 Thread Timothy Baldridge
>> If it happens to work, it is accidental, and should not be relied on. Yes, and no. The actual order may change between Clojure releases (last time it changed was with 1.6), or between two equal collections, but the ordering will not change between two calls to `seq` on the same instance of a h

Re: Why does the `def-` not exist?

2018-02-26 Thread Timothy Baldridge
I much more prefer putting implementation details into separate namespaces. >From there it's simple to mark them as :no-doc in some documentation tools so that the vars don't get published. That way I can still test all my code, and yet I can commit to only those namespaces that have published APIs

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

2018-03-03 Thread Timothy Baldridge
Sadly NREPL isn't a REPL it's a RPC protocol transport for remote controlling a Clojure instance. You might look into rebel: although I'm not sure how well that plays with remote terminals. https://github.com/bhauman/rebel-readline. Also look into doing some of this with readline. Perhaps you ca

Re: D&D + Clojure?

2018-03-27 Thread Timothy Baldridge
Nice! I think I used this app the other day when working on a campaign and didn't know it was using Clojure. I'd be open to contribute in my spare time. What's the process for getting involved? Timothy Baldridge On Tue, Mar 27, 2018 at 2:03 PM, Larry Christensen wrote: >

Re: Writing a text adventure in Clojure

2018-03-29 Thread Timothy Baldridge
You often don't even need functions for this sort of thing. This is what is often called "data driven" programs. Simply define this as a hashmap with :description, :items, etc and then a single function that introspects this data and figures out how to describe the room. Also you might want to rea

Re: clojure.lang.PersistentVector cannot be cast to clojure.lang.IAtom

2018-04-03 Thread Timothy Baldridge
I think you're calling `deref` on the collection before passing it in? What it's saying is that `swap!` expects an atom and you handed it a vector. So either pass in the atom, or return a updated collection by replacing the call to `swap!` and the `doseq` with `(into collection selecteds)` On Tue,

Re: Understanding GraalVM and Clojure

2018-04-19 Thread Timothy Baldridge
GraalVM does a lot of things, and I think it's important to separate these terms. GraalVM - most often this is used to refer to a project that was originally designed to be a implementation of the JVM in Java. So when people ask "does X run on GrallVM" the question is really "does X run in the JVM

Re: Is the vector a sequence?

2018-04-20 Thread Timothy Baldridge
It's not a seq, but it's seqable. (seq? [1 2]) => false (seqable? [1 2]) => true (seq? (seq [1 2])) => true On Fri, Apr 20, 2018 at 9:33 AM, ru wrote: > Hi, > > user=> (seq? [1 2 3 4 5]) > > false > > user=> > > > Sincerely, > > Ru > > -- > You received this message because you are subscrib

Re: Is the vector a sequence?

2018-04-20 Thread Timothy Baldridge
seqable? was added in Clojure 1.9 On Fri, Apr 20, 2018 at 9:54 AM, ru wrote: > user=> (seqable? [1 2]) > > > CompilerException java.lang.RuntimeException: Unable to resolve symbol: > seqable? in this context, compiling:(/private/var/ > folders/5j/k0rtjxqn3b57nykc_1jf2xnrgn/T/form- > init6382

Re: Clojure on Azul Zing JVM

2018-05-21 Thread Timothy Baldridge
I've worked on several projects where Zing was considered as a solution to a few problems (normally GC pauses due to really large heaps). But in the end we never trailed it, due to a few factors: 1) Zing isn't super cheap, it's not that expensive in the grand scheme of things, but it's an addition

Re: core.async buffered channel behavior

2018-06-27 Thread Timothy Baldridge
The best way to understand how/why this happens is to look at the source of >!!. In short, the thread making the call doesn't block on the channel. It starts an async put, then waits on a promise that is delivered by the async put. So it works something like this: 1) Calling thread creates a promi

Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-22 Thread Timothy Baldridge
The whole "conj puts items in a place that's idiomatic for the collection" makes stuff like `into` possible. In fact, into is (ignoring transients): (defn into [dest src] (reduce conj dest src)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: How to escape a space in a keyword?

2018-08-09 Thread Timothy Baldridge
Have you tried this with Transit instead of EDN? From what I understand by all this Transit shouldn't have problems with spaces in keywords/strings as it doesn't print them in the same way, it's more of a marshaling format than a printer/reader, and you get the big upside of Transit being *way* fas

Re: Is core.async a stackless or stackfull coroutine implementation?

2018-08-26 Thread Timothy Baldridge
They're mostly stackful, but this distinction really doesn't apply to Java where you can't manipulate the stack like C (or hand written) languages can. The normal call stack is used for any functions called by a go block, and for the go block itself. However when a go block pauses, it copies values

Re: New developments in beginner-friendly editing/repl environments?

2018-08-30 Thread Timothy Baldridge
> I never understood how Python is so popular, where spacing is most important. > Using tab and shift tab to control parens is really intuitive, because I want to structure my code anyway and doing it the parinfer way is no big adjustment. I think you answered your own question On Thu, Aug 30, 2

Re: Prototype code for enhanced CIDER code completion for Java methods

2018-10-16 Thread Timothy Baldridge
I don't understand why this is needed. Why can't cider code complete on the normal method format? What's the problem this code is trying to solve? Timothy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Prototype code for enhanced CIDER code completion for Java methods

2018-10-16 Thread Timothy Baldridge
ld get a compile time error rather than just a > reflection warning about a non-existent java method. > - In addition to making easier to *write* Java interop, I think it makes > it easier to *read* Java interop > I immediately know the Java type while reading the code, no need to &

Re: [ANN] 1.10.0-beta5

2018-11-08 Thread Timothy Baldridge
The instance based polymorphism is a bit wonky in some cases. Can we get some sort of spec that tells us what the rules are for resolution? See these cases where it breaks in some rather strange ways. Clojure 1.10.0-beta5 user=> (defprotocol ILevel (level [this])) ILevel user=> (extend-protocol IL

Re: [ANN] 1.10.0-beta5

2018-11-08 Thread Timothy Baldridge
Nope, you're right, I missed the "extend, extend-type, extend-protocol" part of the original post. On Thu, Nov 8, 2018 at 10:12 AM Alex Miller wrote: > > On Thursday, November 8, 2018 at 10:44:34 AM UTC-6, tbc++ wrote: >> >> The instance based polymorphism is a bit wonky in some cases. Can we ge

Re: [ANN] Clojure 1.10.0-beta8

2018-11-21 Thread Timothy Baldridge
>> We’re good with the name. The docstring exists for further explanation. Except the code is less-readable. The name is meaningless. "async-require" appends the adverb "async" to the verb "require", therefore making it an asynchronous variant of require, which is exactly the opposite of what th

Re: [ANN] Clojure 1.10.0-beta8

2018-11-21 Thread Timothy Baldridge
one who contributed code agreed in > advance to give him co-ownership). Project maintainers get to craft the > rules by which changes are made, for any project. Some choose to turn it > over to a committee, others do not. > > Andy > > > On Wed, Nov 21, 2018 at 11:25 AM Timot

Re: Using go/

2015-07-30 Thread Timothy Baldridge
My advice is to treat channel ops (!) as IO, which they are. In functional programming we try to stay away from doing IO deep down inside a call stack. So don't do that. Instead use async/pipeline functions and channel transducers to create pipelines and flow the data through them. A sort of anti-

Re: add-watch and writing data into a core.async channel

2015-07-31 Thread Timothy Baldridge
One "gotcha" is that atoms add-watches do not always guarantee order semantics. So if you have a watch put [old-val new-val] on a channel, and your atom operation is something like (swap! a inc), you may see values in your channel like this: [0 1] [2 3] [1 2] [3 4] [6 7] [4 5] This is because the

Re: Anotating functions for pre-processing

2015-08-05 Thread Timothy Baldridge
I would also recommend reconsidering the premise that this is a feature that is needed. Go back to what your design goals and think about implementing them in a slightly different way. Function composition, for example, can do all sorts of wonderful things. At the risk of sounding rude, I've been

Re: Durable atom

2015-08-16 Thread Timothy Baldridge
I don't recommend Avout as it hasn't been worked on for some time, and never did get around the rather critical flaw in its design: https://github.com/liebke/avout/issues/1 On Sun, Aug 16, 2015 at 3:25 PM, Andy- wrote: > You might like some of immutant's stuff: > > http://immutant.org/documentat

Re: using core.async results in page getting replaced with empty iframe

2015-08-19 Thread Timothy Baldridge
core.async has nothing to do with the DOM, so I don't know how this could happen. On Wed, Aug 19, 2015 at 3:00 PM, Malcolm Sparks wrote: > Would you mind pasting the rest of your dependencies? This is the most > curious of puzzles and I'd love to know the answer - but I'm really stumped > so ple

Re: Rabid wild animals in my clojure argument lists, code gets infected.

2015-08-23 Thread Timothy Baldridge
It's generally considered better practice to pass maps to a function instead of keyword arguments. This also has the nice side-effect of making it easier to call programmatically from other functions. For example: (my-func 1 2 (assoc default-opts :c 42)) is way cleaner than (apply my-func 1 2 (m

Re: Clojure bootstrap, what am I missing here?

2015-08-24 Thread Timothy Baldridge
" I would think that having Clojure implemented entirely in Clojure would have a number of advantages." I think that's the place you should start. List those advantages. Clojure-in-Clojure would be a "nice" thing to have...but I can't really think of any major features it would enable that aren't

Re: Clojure bootstrap, what am I missing here?

2015-08-24 Thread Timothy Baldridge
" isn't Clojure code easier to maintain/extend than Java code?" Sure, but is that were the problems lie in Clojure maintenance? Take a look at the JIRA tickets. The majority deal with how to map some concept to the JVM (same problem in Java or Clojure), or the correct way to implement something to

Re: Weird GenSyms behaviour across different quoted blocks in a macro

2015-08-26 Thread Timothy Baldridge
Auto generated symbols (x# style) are only valid within a single syntax quote form. Instead declare the symbol ahead of time, something like this: (let [fsym (gensym "f_)] `(fn [~fsym] ~@(for [x (range 10] `(println ~fsym ~x Hope this helps. Timothy On Wed, Aug 26, 2015

Re: Just found out about Elixirs function argument pattern matching...

2015-09-05 Thread Timothy Baldridge
>> Thanks, it helps to know using a tagged vector is a real pattern :) I don't know that it's a "real pattern". If I saw code like this in production I would probably raise quite a stink about it during code reviews. It's a cute hack, but it is also an abuse of a data structure. Now when I see [:f

Re: Just found out about Elixirs function argument pattern matching...

2015-09-06 Thread Timothy Baldridge
-id 123 > :address nil > :email nil} > > and the equivalent variant was `[:pickup 123]` > > If the map was instead > > {:pickup {:store-id 123} > :digital nil > :delivery nil} > > then yes, a variant could be thought of as a key value pair. Is this what

Re: Just found out about Elixirs function argument pattern matching...

2015-09-06 Thread Timothy Baldridge
of these things during the life of an app, and transforming them from one format to another, a little tweaking here and there may save you some pain in the end. Timothy On Sun, Sep 6, 2015 at 8:14 AM, James Reeves wrote: > On 6 September 2015 at 14:41, Timothy Baldridge > wrote: &g

Re: Just found out about Elixirs function argument pattern matching...

2015-09-07 Thread Timothy Baldridge
>> Should be expressed as: >> (swap! :atom a, :function inc) One of Rich's talks on simplicity actually addresses that. He states that the above method (with keyword arguments) is actually simpler, but that this isn't exactly easy to program. And yes, I would take this same position about positio

Re: Using type hints to optimize protocol invocation

2015-09-08 Thread Timothy Baldridge
>> My understanding is that invocation of protocol methods incurs about 30% overhead due to the need to look up the appropriate function for the type. I'd like to see some benchmarks on that. Protocols are actually quite fast, and if you create the protocol first, then implement a type using that

Re: Puzzlement over closing core.async channels asynchronously

2015-09-17 Thread Timothy Baldridge
bably better to stick with async/pipeline with a map transducer. And yes, the 0 vs 1 thing is a typeo. I'll have to see if there is a way I can submit some errata to O’Reilly. Thanks for the report. Timothy Baldridge On Thu, Sep 17, 2015 at 2:40 PM, James Elliott wrote: > We’ve been wat

Re: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Timothy Baldridge
I wouldn't be so fast to discount the JVM. http-kit isn't exactly the only game in town when it comes to websockets on the JVM. And also it's written by a rather small team. I'd investigate other tools (Netty?) before discounting an entire platform due to a quick glance at a single library. Also,

Re: [meta] Unwelcome changes around here.

2015-10-08 Thread Timothy Baldridge
lol, wut? On Thu, Oct 8, 2015 at 9:06 AM, Fluid Dynamics wrote: > I don't know what you guys did, but as of about 2 days ago, when browsing > this site about 1 time in 20 after reading an article and then clicking > "back" to go back to the topic list my main Firefox window disappears and > is r

Re: [meta] Unwelcome changes around here.

2015-10-08 Thread Timothy Baldridge
some site's view of a mailing list. This list has 0 control over whatever site it is that you use, so complaining here not only is pointless, but is also just spam. Timothy On Thu, Oct 8, 2015 at 9:09 AM, Timothy Baldridge wrote: > lol, wut? > > On Thu, Oct 8, 2015 at 9:06 AM,

Re: lazyseq?

2015-10-18 Thread Timothy Baldridge
Often if you want to know if something is a lazy seq, you really want to know if it is a delayed computation. If that's the case, realized? may help. But I also wonder what you are trying to accomplish. There are many seqs in Clojure that are not lazy, and so could have interesting results if you

Re: Largest Clojure codebases?

2015-11-15 Thread Timothy Baldridge
It's funny, because most of the larger OOP projects I worked on were large because of class bloat, not because of business concerns. For example, the C# app I used to work on was a more or less simple CRUD app. We had a ORM that served up objects to a Silverlight UI. So if we wanted to display info

Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-18 Thread Timothy Baldridge
This sort of code is somewhat the worst case situation for atoms (or really for CAS). Clojure's swap! is based off the "compare-and-swap" or CAS operation that most x86 CPUs have as an instruction. If we expand swap! it looks something like this: (loop [old-val @x*] (let [new-val (assoc old-val

Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-18 Thread Timothy Baldridge
Oh, then I completely mis-understood the problem at hand here. If that's the case then do the following: Change "atom" to "volatile!" and "swap!" to "vswap!". See if that changes anything. Timothy On Wed, Nov 18, 2015 at 9:00 AM, David Iba wrote: > Timothy: Each thread (call of f2) creates i

Re: Clojure Objects

2015-11-20 Thread Timothy Baldridge
You might want to read up on records and protocols in clojure. This is pretty much the use case for which they were designed. Timothy On Friday, November 20, 2015, William la Forge wrote: > You can tell I'm still new to clojure. The composition should have been > written like this: > > (-> opts

Re: Ultralight Components

2015-11-23 Thread Timothy Baldridge
So I feel compelled at this point to ask..."why?". The whole point of functional programming in Clojure is to de-couple state from data. When you need polymorphic dispatch on the contents of a map, you have access to multi methods. Sure this is a fun thought experiment, but I don't understand the d

Re: Ultralight Components

2015-11-23 Thread Timothy Baldridge
correction"decouple state from behavior" On Mon, Nov 23, 2015 at 7:24 PM, Timothy Baldridge wrote: > So I feel compelled at this point to ask..."why?". The whole point of > functional programming in Clojure is to de-couple state from data. When you > nee

Re: Clojure Objects

2015-11-24 Thread Timothy Baldridge
>> But, if someone has to explain the etymology of their word to you for it to make >> sense, then the word has failed. If I took that approach with my kids, they'd never get out of first-grade. Timothy On Tue, Nov 24, 2015 at 7:23 AM, Bobby Bobble wrote: > "Careful - ‘complect’ has a very spe

Re: Ultralight Components

2015-11-24 Thread Timothy Baldridge
So let's back up a bit and take a look at your assumptions. In your previous post you stated ", I kept thinking about why I am avoiding protocols. In general, I very much like having abstractions. But I find that even small abstractions tend to complect what with how." I would love to see an examp

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

2015-11-25 Thread Timothy Baldridge
In addition to mult/tap, if all you need is something that looks like a promise, the newest core.async has "promise channels" which only accept a single put, but that value can be retrieved by many takes. On Wed, Nov 25, 2015 at 3:21 AM, Moe Aboulkheir wrote: > > > On Wed, Nov 25, 2015 at 6:42

Re: Practical ways to deal with 'bag-of-properties' syndrome, AKA dynamic typing?

2015-11-30 Thread Timothy Baldridge
I believe that working with maps is a lot like working with locals and function names...nothing will help you with bad naming. So don't do stuff like {:foo 42 :bar 33} when you can do stuff like {:min-age 42 :max-age 33}. Also stick with sane naming conventions. Don't do {:maxAge 42} in some places

Re: Naming convention for atoms, refs, etc.?

2015-12-05 Thread Timothy Baldridge
Also, if you have so many atoms in your program that it becomes hard to remember where they are, that would be another source of concern ;-) On Sat, Dec 5, 2015 at 4:44 PM, James Reeves wrote: > Why should they have any sort of naming scheme? Dynamic vars are unusual > because their values can c

Re: core.async channel /w transducer which thread?

2015-12-16 Thread Timothy Baldridge
When the transducer code was originally added to core.async I asked Rich this very question. He declined to specify where the transducer is run. The reasoning is simple: since the transducer is executed inside the channel lock, your transducers should always be fast enough that you don't care where

Re: What exactly is a form in Clojure?

2015-12-28 Thread Timothy Baldridge
So this will not be a very formal definition of "form", but I will do my best. A "form" is a fully contained "thing". So yes 1 is a form, so is "1", and ["1" 2] and (quote (foo bar)), and {:foo :bar}. You are right in assuming that reading a ( will cause the reader to read to the matching ). This i

Re: What's the best option similar to Vert.x, Reactor, Nodejs for use with Clojure?

2016-01-03 Thread Timothy Baldridge
I've done some evaluations of Vert.x in the past and was rather underwhelmed. What is it that you are trying to accomplish? Stuff like Pedestal offers async web services, but without the complexity of an traditional evented server. So perhaps if we had a better idea of your requirements we could be

Re: Pattern for service with multiple clients using two-way channels?

2016-01-06 Thread Timothy Baldridge
Most would perhaps start with the classic approach of having each request contain a :reply-to channel that the responses go into, but I think this is a mistake. IMO, there are two main ways of building systems with core.async 1) request/response. 2) dataflow graphs. I prefer the second approach w

Re: Why do map/get and similar return nil if not found?

2016-01-12 Thread Timothy Baldridge
Since most functions in core also support nil, it isn't as big of an issue as some make it out to be. So things like this work as expected, even if a nil exists somewhere (-> coll (map first) (filter even?) count) Since all these functions support nil it really isn't a problem.

Re: Cross-platform check if value is a channel

2016-01-18 Thread Timothy Baldridge
You could do that, but I would encourage you to either check ReadPort or WritePort, as there are some constructs in core.async that only implement one or the other. On Mon, Jan 18, 2016 at 2:26 PM, JvJ wrote: > So, you can just check if #(safisfies? > clojure.core.async.impl.protocols/Channel %)

Re: clojurescript in clojure

2016-01-27 Thread Timothy Baldridge
It seems to me that there has to be a simpler approach to what you are trying to accomplish. To that end, what is your end goal, and why is "splitting the cljs into a .cljs file is not an option"? On Wed, Jan 27, 2016 at 12:08 PM, Gregg Reynolds wrote: > > > On Tue, Jan 26, 2016 at 9:03 PM, Matc

Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-27 Thread Timothy Baldridge
So a bit of constructive feedback on Fudje, firstly, I like that it's pretty simple, I can take bits I want and leave bits I don't, so good work on that. But I do have a issue with the sweet.clj syntax, and I think it's best exemplified by the code found in the intro: (testing "arg-checker in mo

Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-27 Thread Timothy Baldridge
sting > checkers, there will always be a possibility for some very ugly code. apart > from the `=>` symbol, which BTW can be anything you like as it's never > evaluated, I don't see where you get the DSL impression from. fudje was > specifically designed top to bottom to be

Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-31 Thread Timothy Baldridge
. Timothy On Sun, Jan 31, 2016 at 9:05 AM, Brian Marick wrote: > > > Timothy Baldridge wrote: > >> This is a good example of a DSL, and it falls under the criticisms I >> level at most DSLs, mainly they aren't Clojure. If we dive into >> > > I note that Mid

Re: How is the emphasis of “data over code” different than the XML advocacy of the early 2000s?

2016-02-03 Thread Timothy Baldridge
I find this subject interesting as I was just discussing this with a co-worker recently. There's a few points I'd like to make: Firstly, data is often a form of a DSL (domain specific language). Libraries like Onyx often contain (as Lucas mentioned) a parser that walks the data and performs some a

Re: clojure as part of agnostic project

2016-02-22 Thread Timothy Baldridge
And since both boot and lein store projects in a human readable format (aka. not machine generated XML), moving from one of these to another project manager shouldn't be too hard. On Mon, Feb 22, 2016 at 9:16 AM, James Reeves wrote: > At minimum, both Boot and Leiningen just need to be told wher

Re: [GSoC idea] Pluggable back-ends architecture for ClojureScript compiler

2016-02-23 Thread Timothy Baldridge
Just wanted to jump in here and say that Thomas is correct. Plugging into the CLJS compiler is probably not the right place to start. The CLJS compiler is built for speed and as such is somewhat less modular than the tools.analyzer/tools.emitter projects. So start there if you're looking to build a

Re: Is there a function in clojure.test like future fact in midje?

2016-02-29 Thread Timothy Baldridge
The question I would have is how do you define "halts"? And how do you know if a program is halted or just waiting for IO, a timeout, or some other event? Timothy On Mon, Feb 29, 2016 at 5:34 PM, Andrea Richiardi < a.richiardi.w...@gmail.com> wrote: > Not that I know of at the moment, nonetheles

Re: Is there a function in clojure.test like future fact in midje?

2016-02-29 Thread Timothy Baldridge
Ugh, and I mis-read that wiki...so ignore my previous post. On Mon, Feb 29, 2016 at 6:13 PM, Timothy Baldridge wrote: > The question I would have is how do you define "halts"? And how do you > know if a program is halted or just waiting for IO, a timeout, or some > other

Re: [ANN] walmartlabs/system-viz 0.1.1

2016-03-11 Thread Timothy Baldridge
This is fantastic! I've often wanted something like this when I first get into a new codebase. Having the entire system visualized is a great way to get up and running. On Fri, Mar 11, 2016 at 11:47 AM, Howard Lewis Ship wrote: > > system-viz is a tiny, simple library to visualize a system, cons

Re: Feedback on idiomatic API design

2016-03-12 Thread Timothy Baldridge
"Idiomatic" is always a hard word to define, and I think some of the points made here are good, but let me also provide a few guidelines I try to abide by when writing an API: Start with data, preferably hash maps. At some point your API will be consumed by someone else's program. Macros make it h

Re: New Matrix Multiplication benchmarks - Neanderthal up to 60 times faster than core.matrix with Vectorz

2016-03-14 Thread Timothy Baldridge
Just a side comment, Dragan, if you don't want to be compared against some other tech, it might be wise to not make the subtitle of a release "X times faster than Y". Make the defining feature of a release that it's better than some other tech, and the proponents of that tech will probably start to

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-18 Thread Timothy Baldridge
I dusted off the fn-fx code today and fixed a bunch of bugs, and implemented a few examples: https://github.com/halgari/fn-fx One of the most complex examples so far is here: https://github.com/halgari/fn-fx/blob/master/examples/getting_started/02_form.clj As you can see the library is capable of

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-19 Thread Timothy Baldridge
I've been working on a "React for JavaFX" library for some time. Sadly I have no use for the library, so I haven't talked about it much yet. But the newest iteration has a interface I'm pretty happy with: https://github.com/halgari/fn-fx/blob/master/test/fn_fx/fx_dom_test.clj#L97-L145 If there wa

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-19 Thread Timothy Baldridge
, 2016 at 11:26 AM, Jason Zwolak wrote: > You can diff JavaFX components like that? > > -- > Jason Zwolak > > On Thu, Mar 17, 2016 at 12:51 PM, Timothy Baldridge > wrote: > >> >> If the app-state has changed then it starts re-rendering the UI. >> >> T

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-19 Thread Timothy Baldridge
>> If the app-state has changed then it starts re-rendering the UI. That's pretty much exactly what fn-fx does in the latest version, with two caveats: 1) there's no timer, just a watch on an atom. 2) If you properly diff components you don't need to re-create them every time, just change the prop

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-21 Thread Timothy Baldridge
ing the best we know about GUI programming. At the moment > that seems to be core.async and some kind of DOM that can be diffed. > > -- > Jason Zwolak > > On Fri, Mar 18, 2016 at 12:42 PM, Timothy Baldridge > wrote: > >> I dusted off the fn-fx code today and fixed a bun

Re: No *print-depth* in Clojure? How about recursive data structures?

2016-03-31 Thread Timothy Baldridge
But we should mention that recursive data structures that contain refs are a bit of a code-smell. Your structures are no longer immutable if they contain refs which are mutable containers for immutable data. Something to think about. On Thu, Mar 31, 2016 at 9:53 AM, James Reeves wrote: > On 31 M

Re: No *print-depth* in Clojure? How about recursive data structures?

2016-03-31 Thread Timothy Baldridge
ething like Loom ( https://github.com/aysylu/loom), and how I model all my dataflow graphs. Start creating recursive self-referencing data structures you're in for a world of hurt. On Thu, Mar 31, 2016 at 10:27 AM, Kenneth Tilton wrote: > > > On Thu, Mar 31, 2016 at 11:56 AM, Timoth

Re: Mutual Recursion Doesn't Compile

2016-03-31 Thread Timothy Baldridge
This is almost a perfect example of something that protocols could help with (http://clojure.org/reference/protocols): (defprotocol IGetValuePathPairs (getValuePathPairs [json])) (extend-protocol IGetValuePathPairs Number (getValuePathPairs [json] ...) String (getValuePathPairs [json] .

Re: [ANN] [book] Mastering Clojure published!

2016-04-03 Thread Timothy Baldridge
gvim, aside from the rather poor taste of critiquing a book's pricing in the second reply to the announcement of that book. Perhaps also consider that one book is named "Mastering", while the other is a introduction to web programming. I have not read either of these books, but shouldn't we prefer

Re: [ANN] components.md

2016-04-05 Thread Timothy Baldridge
The thing that this doc also advocates (and I am against) is manual dependency management, your app start function must call start on its dependencies. This not only hardcodes the dependency, but also requires the user to think about the startup order of components on every usage. In addition this

Re: Advice getting started with concurrency and parallelism in Clojure

2016-04-05 Thread Timothy Baldridge
If it all seems confusing, do not despair, there's two things that will handle the vast majority of the use cases you may have: 1) `future` - spawns a thread that runs the body of the future ( https://clojuredocs.org/clojure.core/future) 2) `atom` and `swap!` - Used to store data that needs to be

Re: [ANN] components.md

2016-04-06 Thread Timothy Baldridge
buck": Non-singleton components that express themselves via a well defined abstract protocol, wired together via data. On Wed, Apr 6, 2016 at 4:59 AM, Renzo Borgatti wrote: > Thanks Tim for reading down till the last line! > > > On 5 Apr 2016, at 19:09, Timothy Baldridge wrote:

Re: Advice getting started with concurrency and parallelism in Clojure

2016-04-07 Thread Timothy Baldridge
Exactly. Clojure's strength is constraining mutability. How each primitive constrains mutability is different. Note: that many of these defaults can be overridden if the user really knows what they are doing. atoms - given a mutable cell, provide a function to update the data, may be run multiple

<    1   2   3   4   5   6   7   8   9   >