Re: Tour of our 250k line Clojure codebase

2021-06-09 Thread Timothy Baldridge
On Wed, Jun 9, 2021 at 6:14 PM Nathan Marz wrote: > Continuations in our language are expressed very differently than has > existed before (e.g. like in Scheme). They fit intuitively within the > overall paradigm our language implements. Far from being complex or hard to > comprehend,

[JOB] [US/CA/Fully Remote] Cisco is looking for a Clojure / Distributed Systems Programmer

2021-04-26 Thread Timothy Baldridge
Cisco is looking for a Clojure developer to join our malware analysis group: Threat Grid. We manage data produced by dynamic analysis of malware and provide a wide variety of REST services to our clients. Seeing as we deal with around 700k samples a day, and maintain a dataset of 400TB, we are

[Job] Cisco Malware Analytics (ThreatGrid) - Remote US

2021-03-15 Thread Timothy Baldridge
and categorize malware. We maintain roughly 400TB of ElasticSearch data and 1-2 TB of SQL data, so a lot of our problems are in that fun space of distributed systems, and "big data". Feel free to ask questions here, apply via the link above, or email me. Timothy Baldridge -- You received 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

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

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

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

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

2018-10-16 Thread Timothy Baldridge
- 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 > hunt down the type annotations elsewhere. I've been writing Java since > Java 1.1 and I still like the

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

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,

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

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*

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

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

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

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/ >

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

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

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

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

Re: 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 <red...@orcpub.com> wrote

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

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

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

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)

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
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 <tbaldri...@gmail.com> wrote: > >> If Var reification is part of the slowness of Cloju

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

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

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

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

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

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.

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

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

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

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

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 <tbaldri...@gmail.com> wrote: > All clojure ref types have validators that are perfect for this use case: > https://clojuredocs.org/clojure.core/set

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

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

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

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

Re: Dynamically Reify Interfaces

2017-11-08 Thread Timothy Baldridge
Eval gets a bad reputation from languages like JS where it's messy and a bit of a security risk. In Clojure, there's nothing wrong with using eval for something like this. On Tue, Nov 7, 2017 at 11:43 PM, Nick Mudge wrote: > I need to dynamically reify some java

Re: Who Uses import-vars?

2017-11-07 Thread Timothy Baldridge
I structure my code very explicitly. Normally the most common constructs are put in a single file named after the library itself (not in core.clj, do that half your files will be named core). https://github.com/halgari/odin/blob/master/src/com/tbaldridge/odin.clj Anything not in the API that

Re: What's up with IMeta?

2017-11-01 Thread Timothy Baldridge
To start with, IObj and its .meta method are used with clojure.core/meta to get the metadata on an object. Since this method can be the same between refs and immutable data, they all use the same interface. IMeta is used with withMeta and clojure.core/with-meta to return a new object with the

Re: beginners' puzzle

2017-10-11 Thread Timothy Baldridge
Best answer for that is probably the source code itself: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Keyword.java On Wed, Oct 11, 2017 at 9:07 AM, wrote: > how these keywords in clojure implemented > could anyone anwer me ? > > -- > You

Re: About determinism of async

2017-10-11 Thread Timothy Baldridge
If you want to simply keep some messages in order, then a cat transducer will do the trick just fine: ;; need a buffer or buffer size to get to the transducer param (def c (chan 20 cat)) (async/onto-chan c [1]) (async/>!! c [2 3 4]) (async/close! c) ( wrote: > If you don't want to split at

Re: Updating repeated nested structures?

2017-10-10 Thread Timothy Baldridge
My answer to most of these questions is often "write it once, stuff it in a function, and forget about it". Really though I often see this as a data-modeling and naming problem. For example, you could go and write a `(update-cells cell-list f & args)` that wraps custom logic for finding and

Re: Help with strange test output when deftest used inside a macro

2017-10-09 Thread Timothy Baldridge
The problem isn't the macro, it's your use of syntax quoting. `(= x y) gets expanded at read-time into `(clojure.core/= x y)`. Not much you can do about that. Although I'd suggest perhaps changing your code a bit to not require macros. deftest mostly just creates a defn with some extra metadata

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread Timothy Baldridge
What REPL are you using? A rather nasty side-effect of NRepl is that it tends to send messages from non-main-threads to weird places. On Sun, Oct 8, 2017 at 10:29 PM, wrote: > I just re-wrote much of the code to run on the main thread. And so now I > can see the

Re: Can slingshot/try+ and then catch Object really catch any error?

2017-10-08 Thread Timothy Baldridge
I don't think you can catch an Object on the JVM can you? What happens if you catch Throwable? On Sun, Oct 8, 2017 at 9:43 PM, wrote: > So, for instance, this says that 10 documents were retried: > > {"message" {:num-slabs 1, :num-active-slabs 1, :enqueued 389,

Re: Using memory with futures

2017-09-05 Thread Timothy Baldridge
Every thread created on the JVM takes about 2MB of memory. Multiply that by that number of threads, and I'm surprised your memory usage is that low. But the futures thread pool will also re-use previously created threads for new futures. In order to optimize this, a certain number of threads will

Re: SRSLY? (= (true? identity) (false? identity)) => true

2017-09-01 Thread Timothy Baldridge
Think about what you're asking: "Hey, is identity a boolean true value?" "No, it is a function, not a boolean" "Is, identity a boolean false value?" "No, it's a function, not a boolean" Makes plenty sense to me. On Fri, Sep 1, 2017 at 10:06 PM, Rostislav Svoboda <

Re: core.async got in a bad state?

2017-08-29 Thread Timothy Baldridge
To add to what Alex said, look at this trace: https://gist.github.com/anonymous/65049ffdd37d43df8f23630928e8fed0#file-thread-dump-out-L1337-L1372 Here we see a go block calling mapcat, and inside the inner map something is calling >!!. As Alex mentioned this can be a source of deadlocks. No code

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-28 Thread Timothy Baldridge
>> https://github.com/arrdem/guten-tag The name alone deserves a +1. :D On Mon, Aug 28, 2017 at 2:53 PM, Reid McKenzie wrote: > FWIW I wrote a library around defining tagged map types > https://github.com/arrdem/guten-tag and used it heavily in the Grimoire > implementation

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-25 Thread Timothy Baldridge
>> they're a little nicer to type and read And that's where I have to disagree. The problem with most of these options is they complect ordering with meaning. [:image/file "/images/image" :jpeg] Here I have no idea what these values mean. I have to have out-of-band information about what offset

Re: CPU & platform for best compilation performance

2017-08-23 Thread Timothy Baldridge
"My codebase (mix of CLJ, CLJS and CLJS) is about fifty thousand lines of code, and compilation times are starting to interfere with my workflow happiness. In addition, Chrome Devtools is becoming somewhat sluggish due to the high number of separate namespaces loaded through Figwheel." That's not

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
at 9:43 PM, James Reeves <ja...@booleanknot.com> wrote: > On 23 August 2017 at 03:58, Timothy Baldridge <tbaldri...@gmail.com> > wrote: > >> Put let's take that and look at it under a engineering lens a bit: >> >> >> For example, a series of e

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
But Datomic has E in [e a v] which links multiple [a v] pairs into an entity...which is basically a map. So I don't think that applies here. GET /example HTTP/1.1 Host: www.example.com [:request/method :get] [:request/uri "/example"] [:request/protocol "HTTP/1.1"] [:request/header

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
. You can mistake the order: [:event/draw :player1 > :4s]. > > I think to represent the type of a single element, I agree with you, but > if you've got a compound type, at first glance, they'd appear less > practical and more error prone to me. So your second example makes more > se

Re: Sum types in Clojure? Better to represent as tagged records or asvariant vectors?

2017-08-22 Thread Timothy Baldridge
; Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > > *From: *Timothy Baldridge <tbaldri...@gmail.com> > *Sent: *Tuesday,

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
Nope, ClojureScript uses nested hash maps (try it for yourself here: http://vps124502.vps.ovh.ca/rage/resources/public/). As does tools.analyer. Instaparse and Hiccup use a variant of variants, but funny enough the first thing I ever do when writing code with instaparse is write a converter from

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
I think the article is a bit misleading. Variants were never that popular in Clojure. Infact I've never seen them used in production code or the most common Clojure libraries. So I'm a bit perplexed as to why the article recommends them so strongly. So I think the answer is, they are a fun

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
complicate the code for really no benefit. The complexity they are attempting to solve can be solved by simply using maps and records instead of bare values. On Tue, Aug 22, 2017 at 5:43 PM, James Reeves <ja...@booleanknot.com> wrote: > On 22 August 2017 at 23:04, Timothy Baldridge &

Re: Sum types in Clojure? Better to represent as tagged records or as variant vectors?

2017-08-22 Thread Timothy Baldridge
I find the arguments for variants very unconvincing. As you stated with specs and s/keys you can spec the same sort of data, and in a way that's much more open-ended. For example: [:person {:name "Tim" :grade "B"}] What is the type of this data? We would probably guess a :person. But what if we

Re: Is Clojure victim of Spec ?

2017-08-18 Thread Timothy Baldridge
Relevant discussion: https://groups.google.com/d/msg/clojure/10dbF7w2IQo/ec37TzP5AQAJ On Fri, Aug 18, 2017 at 10:53 AM, Rafik NACCACHE wrote: > Hey guys, > > Seems to be a long while we are waiting for 1.9 > > I kinda feel that core.spec seems to always need more

Re: CHAMP an improvement on HAMT?

2017-08-14 Thread Timothy Baldridge
It came up today in the Clojurian's Slack mailing list, and it sounds like the gist is that the papers did a bit of a apples-to-oranges comparison by using a different hashing algorithm when comparing CHAMP to Clojure's hashmaps. Once this difference is rectified the performance improvements are

Re: How is this code to create a stateful lazy sequence?

2017-07-22 Thread Timothy Baldridge
If we think about what we're doing here is a stateful filter, then maybe we could leverage a few more core Clojure functions: (defn distinct-by [f coll] (let [seen (atom #{})] (filter (fn [itm] (let [m (f itm)] (when-not (@seen m) (swap!

Re: Should the completion arity of a stateful transducer reset state?

2017-07-22 Thread Timothy Baldridge
Once a transducer is completed it should never be called again. This is why transduce takes both a transducer and a reducing function and combines them internally. The thought here is that it will be harder to shoot yourself in the foot by reusing a stateful reducing function if you don't have to

Re: How to eval one "step" of a form?

2017-07-20 Thread Timothy Baldridge
The answer lies in the term "REPL". You start by reading the string, you can use `clojure.core/read-string` for this case. This will convert your string into Clojure data: "(+ 1 (* 2 2))" => (+ 1 (* 2 2)) That's the "R" part of "REPL", read. Next step is "E" for "eval". We need to evaluate the

Re: Modern opengl bindings in clojure

2017-07-14 Thread Timothy Baldridge
Are the docs out of sync? Because the README talks about immutable APIs and seq to array conversions, but the library itself is just a renaming wrapper mapping stuff like GL/GLVertex to gl-vertex. I don't understand how that makes the API "modern". Unless that part isn't written yet. Timothy On

Re: Been away a while

2017-07-14 Thread Timothy Baldridge
I recommend starting with this excellent talk, if you haven't already seen it: https://www.youtube.com/watch?v=qDNPQo9UmJA Aside from that I recommend taking a look at Pedestal. It's async and streaming capabilities are some of the most advanced you can find in the Clojure space, and its

Re: core.async vs continuations

2017-07-10 Thread Timothy Baldridge
Yes, calls to ! could be written with continuations, or call/cc, but they are not implemented that way. Instead the code inside the body of the `go` macro is rewritten into a statemachine. This sort of rewrite is a lot like the rewrites that C# does for yield, and Cython does much of the same sort

Re: core.async/close! locks on chans with pending transforms

2017-07-03 Thread Timothy Baldridge
A big reason they have to be run inside the lock is that they have to operate in the context of the channel. For example: (chan (take 10)) Firstly we must recognize that transducer instances are *not* thread safe. They should only ever be executed by one thread at a time. But channels allow

Re: core.async/close! locks on chans with pending transforms

2017-07-03 Thread Timothy Baldridge
Transducers on channels lock the channel while they are running. This is by design. So yes, the side-effect of this means that no other operation (puts, takes or closes) can succeed while the transducer is running. So the short answer is: If you have code that can take awhile to run, don't put it

Re: New guide: Reading Clojure Characters

2017-06-17 Thread Timothy Baldridge
Anonymous implies there might be some sort of auto gen going on (as there is with anonymous functions), Irrelevant has my vote therefore. The other characteristics are a side-effect of it being a naming convention (with no official support by the compiler). Maybe that could be pointed out in

Re: [ANN] Chestnut 0.15.0

2017-05-29 Thread Timothy Baldridge
Might be good to provide a quick overview of what Chestnut is. It's been a year, so I either missed the last announcement, or have forgotten in that time. Also I see a link that would take me to the project page. On Mon, May 29, 2017 at 5:03 AM, Arne Brasseur wrote: >

Re: slackpocalypse?

2017-05-18 Thread Timothy Baldridge
You know, there's this awesome bit of tech called IRC...someone should check that out. On Thu, May 18, 2017 at 3:31 PM, Gregg Reynolds wrote: > looks like access is restored, for me at least. still, slack is making me > a little nervous. and that's in addition to the 10K

Re: slackpocalypse?

2017-05-18 Thread Timothy Baldridge
It's not working for me. I'm in the US, connecting via Chrome. On Thu, May 18, 2017 at 2:40 PM, Dragan Djuric wrote: > It works for me as always. > > On Thursday, May 18, 2017 at 10:34:33 PM UTC+2, Gregg Reynolds wrote: >> >> >> >> On May 18, 2017 3:32 PM, "Jason Stewart"

Re: How to Create Clojure `defn` Functions automatically?

2017-05-13 Thread Timothy Baldridge
ojure-macro-to-generate-functions> > was incomplete for the new question and I was trying to fill in the missing > parts. > > > > On Sat, May 13, 2017 at 3:40 PM, Timothy Baldridge <tbaldri...@gmail.com> > wrote: > >> Sorry, but this use of intern is a pointless. What d

Re: How to Create Clojure `defn` Functions automatically?

2017-05-13 Thread Timothy Baldridge
gt; P.S. Regarding (3), Joel Spolsky, creator of StackOverflow, has often >> encouraged people to post both a question and its answer on the site: >> https://stackoverflow.blog/2011/07/01/its-ok-to-ask-and-ans >> wer-your-own-questions In fact, they even have a speci

Re: class and case

2017-05-13 Thread Timothy Baldridge
Using a protocol is probably the optimal choice, since it also opens up the dispatch allowing for extension without modifying exiting code. Downstream users of your library can add extensions to your code without having to create a patch. On Sat, May 13, 2017 at 7:43 AM, Alex Miller

Re: In search of the little transducer

2017-05-12 Thread Timothy Baldridge
Sure, you can contact me at the address used in this reply :) Timothy Baldridge On Fri, May 12, 2017 at 11:19 AM, Erlis Vidal <er...@erlisvidal.com> wrote: > Is there a way I can contact Tim Baldridge for questions about the > subscription? > > Thanks! > > On Sun,

Re: How to Create Clojure `defn` Functions automatically?

2017-05-11 Thread Timothy Baldridge
t; > > On Thu, May 11, 2017 at 9:18 AM, Alan Thompson <clooj...@gmail.com> wrote: > >> I like the idea of using `eval` and `memoize`. I'll have to keep that >> in mind. >> Alan >> >> On Thu, May 11, 2017 at 7:58 AM, Timothy Baldridge <tbal

Re: How to Create Clojure `defn` Functions automatically?

2017-05-11 Thread Timothy Baldridge
This is a somewhat weird answer to a overcomplicated problem. As mentioned, the data is a map to start with, and maps are functions so treating the maps as data is probably the best approach. And like Dragan, I'm unsure why this example doesn't use `(data :able)`. When I do need to generate

Re: Faster diffing for large-ish nested data structures

2017-04-22 Thread Timothy Baldridge
Can Specter walk two sequences in lock-step? That's what's needed for a good diffing engine, and that seems quite far removed from Specter's design. On Fri, Apr 21, 2017 at 11:22 PM, Mars0i wrote: > This might be a job for which Specter is particularly useful. You might >

Re: Faster diffing for large-ish nested data structures

2017-04-19 Thread Timothy Baldridge
I've gotten really fast diffing in Clojure by using the following concepts: 1) If you can sometimes make parts of A and B be identical, then your differ can skip checking those parts by doing a (identical? A B), this improves performance 2) Take a side effecting approach, pass into the differ a

Re: Derefs broken after clojure.tools.namespace.repl/refresh

2017-04-11 Thread Timothy Baldridge
Cursive has had a really good debugger for a long time. I don't use it much, but when I need it it *just works*. Timothy On Tue, Apr 11, 2017 at 7:37 PM, Didier wrote: > A good debugger is indeed extremely useful for Clojure - I use one every >> day :-) >> > > Am I living in

Re: Derefs broken after clojure.tools.namespace.repl/refresh

2017-04-10 Thread Timothy Baldridge
You're reloading your namespaces from a non-repl thread, concurrently while editing code in the repl. I don't think this is use case is supported by tools.namespace. On Mon, Apr 10, 2017 at 2:56 PM, Didier wrote: > Hum, not sure why you would do this, but I'm guessing refresh

Re: Using transducers in a new transducing context

2017-04-09 Thread Timothy Baldridge
In your example transducer, the problem is with the `result` parameter. The specification of transducers is that the result of `(rf result x)` should be fed into the next call to `rf`. In other words: (-> result (rf x1) (rf x2) (rf x3))` trying to do that in a parallel context is next to

Re: Using transducers in a new transducing context

2017-04-09 Thread Timothy Baldridge
Transducers were never designed to work in parallel context. So I'd define any behavior that arises from using the same transducers in multiple threads *at the same time*, as undefined behavior. On Sun, Apr 9, 2017 at 4:39 PM, Alexander Gunnarson < alexandergunnar...@gmail.com> wrote: > I should

Re: Using transducers in a new transducing context

2017-04-09 Thread Timothy Baldridge
The volatile! is needed for the case where a transducer is only used by one thread at a time, but the thread executing the transducer may change from one call to the next. This happens fairly often with core.async. If you used a non-atomic, non-volatile mutable field, the JVM would be free to

Re: was Re: ANN: Orchestra, complete instrumentation for clojure.spec

2017-04-06 Thread Timothy Baldridge
The power offered by spec is probably better compared against dependent type systems like Idris. True static type systems run analysis at compile-time, but spec allows you to perform very complex checks because you have the power of full blown language. For example, with spec you can write a

Re: go local variable binding

2017-03-16 Thread Timothy Baldridge
in case you expect to write cross-platform code with dynamic bindings. > > > Am 16.03.2017 um 01:01 schrieb Timothy Baldridge: > > Yes, that should work fine, do your tests confirm otherwise? Also if > > you're not doing a recur there's no reason to use `go-loop` you can just >

Re: go local variable binding

2017-03-15 Thread Timothy Baldridge
Yes, that should work fine, do your tests confirm otherwise? Also if you're not doing a recur there's no reason to use `go-loop` you can just use `go`. On Wed, Mar 15, 2017 at 4:44 PM, Eran Levi wrote: > Hi, > can I bind variables, same as I do for threads, for go routines,

Re: Contribute Specter to Clojure core?

2017-03-05 Thread Timothy Baldridge
>> Specter is not a DSL. Specter implements a set of terms (navigators) specific to the library that are interpreted by the library (the transform function) to accomplish some task for a specific domain (manipulating data structures). In the same way, `update-in` is a DSL. Both Specter and

Re: [ANN] Odin 0.2.0 - Query DSL for Clojure

2017-02-24 Thread Timothy Baldridge
<didi...@gmail.com> wrote: > How does this compare to Specter? > > > On Thursday, 23 February 2017 13:34:16 UTC-8, Alan Thompson wrote: > > Just came across this - it looks very cool! > Alan > > On Sat, Dec 10, 2016 at 7:14 AM, Timothy Baldridge <tbald...@gma

Re: Prgram uses a lot of swap

2017-02-24 Thread Timothy Baldridge
What are the JVM memory settings set at? And how much physical memory does the box have? Timothy -- 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: Is this a bug that is already fixed?

2017-02-19 Thread Timothy Baldridge
That's a pretty old version of ClojureScript. Try upgrading to the latest. Timothy On Sun, Feb 19, 2017 at 2:17 PM, William la Forge wrote: > I'll note that when I add a second entry to the map, everything is fine: >> >> > {:fix nil :local/contacts-capability

Re: Contribute Specter to Clojure core?

2017-02-14 Thread Timothy Baldridge
While I've looked at Specter several times, I have yet to use it in a project for many of the same reasons that Rangel mentioned. Either my data is shallow enough that clojure.core functions work just fine, or my data is complex enough that I need cross-entity joins, and arbitrary clojure logic.

Re: Clojure.spec, maps, restrict valid keywords, easier way?

2017-02-02 Thread Timothy Baldridge
A good editor should auto-complete your keywords for you. Since using this feature in Cursive (same sort of thing is available in other editors) the cases where I've mis-spelled a keyword have dropped dramatically. It's a lot harder to mis-spell a keyword when you can just do: :egg/th and the rest

  1   2   3   4   5   6   7   8   9   >