Re: Using type hints to optimize protocol invocation

2015-09-08 Thread Nicola Mometto
Protocol callsites are already optimized in clojure. Here's the emitted bytecode for a protocol invocation: 0: aload_0 1: aconst_null 2: astore_0 3: dup 4: invokestatic #36 // Method clojure/lang/Util.classOf:(Ljava/lang/Object;)Ljava

Re: [ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Zach Oakes
Thanks, I just made the change in both the release zip and the demo. I was aware of "overflow: hidden", but it prevents you from scrolling with your mouse/trackpad either, so results that can't fit will just be cut off. However, I think supporting browsers and OSes that have visible scrollers i

Re: [ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Aaron Cohen
I should have given you that information up front, sorry. I just tried it in Windows 10 using both Edge and Chrome and both have scrollbars. Earlier I was using Chrome in Windows 7. I was able to fix it in the inspector using "overflow: hidden": .paren-soup .instarepl .result { position: rel

Re: [ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Zach Oakes
I'm bad at CSS, but it looks like there isn't a standard way to hide scrollbars in browsers without removing the ability to scroll. Are you using Windows? Maybe I can boot up a VM and try things out to fix this issue. On Tuesday, September 8, 2015 at 5:05:32 PM UTC-4, Zach Oakes wrote: > > Yeah

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: Using type hints to optimize protocol invocation

2015-09-08 Thread Gary Fredericks
I'm not an expert on this subject, but two thoughts come to mind: 1. the point of protocols is polymorphism, and if I understand you correctly, the case you're describing is narrowed enough that it is *not* polymorphic -- i.e., if the compiler can statically determine what code to

[ANN] Mongologic 0.5.1 – A toolkit to develop MongoDB apps

2015-09-08 Thread xavi
Mongologic provides several tools to make the development of MongoDB-backed applications easier and faster: - Callbacks in the lifecycle of records (à la Rails' Active Record) - Uniqueness validation - Range-based pagination - History https://github.com/xavi/mongologic I hope you find it usefu

Re: [ANN] mixfix syntax for clojure

2015-09-08 Thread Matching Socks
The Readme is excellent and illuminates some of the depth behind the brief example that opened this thread. If it is possible for depth to be behind. In this case I believe it is. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

[ANN] mixfix syntax for clojure

2015-09-08 Thread Vitaliy Akimov
This library allows using mixfix operators with easy definitions in clojure, so it is possible to write code like this: (defn myfun [x y] (if x < 2 then x + y - 1 else (x + y) * 2)) Or for some EDSL (in this example SQL-like) (exec (select * from table1, table2 where col1 < col2 group

[ANN] mixfix syntax for clojure

2015-09-08 Thread Vitaliy Akimov
This library allows using mixfix operators with easy definitions in clojure, so it is possible to write code like this: (defn myfun [x y] (if x < 2 then x + y - 1 else (x + y) * 2)) Or for some EDSL (in this example SQL-like): (exec (select * from table1, table2 where col1 < col2 group by c

Re: [ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Zach Oakes
Yeah I should've tested on a non-Mac. That should just be a CSS change if there is a way to make scrollbars disappear. I'll look into it soon. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.

Using type hints to optimize protocol invocation

2015-09-08 Thread Nathan Marz
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 also learned recently that Clojure does not use static type information to do the lookup at compile-time and avoid the overhead. Given that Clojure a

Re: [ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Aaron Cohen
For me, the instarepl column seems to be unreadable because all the results have horizontal scrollbars that entirely obscure the results. On Tue, Sep 8, 2015 at 4:38 PM, Zach Oakes wrote: > This is a ClojureScript viewer and editor you can embed in any website. I > hope to make it better than Co

[ANN] paren-soup 0.1.1, a browser-based editor for CLJS

2015-09-08 Thread Zach Oakes
This is a ClojureScript viewer and editor you can embed in any website. I hope to make it better than CodeMirror for those who don't need polyglot support. I announced it last week but it was pretty much unusable because it didn't have paren completion. Now it is slightly more usable. Here are

Re: Type hint using protocol

2015-09-08 Thread William la Forge
Frances, I have two implementations of INode, record MapNode and record VectorNode, which are defined in other files. Also, I get a syntax method when calling new-node without the leading dot when using defprotocol: java.lang.IllegalArgumentException: No single method: newNode of interface: a

Re: Type hint using protocol

2015-09-08 Thread William la Forge
aatree.nodes.INode always gives me a class not found. But switching to definterface does it for me. Many thanks! On Tuesday, September 8, 2015 at 3:16:56 PM UTC-4, Andrey Antukh wrote: > > > > On Tue, Sep 8, 2015 at 9:31 PM, William la Forge > wrote: > >> I'm finally looking at warn on reflecti

Re: Type hint using protocol

2015-09-08 Thread Francis Avila
I don't quite understand why you are not calling the Protocol method as a function, i.e. (new-node this t-2 lev l r c) (no leading dot on new-node). I also don't see anything which actually *implements* INode. Note that the meaning of "method" in "Protocol method" is not the same as in "Java

Re: Type hint using protocol

2015-09-08 Thread Andrey Antukh
On Tue, Sep 8, 2015 at 9:31 PM, William la Forge wrote: > I'm finally looking at warn on reflection. Everything is going fine except > in the nodes.clj file where I define a protocol, INode, with a method, > new-node and then try to call that method from a function, revise. > > I'm using Clojure

Re: Type hint using protocol

2015-09-08 Thread William la Forge
I'm finally looking at warn on reflection. Everything is going fine except in the nodes.clj file where I define a protocol, INode, with a method, new-node and then try to call that method from a function, revise. I'm using Clojure 1.7.0 and the file is https://github.com/laforge49/aatree/blob/m

Re: book [clojure programming] confuse

2015-09-08 Thread Moe Aboulkheir
Johnny, On Tue, Sep 8, 2015 at 11:32 AM, Johnny Wong wrote: > > why " deliver a @b is going to fail " ? 1 and 2 are just two > independent threads , "deliver a 42" will unblock thread 2 , and then > thread 1 will be unblocked . > Thread 1 is waiting on delivering a result to "a", though, which

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

2015-09-08 Thread Thomas Heller
> > > For instance, which one of these to you consider to be the best > representation of a event to set the expiry time: > >[:cache/expire #inst "2015-09-08T12:00:00Z"] > >{:type :cache/expire, :value #inst "2015-09-08T12:00:00Z"} > >#cache.Expire [#inst "2015-09-08T12:00:00Z"] > >

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

2015-09-08 Thread James Reeves
On 8 September 2015 at 11:38, Thomas Heller wrote: > > If you look at these implementations > > (def OneOff [(s/one s/Str 'name) (s/one s/Str 'email)]) > > (s/defrecord OneOff > [name :- s/Str > email :- s/Str]) > > (defrecord OneOff [name email]) > > All of them do more or less the same

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

2015-09-08 Thread Thomas Heller
I don't use schema/core.typed much in my actual projects, while I have done many attempts it just never worked out. I like the idea and should definitely use them more but it is just too much of a moving system and not stable enough yet (eg. didn't even know s/either is deprecated). If you look at

book [clojure programming] confuse

2015-09-08 Thread Johnny Wong
pdf version page 165: " Promises don’t detect cyclic dependencies This means that (deliver p @p), where p is a promise, will block indefinitely. However, such blocked promises are not locked down, and the situation can be resolved: (def a (promise)) (def b (promise)) (future (deliver a @b)