Re: [ANN] Clojure.Joda-Time 0.1.0

2013-12-26 Thread Ghadi Shayban
I think your usage of simple check is interesting. What bugs did simple-check find inside Joda and can you speak about that process in general? On Wednesday, December 25, 2013 6:19:18 AM UTC-5, dm3 wrote: Hello, I would like to announce the first release of

Re: ! on channels that are not yet closed

2014-01-14 Thread Ghadi Shayban
This code actually results in a subtle race condition as channels need to be locked internally. It also won't work for other implementations of channel, of which there are several in core.async besides ManytoManyChannel. (For example, map returns a reified channel.) Knowing whether a channel

Re: fast parallel reduction into hash-set/map

2014-02-20 Thread Ghadi Shayban
Jules, For recombination of parallel reductions into a vector, have you looked at foldcathttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L314-L318? It works really well, and it's one of those wonderful gems in clojure.core waiting to be noticed. It gives you

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

2014-03-11 Thread Ghadi Shayban
Comparing CSP and promises is apples-to-oranges. I'd love to see a minimal sample of problematic code. On Tuesday, March 11, 2014 1:39:54 PM UTC-4, Эльдар Габдуллин wrote: Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such

Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-23 Thread Ghadi Shayban
You've piqued my curiosity. Could I trouble you to post the benchmark results on -RC2 with 96f5b5bdc reverted? On Friday, March 21, 2014 7:47:00 PM UTC-4, Stefan Kamphausen wrote: On Saturday, March 22, 2014 12:41:55 AM UTC+1, Andy Fingerhut wrote: That is odd. This is a shot in the

Re: Lazy evaluation

2014-04-01 Thread Ghadi Shayban
And Happy April Fools' everyone. Nicely done Pradip. On Tuesday, April 1, 2014 3:58:34 PM UTC-4, Jozef Wagner wrote: Reducers should be given IMO a more attention, support and importance and I'm actually experimenting on a hypothesis that reducers can replace lazy seqs in most cases

Re: Porting parsley paredit.clj to Clojurescript: Crazy, or inevitable?

2014-04-01 Thread Ghadi Shayban
I can't speak to the implementation of any of this, but I have to link to a favorite demo [1] of structural editing. The animations are really slick, but the way he's designed moving up and down the abstraction hierarchy is brilliant. Cue an Emacs user telling me it's already possible with

Re: Unexpected core.async timeout behaviour

2014-04-15 Thread Ghadi Shayban
Dredging this back up, you've read the scenario properly. Timers are coalesced a particular resolution. Use cases needing more than 1024 active handles on a channel can use a mult. For example, if you had to timeout every request at a same time exactly 5 minutes in the future, (mult (timeout

Re: Clojure 1.5.1

2013-03-10 Thread Ghadi Shayban
fyi - Rich's .idea/ crept in on the bug fix commit. On Sunday, March 10, 2013 8:35:34 PM UTC+2, Stuart Halloway wrote: Clojure 1.5.1 fixes a memory leak in Clojure 1.5, discussed here: https://groups.google.com/d/msg/clojure-dev/uAFM0Ti4AcQ/GmnKmphF1BgJ Getting Clojure: Web:

invokedynamic instructions in Clojure

2013-04-16 Thread Ghadi Shayban
I've added a very minimal usage of invokedynamic to the compiler. Basically the smallest delta without having to change internals of ObjExpr or break ABI compatibility. This is minimal and raw. There are many many usages of indy that will really help the Clojure runtime, this ain't one of

Re: invokedynamic instructions in Clojure

2013-04-17 Thread Ghadi Shayban
PM UTC-4, Ghadi Shayban wrote: I've added a very minimal usage of invokedynamic to the compiler. Basically the smallest delta without having to change internals of ObjExpr or break ABI compatibility. This is minimal and raw. There are many many usages of indy that will really help

Immutable Piece-table

2011-07-12 Thread Ghadi Shayban
I put up a simple demo that implements a piece table data structure in Clojure (This is totally an excuse to use finger trees, which Chris Houser implemented and excellently presented at the first conj) A piece table is good for buffer management in a text editor, as it gets around making

Re: ClojureScript

2011-07-25 Thread Ghadi Shayban
It will be a only a matter of time before people realize it doesn't matter whether jQuery integrates or not. The examples/blog posts coming out already are spectacular. On Jul 24, 1:44 pm, Peter Taoussanis ptaoussa...@gmail.com wrote: Just want to throw in on this real quick. I am -dumbfounded-

Clojure Stored Procedure

2011-11-19 Thread Ghadi Shayban
I'm trying to load and execute an Oracle Java Stored Procedure... written in Clojure. Has anyone successfully managed to do this? Are you done throwing up? I would appreciate any direction I have a little clj that is AOT compiled, and I load the whole jar into the DB successfully. What I'm

Re: Clojure Stored Procedure

2011-11-19 Thread Ghadi Shayban
              username               comment])) Hope that helps. Cheers, Willy On Nov 19, 3:14 pm, Ghadi Shayban gshay...@gmail.com wrote: I'm trying to load and execute an Oracle Java Stored Procedure... written in Clojure. Has anyone successfully managed to do this?  Are you done

Recipe for using two databases with contrib.sql

2010-12-09 Thread Ghadi Shayban
I'm using contrib,sql to clean rows from one DB and insert them into another. I was thinking something like (pseudo-code (sql/with-connection db1 . (doseq [x (map rs)] (insert-into-other x))) (defn insert-into-other [r] (sql/with-connection db2 ...)) But this obviously will

Re: core.async: faulty rebinding of loop-bindings in go blocks

2013-08-01 Thread Ghadi Shayban
It's a nasty bug, seems like a local symbol scope issue. I will take a look at it. Thanks for the report. On Thursday, August 1, 2013 6:05:59 AM UTC-4, Kemar wrote: There seems to be an issue with the rebinding of loop-bindings using loop/recur in go blocks, specifically when you are just

Re: core.async: faulty rebinding of loop-bindings in go blocks

2013-08-03 Thread Ghadi Shayban
Fixed -- should make it to maven within an hour. On Thursday, August 1, 2013 12:47:16 PM UTC-4, Ghadi Shayban wrote: It's a nasty bug, seems like a local symbol scope issue. I will take a look at it. Thanks for the report. On Thursday, August 1, 2013 6:05:59 AM UTC-4, Kemar wrote

Re: What does IOC in terms of core.async mean?

2013-08-20 Thread Ghadi Shayban
A normal function just runs naturally through its code -- it can't abort/suspend/pause/defer evaluation. (Only the JVM or kernel can suspend things for you safely.) The inversion of control macros enable such capabilities for Clojure code while preserving normal semantics. It allows code to

Re: core.async: closing a mix only when all inputs have emptied

2014-04-22 Thread Ghadi Shayban
Howdy Charles, For a static mix of sources there's async/merge [1], and it behaves the almost exactly way you describe, impl here [2]. Stepping back, the source chan-of-chans being closed represents value production being fully in flight, while the merged channel being closed represents

Re: [ANN] CrossClj, a tool for cross-referencing the clojure ecosystem

2014-06-10 Thread Ghadi Shayban
This is so cool and extremely useful. Thank you so much for this! Ghadi On Tuesday, June 10, 2014 11:39:12 AM UTC-4, Francesco Bellomi wrote: Hello everyone, http://crossclj.info I've been working on CrossClj for some time now, and I feel it has grown usable (and useful) enough to make

Re: Clojure 1.7 and invokeStatic

2014-08-06 Thread Ghadi Shayban
Var indirection is not super cheap, as it has a volatile field, which is a memory fence. I have been working on Clojure with invokedynamic, and I have a demonstrable improvement on microbenchmarks. Obviously your application will have IO and myriad other costs, but I just want to echo that

Re: Strange behavior with alts! and :default in core async

2014-08-14 Thread Ghadi Shayban
What Daniel said. The call is incorrect, its args are alt-shaped, but it calls alt*s*. alt is the macro that is shaped like cond. alts is the function that takes a vector Both take splatted options at the end. Can never use single bang* except within go.* go = ! thread = !! Unfortunately if

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-08 Thread Ghadi Shayban
If anything let's add more bangs to the name. Unlike any of atom/ref/agent, volatile! is not really part of the familiar state model. Yes it applies a function to a thing, changing the thing. Like Luc says, not atomically. The linux hdparm tool has the –yes-i-know-what-i-am-doing and

Re: Productivity tip for code transformations with cider

2014-09-14 Thread Ghadi Shayban
Nice useful demonstration, Stathis. Thanks! On Sunday, September 14, 2014 3:35:16 AM UTC-4, Stathis Sideris wrote: Hello all, There is some functionality in cider (C-c C-w) that can potentially save you a lot of typing when transforming Clojure code and I haven't seen many people using

Playing around with transducers, what about the zero-arity of the reducing function

2014-09-16 Thread Ghadi Shayban
Call 'transduce without an init value, and it will use the 0-arity return as init. Same for reduce but in different scenarios (some IReduce/CollReduce collections) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Playing around with transducers, what about the zero-arity of the reducing function

2014-09-16 Thread Ghadi Shayban
I was sloppy with details. A reducing function like f may be transformed though by a transducer (a priori), and a transducer must preserve the contract. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Playing around with transducers, what about the zero-arity of the reducing function

2014-09-16 Thread Ghadi Shayban
I was sloppy with details. A reducing function like f may be transformed though by a transducer (a priori), and a transducer must preserve the contract. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Satisfies? seems strangely slow

2015-01-22 Thread Ghadi Shayban
Protocol call sites build an inline cache to optimize dispatch. The benchmark is running many times and reaping benefit from the cache. satisfies? looks up the object's class in the protocol's implementation map [1], and the benchmark is stressing this. You'll see that code checks if the

Re: Satisfies? seems strangely slow

2015-01-22 Thread Ghadi Shayban
at 5:52:13 PM Ghadi Shayban gsha...@gmail.com wrote: Protocol call sites build an inline cache to optimize dispatch. The benchmark is running many times and reaping benefit from the cache. satisfies? looks up the object's class in the protocol's implementation map [1], and the benchmark

Re: Extend causes error in servlet container?

2015-01-06 Thread Ghadi Shayban
Btw, if you own the defrecord, extend a protocol to it directly in its definition, rather than in a separate extend or extend-protocol form. Doing it inline makes the record implement the protocol's backing interface, which will be much more efficient. (If it's not your record you don't

[CFP] JavaOne - Clojure submissions welcomed and recommended

2015-03-26 Thread Ghadi Shayban
Clojurists, The JavaOne conference, a huge gathering, is taking place in San Francisco on October 25-29th. The Call for Proposals is now open [1], and I encourage you to submit a proposal related to Clojure. There are many different tracks and session formats available. Specifically of

Re: [CFP] JavaOne - Clojure submissions welcomed and recommended

2015-05-04 Thread Ghadi Shayban
Just as a (final) reminder, the CFP ends Wednesday night! https://www.oracle.com/javaone/call-for-proposals.html On Thursday, March 26, 2015 at 2:56:50 PM UTC-4, Ghadi Shayban wrote: Clojurists, The JavaOne conference, a huge gathering, is taking place in San Francisco on October 25-29th

Re: transducer (+ closures) efficiency question

2015-06-23 Thread Ghadi Shayban
Good question. Clojure's evaluation semantics dictate that the arguments are evaluated (computed) *before* calling the function. So(set coll) is computed before being passed to `partial`. Partial receives a function (a value) and arguments (also values) and returns back a new function that

Re: [ANN] Clojure 1.7.0-RC1 now available

2015-05-22 Thread Ghadi Shayban
This commit [1] for CLJ-1589 changed dispatch for InternalReduce, causing a bug similar to CLJ-1237 [2]. [1] https://github.com/clojure/clojure/commit/1242c4878f3d4ef30535a22f6c74144637504fbe [2] http://dev.clojure.org/jira/browse/CLJ-1237 On Friday, May 22, 2015 at 5:01:25 PM UTC-4, Jason

Re: Transducers/Eduction problem

2015-06-30 Thread Ghadi Shayban
The example is wrong. There are now two flavors of support for reduce through interfaces, IReduce and IReduceInit. The first one allows you to call reduce without an initial value. Eduction doesn't support that interface, but only IReduceInit. Reduce without an initial value is now

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-10 Thread Ghadi Shayban
Never mind the first point. I've been pointed to the fact that Tuple/create returns a PV [1] [1] https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Tuple.java#L22 On Tuesday, November 10, 2015 at 1:15:44 PM UTC-5, Ghadi Shayban wrote: > > Two points of feedback: > &

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-10 Thread Ghadi Shayban
Two points of feedback: 1) One of the reason tuples were disabled was that they polluted dispatch paths. Shouldn't we make sure that they are completely inactive? Map entries (everywhere: c.l.Persistent*, records, gvec, bean) still use them. 2) I get the rationale behind direct linking,

[ANN] pex, a powerful PEG parsing library

2015-11-16 Thread Ghadi Shayban
Here is a compliant JSON parser in 99 LOC, implemented with *pex, a new parsing library*. [1] This is alpha software. Hot off the heels of Colin Fleming's Conj talk on PEGs [2], I'm making public an early version of pex [3], a parsing library in the PEG family. For those of you familiar with

Re: [ANN] Clojure 1.8.0-beta1

2015-10-14 Thread Ghadi Shayban
Marc, Any changes up or down in run-time performance (post-startup)? On Wednesday, October 14, 2015 at 5:11:20 PM UTC-4, Marc O'Morain wrote: > > I just ran the CircleCI code-base under 1.8 beta 1 to see if there were > any gains in compile time (which is in the region of 90 seconds for our >

Re: JDK versions for clojure 1.7

2015-10-02 Thread Ghadi Shayban
1.6 and later. On Friday, October 2, 2015 at 8:12:58 PM UTC-4, webber wrote: > > Hi, > > I'd like to ask a question. > Which versions of JDK does Clojure 1.7 support ? > > 1.6 or later, 1.7 or later ? > > Thanks, > MH > > -- You received this message because you are subscribed to the Google

Re: Duplicate key exception reading map that was written to a file

2015-11-25 Thread Ghadi Shayban
While in memory before writing, are the hash codes for the "duplicate" keys the same? You can call (hash) on the keys. I'm thinking there is perhaps an issue with unicode string serialization... Are the question marks a particular character? If you can find the similar strings in memory,

Re: Duplicate key exception reading map that was written to a file

2015-11-25 Thread Ghadi Shayban
Does the phrases value in memory exactly match the payload roundtripped through Avro? -- 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 -

Re: [ANN] pex, a powerful PEG parsing library

2015-11-20 Thread Ghadi Shayban
mber 2015 at 02:43, Ghadi Shayban <gsha...@gmail.com > > wrote: > >> Thanks for taking a look. >> >> User-level bytecode allows me an easier choice to build a JIT or tracing >> infrastructure, while being far less complex than writing out JVM bytecode >>

Re: How to check if a record implements a function of a protocol

2015-11-22 Thread Ghadi Shayban
Not possible. A type/record should not implement a protocol incompletely (though the compiler won't bark at you). It can be an indication that the protocol is too large/ill-conceived. Inspecting types is antithetical to using protocols... On Sunday, November 22, 2015 at 2:28:07 PM UTC-5,

Re: [ANN] pex, a powerful PEG parsing library

2015-11-19 Thread Ghadi Shayban
Thanks for taking a look. User-level bytecode allows me an easier choice to build a JIT or tracing infrastructure, while being far less complex than writing out JVM bytecode during grammar compile. Christophe has certainly been a help offline with design choices. I wanted PEG, no ambiguity,

Re: [ANN] Clojure 1.9.0-alpha4

2016-06-02 Thread Ghadi Shayban
Let bindings from thbe macroexpansion of (let [[x & xs] v] ...) ;; old macroexpand [G__1 v vec__2 G__1 x (nth vec__2 0 nil) xs (nthnext vec__2 1)] ;; new macroexpand [G__6 v vec__7 G__6 seq__8(seq vec__7) first__9 (first seq__8) seq__8(next

Re: [ANN] Ticket - an encrypted ticket/cookie library

2016-02-11 Thread Ghadi Shayban
Btw, ever looked at Macaroons? Apparently Google uses them internally. http://research.google.com/pubs/pub41892.html http://hackingdistributed.com/2014/05/21/my-first-macaroon/ Ghadi On Thursday, February 11, 2016 at 1:29:56 PM UTC-5, Michael Ball wrote: > > Thanks! Yes I looked at JWE, but it

Re: clojure.compiler.disable-locals-clearing memory leak?

2016-01-25 Thread Ghadi Shayban
It's explicitly to help a debugger. Best to not use that option except when debugging. (It disables certain bytecode patterns that help to avoid OutOfMemory errors) On Monday, January 25, 2016 at 1:49:03 AM UTC-5, Mars0i wrote: > > In my application, I seem to get a memory leak when I use >

Re: Welcome the new maintainer of Loom: Paul Snyder

2016-02-15 Thread Ghadi Shayban
You're going to be a great maintainer, Paul. On Monday, February 15, 2016 at 5:30:04 PM UTC-5, Paul L. Snyder wrote: > > On Mon, 15 Feb 2016, Gregg Reynolds wrote: > > > On Feb 11, 2016 6:19 AM, "Aysylu Greenberg" > wrote: > > > > > > I'm pleased to announce that Paul

Re: finding clojure functions from the mangled names

2016-12-09 Thread Ghadi Shayban
The stacktrace should be pointing to the correct file & line number -- no need to reverse engineer the mangling. If it's not for some reason, file a bug. (It's helpful to eliminate nREPL / lein middleware in case something is transforming the printing of traces) If you are missing a trace

Re: Elegant way to do lazy infinite list with custom step

2016-12-13 Thread Ghadi Shayban
A common way to do it in Clojure is `iterate`, no macros necessary. As of Clojure 1.7 this doesn't allocate a list at all if you reduce/fold over it: (iterate #(+ % 2) 4) On Tuesday, December 13, 2016 at 11:27:28 PM UTC-5, tbc++ wrote: > > I'm not aware of such a construct, but it's trivial

Re: Elegant way to do lazy infinite list with custom step

2016-12-14 Thread Ghadi Shayban
ime and I was tired. Nice example though. > > On Tue, Dec 13, 2016 at 10:03 PM, Ghadi Shayban <gsha...@gmail.com > > wrote: > >> A common way to do it in Clojure is `iterate`, no macros necessary. As of >> Clojure 1.7 this doesn't allocate a list at all if you redu

Re: Changing value of atom vector using swap

2016-12-20 Thread Ghadi Shayban
swap! takes as its arguments the atom and the function to transition the state inside the atom. It implicitly calls the function on the state: (swap! data replace-value) It also can accept trailing arguments too...

Re: spec'ing relationship of values in a sequence?

2017-08-20 Thread Ghadi Shayban
You have the right idea with s/and. I would name & defn the predicate to something meaningful like increasing?. Defining and thus naming it is essential so that you can get reuse, and also so that consumers of your spec, whether it's you or someone else, don't have to interpret the code in

Re: with-open pattern

2017-05-05 Thread Ghadi Shayban
Maybe I don't understand the problem at hand yet -- you can almost certainly do this without language help. Can you help out with a concrete example or problematic code? On Friday, May 5, 2017 at 2:18:17 PM UTC-4, Brian Craft wrote: > > This looks like a partial solution: > >

Re: with-open pattern

2017-05-04 Thread Ghadi Shayban
Hi Brian, Both plain seqs or reducibles can be consumed without realizing the whole thing in memory, especially important (as you note) when the whole thing is humongous and dwarfs available memory. To do it with a lazy seq, as in clojure.java.jdbc, you have to care of a few things. You must

Re: [ANN] Clojure 1.9.0-beta1 is now available

2017-09-18 Thread Ghadi Shayban
Congrats everyone! What a major release. -- 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 your first post. To

Re: Question about Clojure parallelization

2017-09-12 Thread Ghadi Shayban
One thing slowing you down is that your function "parallel-process" is calling fold on a line-seq, which is not a foldable source, so you won't get any parallelism. It devolves to a sequential reduce. As an alternative, consider partitioning the lines into batches of a few thousand, then

Re: Help ship Clojure 1.9!

2017-09-28 Thread Ghadi Shayban
Clojure 1.9 has been great for me so far. I think it's worth considering the problem Luke brought up regarding the REPL caught handler [1], especially since the compiler now checks macro specs. Having a slightly better knob for that might be nice, since it's an integration point. (This is not

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

2018-02-25 Thread Ghadi Shayban
Clojure always worked on Java 9 but lein and boot were broken for a while. Now they're fixed. The only remaining defect is the inability for Clojure to call static interface methods which are a new thing in Java 8. The bytecode verifier in Java 9 added a small backwards incompatible check that

[ANN] depstar: a clj-based uberjarrer

2018-03-12 Thread Ghadi Shayban
My workflow has generally changed to one based on clj and tools.deps wherever possible. I continue to use lein for uberjarring, so I wrote this tool to jar up the classpath. depstar has no dependencies, and uses the JVM classpath instead of reading deps.edn directly. It handles merging

Re: [ANN] 1.10.0-beta4

2018-10-26 Thread Ghadi Shayban
Verification time should go down with JDK8 level bytecode, which improves cold startup of clojure.jar by about 5%. (This benefit is negated by the module system in 9+ though.) On Friday, October 26, 2018 at 12:27:44 PM UTC-4, Alex Miller wrote: > Likely the biggest performance gain is that

Re: GraalVM's native-image incompatible with Clojure's eval?

2018-11-26 Thread Ghadi Shayban
Substrate makes a closed world assumption. jaotc is open world, and also based on Graal. -- 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 -

[ANN] Clojure core.async 0.4.500 released

2019-06-11 Thread Ghadi Shayban
Release 0.4.500 on 2019.06.11 - ASYNC-227 cljs alts! isn't non-deterministic - ASYNC-224 Fix bad putter unwrapping in channel abort - ASYNC-226

Re: Use invokedynamic instead of the reflection API when possible

2019-05-22 Thread Ghadi Shayban
t; Hi Rémi! Thanks for all your work on ASM and other JVM stuff over the > years by the way. > > We have of course been poking at indy off and on over the years and there > have been a number of experiments with it. Ghadi Shayban has probably done > the most work on that and he proba

Re: core.async: Unbound channels

2019-07-03 Thread Ghadi Shayban
(chan) is not a channel with an unbounded buffer. It is a channel with *no* buffer and needs to rendezvous putters and takers 1-to-1. (Additionally it will throw an exception if more than 1024 takers or putters are enqueued waiting) On Wednesday, July 3, 2019 at 7:14:46 AM UTC-4, Ernesto

Re: [ANN] proxy-plus: Faster and more usable replacement for "proxy"

2020-01-20 Thread Ghadi Shayban
I tried using proxy+ for one of the proxy implementations in clojure.core, but I ran into an issue where a "too many matching methods" got thrown at macroexpansion time. The proxy I tried to replicate was PrintWriter-on