Re: idempotency

2012-06-30 Thread Alan Malloy
That's really a stricter requirement than idempotence (ie, functional purity). I don't believe the compiler ever does this. The JVM might, if it's able to inline some particular method call and discover therein that no mutation happens, but that's probably pretty rare given the amount of indire

Re: Protocol as an abstract data type

2012-06-30 Thread David Nolen
On Sat, Jun 30, 2012 at 11:15 PM, Mark Engelberg wrote: > > In any case, I feel like I understand better how you've structured things in > ClojureScript and what can and can't be done easily with protocols. Thanks! I think predicate dispatch + protocols could eliminate the existing closed cases.

Re: Protocol as an abstract data type

2012-06-30 Thread Warren Lynn
implementation which only supports one abstract protocol!) I don't feel strongly about last specifically, but if people wanted it to behave polymorphically, I'd be happy to volunteer to write the code. Thanks a lot for the detailed analysis and volunteering to write the code. Not surprisingly

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
OK, I get it now. Protocols are attached to very specific capabilities. With this structure, it is easy to: Write a function that operates on an input that fulfills a specific protocol. Write a function that operates on an input that fulfills (all of) multiple protocols. Write a function that op

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
Never mind, found it. -- 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 unsubscribe from this grou

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
On Sat, Jun 30, 2012 at 9:36 PM, David Nolen wrote: > Look at the implementation of nth. Or how polymorphic unification works in > ClojureScript core.logic for ISequential. I misspoke a bit, should have > clearer that I simply meant that ILast (probably something else entirely) > needs to be care

Re: Protocol as an abstract data type

2012-06-30 Thread David Nolen
Look at the implementation of nth. Or how polymorphic unification works in ClojureScript core.logic for ISequential. I misspoke a bit, should have clearer that I simply meant that ILast (probably something else entirely) needs to be carefully considered since the logic needs too be moved to the act

Re: idempotency

2012-06-30 Thread Softaddicts
You should then use memoize explicitly then. Of course, avoid this if you have side effects in the function. Luc > In its optimization, does the Clojure compiler ever assume idempotency? That > is, does it ever look at a function application `(f x y z)` and say to itself > "I may freely substi

Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
This is a continuation of issues raised in the thread about making the core "last" function behave in a polymorphic manner. The separation of interfaces from implementation in Java serves several purposes, but one thing it does is it allows the creation of abstract data types, i.e., a type that is

idempotency

2012-06-30 Thread Brian Marick
In its optimization, does the Clojure compiler ever assume idempotency? That is, does it ever look at a function application `(f x y z)` and say to itself "I may freely substitute the result of the first application of `f` to those particular arguments for any later call"? I could imagine it do

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Mark Engelberg
On Sat, Jun 30, 2012 at 10:24 AM, Warren Lynn wrote: > I think some people agree with me something is broken here (puzzler, for > example. Please correct me is I am wrong as I don't want to hijack other > people's opinion). > One really nice thing about the Clojure community is that from the ver

Re: ANN Monger 1.1.0-beta1

2012-06-30 Thread Bruce Durling
Michael, On Sat, Jun 30, 2012 at 9:11 PM, Michael Klishin wrote: >  * An alternative Ring session store that stores session data in a way that's > not interoperable with non-Clojure applications >   but works well with namespaced keywords that Friend [3] relies on Excellent news. I look forward

class loading on startup

2012-06-30 Thread Maris
When debugging class loading issues I noticed that clojure tries to load many non-existing classes. For example this__5587__auto__, gf__x__8266 , f__5717__auto__. It happens on startup, in static init block of RT.java. Are those type hints generated by some macro ? protected Class findClass(S

Clojure in OSGi and *use-context-classloader*

2012-06-30 Thread Maris
I am using clojure in apache karaf which has Thread context class loader set to karaf jars. I changed use-context-classloader to false in RT.java: final static public Var USE_CONTEXT_CLASSLOADER = Var.intern(CLOJURE_NS, Symbol.intern("*use-context-classloader*"), F).setDynamic(); For some rea

[ANN] clj-cc lib

2012-06-30 Thread Warren Lynn
Available here: https://github.com/wrn/clj-cc This is a very simple lib (for now only three functions) that I created in response to people's suggestions in the following two threads: 1. Why cannot "last" be fast on vector?

ANN Monger 1.1.0-beta1

2012-06-30 Thread Michael Klishin
Monger [1] is a Clojure MongoDB driver for a more civilized age: friendly, flexible, well documented and with batteries included. 1.1.0-beta1 is released to clojars [2]. This release includes a bunch of small improvements: * An alternative insert function many people have been suggesting * Cl

Re: verify that a fn throws an exception via testing?

2012-06-30 Thread Dimitrios Jim Piliouras
I am away in holidays and missed your response Brian...Thanks a lot for taking the time to reply and of course thanks for midje! I will consult the entire midje wiki once I go back to an actual office!!! Jim On Mon, Jun 25, 2012 at 11:05 PM, Brian Marick wrote: > > On Jun 25, 2012, at 6:21 AM,

Re: Would a"def-" macro for private varibales make sense?

2012-06-30 Thread Sean Corfield
On Sat, Jun 30, 2012 at 7:30 AM, Vinzent wrote: > It's better to use ^:private metadata on the symbol naming the var, since > there is also defmacro, defmulti, etc, which not have hyphened versions too. It seemed to be consensus that defn- was probably not a good idea but was too common to remove

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Sean Corfield
On Sat, Jun 30, 2012 at 7:09 AM, Warren Lynn wrote: > As I mentioned before, the issue here is not just a fast "last". The issue > here is I find the design of Clojure "wrong", or confusing. That really > shakes my confidence in the whole system. Some of Clojure's design decisions take a while to

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Warren Lynn
On Saturday, June 30, 2012 1:03:04 PM UTC-4, Las wrote: > > Warren, > > I think the issue is this: > > You claim there is sg. broken in clojure while admitting that you know > little about how the design decision was made. > > People that know clojure's implementation and the history of design

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread László Török
Warren, I think the issue is this: You claim there is sg. broken in clojure while admitting that you know little about how the design decision was made. People that know clojure's implementation and the history of design decisions inside-out offered advice why they think it is not broken, they t

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Warren Lynn
Craig: If the dominant community attitude is "before you know everything about Clojure, you have no right to comment", then that itself will be the reason not to use Clojure. But I think that is just you, not the community. Although I am glad some people paid attention to this post, I have far

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Craig Brozefsky
Warren Lynn writes: >As I mentioned before, the issue here is not just a fast "last". The >issue here is I find the design of Clojure "wrong", or confusing. That >really shakes my confidence in the whole system. To say stuff like this, then be demure about digging into the code and u

Re: Using core.logic at a lower level

2012-06-30 Thread Konrad Hinsen
Michael Fogus writes: > It's not a total solution to all of your requirements, but core.unify > is meant for use as a library. See > https://github.com/fogus/unifycle/blob/master/src/fogus/unifycle.clj > for examples. Looks interesting, but I do need logic variables as distinct entities that

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Warren Lynn
On Saturday, June 30, 2012 9:51:56 AM UTC-4, stuart@gmail.com wrote: > > Having separate "peek" and "last", with documented performance > characteristics, makes it straightforward to reason about how code is > likely to perform, a point that Mark made earlier. > > As I said before, I strongl

Re: Would a"def-" macro for private varibales make sense?

2012-06-30 Thread Vinzent
It's better to use ^:private metadata on the symbol naming the var, since there is also defmacro, defmulti, etc, which not have hyphened versions too. суббота, 30 июня 2012 г., 17:49:36 UTC+6 пользователь Goldritter написал: > > For functions I have a "defn" macro to create public functions and a

core.incubator 0.1.1 released

2012-06-30 Thread Chas Emerick
Hi all, Version 0.1.1 of the core.incubator project has been released. It may take a couple of hours for the release to be synced up to Maven central. The project itself can be found here: https://github.com/clojure/core.incubator The only change in this version compared to 0.1.0 is the addit

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Warren Lynn
As I mentioned before, the issue here is not just a fast "last". The issue here is I find the design of Clojure "wrong", or confusing. That really shakes my confidence in the whole system. I am also not talking about implementations, which is a separate issue that I don't know much yet Accor

Why cannot "last" be fast on vector?

2012-06-30 Thread David Nolen
On Friday, June 29, 2012, Mark Engelberg wrote: > On Fri, Jun 29, 2012 at 4:50 PM, David Nolen wrote: > >> ISeq *is* an interface on Clojure JVM. But ideally it would be >> protocol as in ClojureScript. But then all ISeq implementing types >> must also implement this new protocol you are suggestin

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Stuart Halloway
Having separate "peek" and "last", with documented performance characteristics, makes it straightforward to reason about how code is likely to perform, a point that Mark made earlier. It is a fundamental design principle of Clojure that, when given two approaches, A and B, make primitive the on

Re: Would a"def-" macro for private varibales make sense?

2012-06-30 Thread Ambrose Bonnaire-Sergeant
This topic has come up before. The conclusion from people of authority is that clojure.core is not the place for this macro, but may be appropriate for some other library. Thanks, Ambrose On Sat, Jun 30, 2012 at 7:49 PM, Goldritter < marcus.goldritter.lind...@googlemail.com> wrote: > For functio

Would a"def-" macro for private varibales make sense?

2012-06-30 Thread Goldritter
For functions I have a "defn" macro to create public functions and a "defn-" macro to define private functions. For variables I have only "def". Would it make sense to also have a "def" macro for public variables and a "def-" macro for private variables, also variables which can be only accessed

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Craig Brozefsky
Sam Ritchie writes: >Perhaps place them inside a protocol, where core supplies I don't think a protocol is needed to identify a performance characteristic, which as far as I can tell really is limited to vectors. The definition of vector? itself is sufficient. Also, consider that last is d

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Craig Brozefsky
Warren Lynn writes: >Although I have not yet looked at any of Clojure's internals yet, I >suspect the change won't be too difficult (for the right person). So I >hope/wish someone with enough knowledge, skills and influence will >agree with me and advocate a review of the design (