Re: Critiques of "my-flatten" which uses CPS

2014-07-17 Thread Mark P
One other question occurs to me re your comment... It's worth understanding how to go back and forth between accumulator-style > and a lazy construction. You can convert the above non-lazy accumulator > version into a similar version that is lazy but has no risk of stack > overflow in the real

Re: Critiques of "my-flatten" which uses CPS

2014-07-17 Thread Mark P
Woopse, typo towards the end of my last post... Maybe the thing to do would be to use (next x) here for this > implementation, which is angling to be lazy... But in your earlier > acc-based my-flatten, to use (next x) instead > Should be... Maybe the thing to do would be to use (rest x) ...

Re: Critiques of "my-flatten" which uses CPS

2014-07-17 Thread Mark P
Coming back to your helpful comments about relationship between acc-style and lazy... It's worth understanding how to go back and forth between accumulator-style > and a lazy construction. You can convert the above non-lazy accumulator > version into a similar version that is lazy but has no r

Re: Critiques of "my-flatten" which uses CPS

2014-07-16 Thread Mark P
Interesting - thank you! Good to know about "into" as a way to achieve a non-lazy concat - in conjunction with a vector. I like your accumulator version - morphing the structure of the input as you go to achieve the desired result. I've come up with another version, that passes through both a

Re: Critiques of "my-flatten" which uses CPS

2014-07-15 Thread Mark P
a function of no > arguments, and call the recursive function with trampoline. > > Another thing you have to do is wrap the concat in a doall, otherwise > you'll get a stack overflow when the deeply nested lazy concatenation is > realized. > > > On Tue, Jul 15, 2014

Critiques of "my-flatten" which uses CPS

2014-07-15 Thread Mark P
I'm very new to continuation passing style (CPS), and as part of the learning process I've done a CPS version of a "flatten" function. Ie, it does the same thing as the standard clojure "flatten", but is implemented using a recursive local CPS helper function. I'm interested in comments / cri

Re: Style-question: self-named attribute getters?

2014-06-26 Thread Mark P
Thanks Ryan and James - that gives me a few more ideas on how to think about things. Hopefully some of the links Ryan posted will clarify things for me also. Ryan - yes my question about namespaces was to do with understanding the ideal granularity of namespaces. And more specifically, whethe

Re: Style-question: self-named attribute getters?

2014-06-25 Thread Mark P
27;s choices for > doing "object"-like things: > > > https://github.com/Prismatic/eng-practices/blob/master/clojure/20130926-data-representation.md#data-types > > On Wednesday, June 25, 2014 6:34:50 PM UTC-7, Mark P wrote: >> >> I've only recently starte

Style-question: self-named attribute getters?

2014-06-25 Thread Mark P
I've only recently started real clojure development, so very much still learning what styles work and what don't. I have a question about naming attribute getters... Suppose I want to model "fruit" entities. I will use a hash-map to represent the data for each such entity, and will defn a "ma

Re: Auto reloading of dependencies with cider

2014-06-23 Thread Mark P
Thanks Michael. With a bit of updating and configuring I seem to have this working For the benefit of other readers of this thread... to get C-c C-x to work, it seems you still need to configure things properly for tools.namespace... see the links in Ralf's post above for details on this. Al

Re: Auto reloading of dependencies with cider

2014-06-23 Thread Mark P
Thanks Ralf. This looks like exactly what I need. On Monday, June 23, 2014 2:43:41 PM UTC+9:30, Ralf Schmitt wrote: > > Mark P > writes: > > > What do other people generally do here? I suspect there is a > commandline > > way of getting lein to do this for me. Is

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Mark P
> > Okay. Functions as values. Go look at the IFn interface, > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java. > > Thanks for the link - this helps! When the clojure compiler generates a class type that conforms to this interface, does it generate a .java file

Auto reloading of dependencies with cider

2014-06-22 Thread Mark P
I am fairly new to using cider. Initially I put all my code into my core.clj file that lein created for me. But now I am splitting my file up into multiple clj files and using things like: (ns myprog.core (:use [myprog.milk :as milkx :only []]) (:use [myprog.cheese.brie :as briex :only [br

Re: Understanding when compilation occurs - for function producing functions

2014-06-21 Thread Mark P
> > A toy project I've worked intermittently on makes heavy use of *partial* > to dynamically build complex functions. I wish that *partial* was smart > enough to recompile its first argument, maybe taking advantage of whatever > type inference the compiler can make, but partial >

Re: Understanding when compilation occurs - for function producing functions

2014-06-21 Thread Mark P
> > > What's the reason for asking? If you aim for making efficient code (that > is running very many times in tight loops), I think most of this will be > inlined by the JIT, as long as it is not confused by side effects and other > things. I'm asking mostly because I want to better understa

Re: Understanding when compilation occurs - for function producing functions

2014-06-21 Thread Mark P
> > >> ​Well, you misunderstand it, as far as I know, clojure treat all fn as > object, so in your adder-maker example, clojure compiled two fn as object, > that's adder-maker itself and anonymous function it returns. > You must be right. As far as I know, the compiler is only called as part

Understanding when compilation occurs - for function producing functions

2014-06-19 Thread Mark P
Suppose at my REPL I do... (defn direct-report-oneplustwo [] (println (str "Direct one plus two is " ((fn [n] (+ 1 n)) 2) "."))) ...then I presume that the compiler has compiled my direct-report-oneplustwo function, and that this has included compilation of my anonymous function (fn [n] (+ 1 n

Re: fn and let are special forms or macros?

2014-06-18 Thread Mark P
Wonderful - thanks Andy! On Thursday, June 19, 2014 12:40:24 PM UTC+9:30, Andy Fingerhut wrote: > > user=> (source special-symbol?) > (defn special-symbol? > "Returns true if s names a special form" > {:added "1.0" >:static true} > [s] > (contains? (. clojure.lang.Compiler specials)

Re: fn and let are special forms or macros?

2014-06-18 Thread Mark P
nesday, June 18, 2014 6:26:04 PM UTC+9:30, Ambrose Bonnaire-Sergeant wrote: > > Hi Mark, > > Here's a brief doc on special forms: > http://clojure-doc.org/articles/language/macros.html#special-forms-in-detail > > Thanks, > Ambrose > > > On Wed, Jun 18, 2014 at

Re: fn and let are special forms or macros?

2014-06-17 Thread Mark P
Thanks Tassilo for the explanation - much appreciated! I have been searching the web and searching clojure text books for the last two hours trying to find the answer to this same question. Finally I stumbled onto this thread! I realize that hiding the complexity of distinctions between fn / f

Future of performant software: cores or memory?

2014-01-01 Thread Mark P
is it possible to improve memory performance (eg reduce cache misses) within Clojure? Thanks, Mark P. -- -- 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

Re: Funding Clojure 2010

2009-12-14 Thread Mark P
> This strikes me as a potentially disastrous idea; look at how much > mindshare going the proprietary route has cost Rebol, for instance. I don't know anything about Rebol except for some quick googling that I've just done on them. But the impression I get is that what they've done is substantia

Re: Funding Clojure 2010

2009-12-14 Thread Mark P
me wrong, I think the voluntary donation model is the best one - if it works - and so is worth a shot. But if it doesn't work out, I offer this alternative model as one that might be worth considering. Cheers, Mark P. -- You received this message because you are subscribed to the Google Groups

Re: when performance matters

2009-01-13 Thread Mark P
y includes the clojure compiler. Why would this be included if compilation (including macros) is never performed at runtime? Is there something fundamental I am not understanding? Thanks, Mark P. --~--~-~--~~~---~--~~ You received this message because you are su

Re: when performance matters

2009-01-13 Thread Mark P
machines. The single core machines have SBCL as 2.2 or 2.3 times slower than C++. Perhaps this is a truer representation of SBCL's "raw capabilities". But a 120% performance hit is still quite a whack. Cheers, Mark P. --~--~-~--~~~---~--~~ You receiv

Re: when performance matters

2009-01-13 Thread Mark P
. I have no doubt that Clojure   > could take the role of OCaml there. Of course, writing such an   > optimizing library requires a significant effort. Thanks for the example. It's good to know what is possible. Cheers, Mark P. --~--~-~--~~~---~--~~ You r

Re: when performance matters

2009-01-12 Thread Mark P
landscape as I can beforehand. Thanks for tempering any over-enthusiasm and giving me your best honest assessment. Cheers, Mark P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gr

Re: when performance matters

2009-01-12 Thread Mark P
> JNA might be an alternative to JNI:https://jna.dev.java.net/ > But I wouldn't know; haven't used either. Thanks for this info. It sounds like JNA may be worth looking into. Cheers, Mark. --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: when performance matters

2009-01-12 Thread Mark P
a practical option or not. Maybe it is. Thanks Konrad for your thoughts. Most useful. Cheers, Mark P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

when performance matters

2009-01-11 Thread Mark P
w realistic are my three "hopes"? And are there any other performance enhancing possibilities that I have not taken into account? Thanks, Mark P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Re: update in place for unique references

2009-01-09 Thread Mark P
iency of update-in-place. But as I've discovered through this thread, the limitations of the JVM might make this "sweet spot" somewhat smaller than I would have liked. Cheers, Mark P. --~--~-~--~~~---~--~~ You received this message because you are s

Re: update in place for unique references

2009-01-09 Thread Mark P
queness in a lisp language should be much more elegant than my C++ implementation. But I think you and Mark Fredrickson are right to point out that limitations within the JVM itself may make efficiency via uniqueness that is competative with C/C++, impossible to achieve. I'm still hopeful

Re: update in place for unique references

2009-01-08 Thread Mark P
ially) would be to only provide uniqueness interfaces to some of Java's main structures. Perhaps not as general as would be ideal, but would easily allow repurposing via a method. Thanks again for your input. Cheers, Mark P. --~--~-~--~~~---~--~~ You receiv

Re: update in place for unique references

2009-01-08 Thread Mark P
d and it could lead to even more efficient (both time and memory) code from Clojure, while not sacrificing its strengths. I'm just wondering whether anyone has thought about it. And if so, whether it has potential, or whether there are good reasons why

update in place for unique references

2009-01-07 Thread Mark P
I am new to clojure, but it seems very interesting. Has anyone thought about allowing "update in place" for situations where it is safe? Suppose you have (def y (tripleit x)) and you know that there is only a single reference to x at this point, then it would be safe to implement it as "y