Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-07 Thread Akos Gyimesi
On Tue, May 6, 2014, at 07:54 PM, Timothy Baldridge wrote: Clojure is being reworked into literate form already Proof of this claim? I think Tim referred to his personal project to convert Clojure code into a literate form: [1]https://groups.google.com/forum/#!topic/clojure/RgQX_kXzFMM

Re: core.async and Joy of Clojure

2014-05-07 Thread gamma235
Hey Timothy, I just finished working through the code from your talk and have a question. In the code there is this code: (go (loop [] (when-let [v (! print-chan)] (println v) (recur I wanted to expand it into something like a logger that writes out to a

Clojure Java 8 Compact Profiles

2014-05-07 Thread Ben Evans
Hello, I mostly only lurk here, but I recently was running a small experiment with Java 8 Compact Profiles (essentially, restricted versions of the JRE designed for serverside deployments that only ship a subset of rt.jar) and thought it might be of interest. Clojure appears to depend on the

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-07 Thread Phillip Lord
Sean Corfield s...@corfield.org writes: On May 6, 2014, at 8:11 AM, Phillip Lord phillip.l...@newcastle.ac.uk wrote: I've used this example before; consider this unstructured string from `cons`. Returns a new seq where x is the first element and seq is the rest. Just because one (or

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-07 Thread Phillip Lord
Tim Daly d...@axiom-developer.org writes: - include diagrams and pictures It is easy to show the red-black tree rebalance algorithm with a few pictures whereas the words are rather opaque. Stacks and immutable copy algorithms are also easy in diagrams. You CAN do

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Phillip Lord
Since the data structures and interfaces, they are effectively immutable. Consider this: final public class Cons extends ASeq implements Serializable { private final Object _first; private final ISeq _more; public Cons(Object first, ISeq _more){ this._first = first; this._more

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-07 Thread Phillip Lord
Gregg Reynolds d...@mobileink.com writes: On Tue, May 6, 2014 at 10:11 AM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: True, and, to some extent, it inherits the ; vs ;; comment distinction. But, again, there is not structure. This is an unstructured string also. Compare Emacs Lisp, for

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-07 Thread Valentin Luchko
Sorry, but you guys didn't understand the problem. *tbc++*, I don't use core.async, so I don't require it dgrnbrg, I don't want to interface these libraries together. Let me try explain again. 1. I have http-kit socket server running 2. When client connects I store its connection (http-kit's

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-07 Thread Timothy Baldridge
core.async provides its own implementation of merge that returns a ManyToMany channel. So that's why the call to merge is returning a channel. But why I haven't a clue. I still claim that you have a dirty repl or something. Timothy On Wed, May 7, 2014 at 6:11 AM, Valentin Luchko

Reduce vs. Comp

2014-05-07 Thread Mark Watson
What is the difference between: (reduce #(%2 %) 6 [(partial + 12) (partial * -1)]) and ((apply comp [(partial * -1) (partial + 12)]) 6) Using reduce *looks* nicer to me, but I feel like I'm re-implementing comp. Their performance is also the same (go inlining!). -- You received this message

defrecord, looking for more info on the __meta and __extmap fields and constructor arguments

2014-05-07 Thread Dave Tenny
The documentation for defrecord mentions additional arguments but doesn't give any examples of their use. I take it that the __extmap field generated for the class is for map slots that aren't defined with the defrecord fields. What is the __meta slot for and how is it typically used? --

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Andy Fingerhut
Mike, I believe I understand the definition of truly immutable you are using here, and what it means in the JVM as far as synchronization of object values across threads. What seems a bit odd is to use the phrase truly immutable to describe something that is clearly mutable, or at least it is by

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Andy Fingerhut
Sorry if I'm beating a dead horse here. I agree that my example is not using published Clojure APIs, and I never do that kind of thing in a Clojure program, except as an example that PersistentVector's are mutable if you use Java APIs instead of restricting yourself to Clojure APIs. You don't

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Mike Fikes
Phil, that's an interesting point. Consider (def x (cons (new java.util.Date) ())) The object identified by x is *mutable*, but if the contained Date will not be modified by the program, then the resulting object can be treated as *effectively immutable, *as you pointed out. But, it would

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Mike Fikes
Yep. PersistentVector is *mutable* per the JCIP definition. If it is *mutable* then you need to use locks or synchronization to access its contents. If your program doesn't modify its the vector, it is *effectively immutable. *But, you need to ensure that you safely publish it. But, if you

Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel

2014-05-07 Thread Valentin Luchko
Now it makes sense. Thank you среда, 7 мая 2014 г., 15:39:38 UTC+3 пользователь tbc++ написал: core.async provides its own implementation of merge that returns a ManyToMany channel. So that's why the call to merge is returning a channel. But why I haven't a clue. I still claim that you have

Re: Immutable or Effectively Immutable?

2014-05-07 Thread Mike Fikes
I would offer that the key distinction is whether final is used: This prescribes what you must do when using the object. Take Date for example. You can't just pass one directly from one thread to another. The receiving thread could read a date associated with System.currentTimeMillis() of 0.

Re: Contagious BigDecimals?

2014-05-07 Thread Mars0i
Reviving a thread from three years ago (feel free to point me to something more recent) ... In Clojure 1.6: (class (+ 1 1.0M)) ; == java.math.BigDecimal (class (+ 1.0 1.0M)) ; == java.lang.Double So combining a BigDecimal with a Long produces a BigDecimal, but combining it with a Double

Re: Reduce vs. Comp

2014-05-07 Thread Mike Fikes
I agree with the re-implementing comp sentiment. It reminds me of *A tutorial on the universality and expressiveness of fold http://www.cs.nott.ac.uk/~gmh/fold.pdf *where, essentially lots of standard functions can be defined in terms of reduce which could be considered primitive. In fact,

Re: Reduce vs. Comp

2014-05-07 Thread John Mastro
Hi, Mike Fikes mikefi...@me.com wrote: In fact, section 5 of that document defines comp as a reduce involving the identify function in some way. (Now, I want to re-read this paper, but translated into Clojure.) Here's one definition of comp in terms of reduce: (defn comp [ fs] (reduce (fn

Re: Reduce vs. Comp

2014-05-07 Thread Timothy Baldridge
If you read the source for comp, you'll find that anything more than 3 args gets turned into something like reduce anyways: (defn comp Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of

clojure.repl/pst problem

2014-05-07 Thread Plínio Balduino
Hi there Inside REPL there's a function pst that shows the stacktrace of last exception: (doc pst) - clojure.repl/pst ([] [e-or-depth] [e depth]) Prints a stack trace of the exception, to the depth requested. If none supplied, uses the root cause of the most recent

Re: Reduce vs. Comp

2014-05-07 Thread Gary Johnson
Reduce is indeed a swiss-army knife for functional programming over sequences. Of course, in this particular case (i.e., apply a sequence of functions in order to an initial value), Clojure's threading operators are the idiomatic way to go. (- 6 (+ 12) (* -1)) Cheers, ~Gary -- You

Re: Managing State Changes, using Component

2014-05-07 Thread Stuart Sierra
Actually, now that I think about it, that's not right. It shouldn't matter where or when you create the Atom. Instead, what I suspect you have is two or more instances of the component containing the Atom, thus two different Atoms. You can tell if the Atoms are the same object by printing

Re: Contagious BigDecimals?

2014-05-07 Thread Stephen Gilardi
On May 7, 2014, at 12:11 PM, Mars0i marsh...@logical.net wrote: To me, the fact that BigDecimal is contagious sometimes but not always, seems confusing in a way that could encourage bugs. The fact that BigInts are contagious would also lead one to assume that BigDecimals are contagious. I

Re: defrecord, looking for more info on the __meta and __extmap fields and constructor arguments

2014-05-07 Thread Alex Miller
On Wednesday, May 7, 2014 8:59:17 AM UTC-5, Dave Tenny wrote: The documentation for defrecord mentions additional arguments but doesn't give any examples of their use. There are none. I take it that the __extmap field generated for the class is for map slots that aren't defined with

Re: clojure.repl/pst problem

2014-05-07 Thread Stephen Gilardi
On May 7, 2014, at 12:55 PM, Plínio Balduino pbaldu...@gmail.com wrote: But the documentation also shows that I can set the depth of stacktrace, what I guess that can be a number of lines: (pst 5) IllegalArgumentException No matching field found: getStackTrace for class java.lang.Long

Re: clojure.repl/pst problem

2014-05-07 Thread Plínio Balduino
That's true. My Leiningen is using 1.5.1 yet. Thank you Stephen. On Wed, May 7, 2014 at 3:18 PM, Stephen Gilardi scgila...@gmail.com wrote: On May 7, 2014, at 12:55 PM, Plínio Balduino pbaldu...@gmail.com wrote: But the documentation also shows that I can set the depth of stacktrace, what

Re: Contagious BigDecimals?

2014-05-07 Thread Mars0i
On Wednesday, May 7, 2014 1:00:01 PM UTC-5, squeegee wrote: On May 7, 2014, at 12:11 PM, Mars0i mars...@logical.net javascript: wrote: To me, the fact that BigDecimal is contagious sometimes but not always, seems confusing in a way that could encourage bugs. The fact that BigInts are

[did...@lrde.epita.fr: [clisp-list] [CfP] International Lisp Conference 2014, Aug. 14-17, Montreal]

2014-05-07 Thread Tim Daly
From: Didier Verna did...@lrde.epita.fr ILC 2014 - International Lisp Conference Lisp on the Move August 14-17 2014, University of Montreal, Montreal, Canada Sponsored by the Association of Lisp Users In cooperation

Re: Reduce vs. Comp

2014-05-07 Thread Mark Watson
I agree. I guess I was specifically thinking of a list of functions where the length of the list, and the functions themselves, are defined at run-time. Which would lead to some nasty code using the threading macros. (Unless someone has an example of this not being the case) On Wednesday, May

[ANN] Strange Loop 2014 - CFP closes May 9th

2014-05-07 Thread Alex Miller
Strange Loop is a multi-language multi-paradigm multi-disciplinary industry/academic/dilettante/enthusiast conference bringing together software developers to look at the past, present, and future of what we do as developers. Strange Loop 2014 will take place Sept 18-19 (preconf Sept 17) in

Tag classes required to be imported?

2014-05-07 Thread Colin Fleming
Hi all, I just came across a case with AOT compilation that I haven't seen before. I have the following code: (defn clojurescript? [element] (or (.isKindOf (psi/language element) (ClojurescriptLanguage/getInstance)) (.isKindOf (psi/language element) (CljxLanguage/getInstance

Re: Tag classes required to be imported?

2014-05-07 Thread Colin Fleming
Interestingly, this does not occur if the type hint is on the var rather than the arglist. According to the IRC conversation referenced herehttps://github.com/jonase/eastwood/issues/37, this should work fine for non-primitive type hints. On 8 May 2014 16:55, Colin Fleming