Re: non recursive impl in presence of persistence?

2009-01-11 Thread John
(lazy-cons h1 (lazy-merge (rest seq1) seq2)) (lazy-cons h2 (lazy-merge seq1 (rest seq2))) (defn merge-sort [seq] (if (> (count seq) 1) (apply lazy-merge (map merge-sort (split-at (/ (count seq) 2) seq))) seq)) - John On Jan 10, 9:

Re: Leiningen in Python

2009-12-19 Thread John
or (index 4).) I have tried many guesses (I am not familiar with python (V2.6)). Can anyone make some suggestions? Regards, John. On Dec 12, 10:31 pm, Rob Wolfe wrote: > Mike K writes: > > All, > > > I tried to use this script on Windows and it blew up real good!  I'

Re: Leiningen in Python

2009-12-20 Thread John
oes 'lein.py new' E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py new Wrong number of arguments to task new. E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py version Leiningen nil on Java 1.6.0_18-ea Java HotSpot(TM) Client VM This seems to be a different issue (poss

Re: Leiningen in Python

2009-12-21 Thread John
\Leiningen\lein.py deps E:\etc\clojure\Leiningen\lein.py compile E:\etc\clojure\Leiningen\lein.py jar E:\etc\clojure\Leiningen\lein.py uberjar :: WARNING: Not 'java -jar helloworld.jar'. D'oh! java -jar helloworld-standalone.jar Thanks for your time with this. Regards, John. On Dec 2

Re: (- x 1) and (dec x) behave differently

2010-04-20 Thread John
Yup, you're definitely right Daniel. Everyone's comment on the subject was very helpful and gave us all insight into the internals of Clojure. I guess the key points to learn in our case is: 1- Clojure supports primitives, but only when you ask for them (by casting) 2- Clojure cannot unbox the box

Re: (- x 1) and (dec x) behave differently

2010-04-20 Thread John
> Clojure could of course auto-unbox on recur to primitive local, but it   > doesn't, for a reason. If you are using primitive locals it is because   > you are looking for the speed of primitive operations That's the answer I was looking for. It is just confusing because it is mentioned everyw

TransactionalHashMap hash computation bug

2010-04-24 Thread John
Hi all, I think I found my first bug in Clojure. It's in the TransactionalHashMap computation of the "bin" at line 30. return h % bins.length; should be replaced by return (h & 0x7FFF) % bins.length; to avoid array out of bound exceptions. -- You received this message because you are sub

Re: TransactionalHashMap hash computation bug

2010-04-25 Thread John
I got no response since I posted the previous message. Should I be posting bugs to assembla space instead of here ? Do I need to be a member to do that ? On Apr 24, 7:38 pm, John wrote: > Hi all, > > I think I found my first bug in Clojure. It's in the > TransactionalHashMap c

Is it good functional style to use a protocol to create a plugin point?

2013-06-05 Thread john
akes it clear this protocol is a plugin point for custom implementations. I don't know?! Am I just complaining about perfect readable side effect free code? Many Greetings John -- -- You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: Is it good functional style to use a protocol to create a plugin point?

2013-06-05 Thread john
ke: > > (defn calc-multiply [data] ...) > (defn calc-add [data] ...) > (defn make-calc [] {:calc-add #'calc-add, :calc-multiply #'calc-multiply}) > > Looks simpler and cleaner for me. > > On Wed, Jun 5, 2013 at 12:16 PM, john > > wrote: > > Hi, &

What is a "state monad binding plan" (referring to code in core.async)

2013-07-26 Thread john
ering what makes the macro a "state monad" and how does it simplify the building of the state-machine data structure? Many Greetings John -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: What is a "state monad binding plan" (referring to code in core.async)

2013-07-26 Thread john
yes your explanations help me a lot! thank you for replying so quickly! I will try to work myself through your code as you suggest. Many thanks! Am Freitag, 26. Juli 2013 16:51:54 UTC+2 schrieb john: > > Hi, > I am trying to understand the code in > ioc_macros.clj<https://git

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread john
license (maybe with a 2 year upgrade possibility) Many Greetings John Am Samstag, 27. Juli 2013 13:54:58 UTC+2 schrieb Colin Fleming: > > Hi all, > > I was planning to wait a little longer before going public, but since it's > pretty relevant to the other IntelliJ thread go

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread john
Hi, a couple of weeks a ago I invested 1.5 days in trying to use sublime text 2. I loved the simple navigation features with that I could switch to different clojure files. And at first I really thought it looked promising. But then as I started to work seriously it would very often crash or f

I am wondering if there is a better way to validate and read-in clojure data?

2016-03-11 Thread john
rintln "read-in Error:" (.getMessage e) " token: " %1 " token-pos" %2 ))) (str/split the-str #"@@@") (range 10 - Code --- Is there a mo

When using gradle with the clojuresque plugin I'm getting a"Plugin with id 'clojure' not found." error

2013-01-25 Thread john
th one clojure and 2 groovy projects: When I run gradle build I get the error : Plugin with id 'clojure' not found. I have guess my build.gradle is faulty. Can somebody help? Many Greetings John -- -- You received this message because you are subscribed to the Google Groups &q

Re: ANN: babbage 1.0.0, a library for easily gathering data and computing summary measures in a declarative way

2013-02-02 Thread john
I would be very interested to learn which kind of practical problems these engines can solve? Any real-world examples would help me understand the benefit of this approach. Many greetings John Am Samstag, 2. Februar 2013 07:44:25 UTC+1 schrieb AtKaaZ: > > seems a bit similar to

Why is there not much conversation on Spreadsheet like APIs in this group?

2013-02-03 Thread john
Greetings John -- -- 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

Re: Why is there not much conversation on Spreadsheet like APIs in this group?

2013-02-03 Thread john
Sonntag, 3. Februar 2013 18:47:12 UTC+1 schrieb Stephen Compall: > > On Feb 3, 2013 4:40 AM, "john" > wrote: > > seems to me very cool for systems that need to react on changes on > dependent values. I very much like the API in (1) > > > > Actually my personal op

Re: Why is there not much conversation on Spreadsheet like APIs in this group?

2013-02-04 Thread john
>As a related point, if you are thinking of "spreadsheet" in the sense of a multi-dimensional grid, then you should definitely be looking at core.matrix anyway - it is shaping up to be the defacto standard for managing multi->dimensional array data structures in Clojure I meant "spreadsheet" in

ClojureScript source maps

2011-07-24 Thread John
Is there any interest in having ClojureScript generate source maps? http://code.google.com/p/closure-compiler/wiki/SourceMaps There are a couple of ways to accomplish this. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Extending core.logic (Datomic example)

2012-05-20 Thread john
please forgive me if I am wrong because I know so little about clojure,logic and datomic But you are using (d/datoms (db conn) :eavt) which seems to give you a sequence over all datoms of a database. In a large database this sequence would not fit in memory. So wouldn't it be better if you s

Re: Issues with installing clojure-mode on Mac in Emacs

2012-05-28 Thread john
Hi Sam, I just tried "Emacs live". I'm running MAC OSX and emacs in a Terminal with the Option "use option as Meta" I have a German Keyboard Layout so I added this to init.el: (global-set-key "\M-4" '(lambda () (interactive) (insert "\\"))) (global-set-key "\M-5" '(lambda () (interactive) (ins

Re: Issues with installing clojure-mode on Mac in Emacs

2012-05-28 Thread john
HI Sam, just wondering what does https://github.com/aim-stuff/cmd-key-happy buy you since xterm2 allows you two switch cmd-key to alt-key? many greetings John On Monday, May 28, 2012 2:46:15 PM UTC+2, Sam Aaron wrote: > > Hi John, > > first of all, you probably should create y

Advice needed on primitive longs and trying to avoid autoboxing

2012-07-12 Thread john
Hello, I would like to avoid when possible the promotion from a primitve long to an Long Object. I have the following code: http://pastie.org/4242382 and am not sure if (Long) autoboxing is taking here place. In lines 24,28-30 I use "assoc" to replace a long in a defrecord. Since "assoc

Meaning of :inline in meta

2012-07-12 Thread john
line and maybe nary-inline many greetings john -- 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

How-to construct for example (.value record) with a macro

2012-07-16 Thread john
and-1 '(inline-first-method)) ;yields (. value aRecord) which does not work. I know I could use (keyword (first methods)) but for performance reasons I want to use the . operator on the record Many Greetings John -- You received this message because you are subscribed to the Google Group

Re: How-to construct for example (.value record) with a macro

2012-07-16 Thread john
Thanks very much for the help ...even when it comes from Cologne (-: -- 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

how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
b)) but I wold like it to be : (defn aFun [^long b] (clojure.core/meta b)) Many greetings John -- 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 member

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
;b {:tag long})) '(meta b))) before (aFun 8) yields nil So I think the type hint are not on the param Am Mittwoch, 18. Juli 2012 14:18:21 UTC+2 schrieb Ambrose Bonnaire-Sergeant: > Hi John, > > The type hint ^long expands to ^{:tag long}. > > So something like this should do

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
pand-1 '(aTest))] (meta b)) you should see {:tag long}. > > On Wednesday, July 18, 2012 7:55:31 AM UTC-4, john wrote: >> >> Hello, >> how do I get primitive typ hints to appear in the output of a macro? >> >> like : >> (defmacro aTest [] >

A "ClojureScript One" Question: Why is so much html created on the client side.

2012-08-10 Thread john
is Granger and Brento Ashworth to be web experts I would just like to know the disadvantages of having most html rendered on the server? Many Greetings John -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: A "ClojureScript One" Question: Why is so much html created on the client side.

2012-08-11 Thread john
't mind waiting a second or two for new content on main "context switches". So maybe I can use a hybrid approach. I just am a little afraid of depending too much on cljs . Not because of the language but I still think that the server is so much more predictable than the browser. M

Re: A bearded person, Clojure and JavaFX

2012-12-06 Thread john
/open-dolphin/blob/master/subprojects/demo-javafx/client/src/main/groovy/com/canoo/dolphin/demo/CrudView.groovy lines 47 . 85 . I think that GUI code in Groovy may even be more funky than in clojure. Many Greetings form a bold headed programmer John Am Donnerstag, 6. Dezember 2012 10:19:06

How was the skills matters conference in London (6. Dec)?

2012-12-07 Thread john
Hi, I couldn't make it to the skill matters conference in London ))-: just being curious,... how was it? Any news? was there a main theme? Many Greetings John -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: How was the skills matters conference in London (6. Dec)?

2012-12-07 Thread john
exchange-2012 > > Have a look. > > Thomas > > On Friday, December 7, 2012 10:59:32 AM UTC, john wrote: >> >> Hi, >> I couldn't make it to the skill matters conference in London ))-: >> just being curious,... how was it? Any news? was there a main the

Re: STM - a request for "war stories"

2012-12-12 Thread john
So is the bottom line: STM Should have not been added to clojure ( because it is not pratical) Many Grettings John -- 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

Re: beginner question

2011-09-24 Thread John
To break down the update into multiple steps use the -> macro: =>(defn step [world-state]) (-> world-state update-health update-physics update-ai)) where e.g. update-health is something like =>(defn update-health [world-state] (update-in world-state [:player :

Concurrency performance expectations

2011-01-08 Thread John
I am hoping to determine what are reasonable expectations for performance after parallelizing an application, especially when using clojure's reference types. I'm aware of Amdahl's law (http:// en.wikipedia.org/wiki/Amdahl's_law) but I'm still getting disappointing performance scaling in the number

Re: First foray into profiling

2011-01-09 Thread John
Hm I've used JVisualVM before but not in cojunction with lein swank. On my machine it appears to start two clojure.main processes both on the client jvm, and referencing the clojure 1.2 jar despite having one of the 1.3 versions in project.clj. Hrm.. On Jan 9, 6:15 am, Mark Engelberg wrote: > I'm

for collection, take consecutive pairs incrementing by one

2008-08-25 Thread John
For each element, get element and next element (incrementing index by one, not two), operate on the two, returning a new collection. There's the brute force method, but I'm wondering if map or for or any of their ilk can pull pairs at a time out of a collection, moving across the collection one el

Re: for collection, take consecutive pairs incrementing by one

2008-08-26 Thread John
Perfect! Thanks On Aug 25, 9:22 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Aug 25, 9:16 pm, John <[EMAIL PROTECTED]> wrote: > > > For each element, get element and next element (incrementing index by > > one, not two), operate on the two, returning a new col

Re: executing shell command

2008-08-26 Thread John
I did this: (import '(java.io BufferedReader InputStreamReader)) (defn cmd [p] (.. Runtime getRuntime (exec (str p (defn cmdout [o] (let [r (BufferedReader. (.InputStreamReader. (.getInputStream o)))] (dorun (map println (line-seq r) Then: (cmdout (cm

Re: GUIs in Clojure

2008-10-10 Thread John
Allegedly gnome-java is threadsafe, but it only works on Linux, unfortunately. http://research.operationaldynamics.com/blogs/andrew/software/java-gnome/ On Oct 10, 5:20 pm, "Ande Turner" <[EMAIL PROTECTED]> wrote: > Apologies Colin...  I'll just say I was a victim of Trolltech marketing, > that

Re: POLL: Domain name for project hosting site.

2008-11-17 Thread John
+1 Clojury -oryNoun: place for, serves for Sounds best to me. On Nov 17, 5:23 pm, Dave Newton <[EMAIL PROTECTED]> wrote: > --- On Mon, 11/17/08, Drew Crampsie wrote: > > >  - projecture > > Nice, because Clojure "sticks out" beyond Java/JVM, besides the other obvious > meanings > > >  - pr

Re: In core structure editor, anyone?

2008-12-10 Thread John Newman
Some Noobian critique: Thread-local bindings also allow us to monkey-patch for the span of a local > context. Say we have a function *cat* which calls a function stored in a > Var; if a function *goat* is root-bound to the Var, then *cat* will > normally call *goat*; however, if we call *cat* in a

Re: literate snake

2009-01-02 Thread John Newman
mally placed. Feedback still welcomed! Can I / should I further > reduce the number of defs I have? > > -- > R. Mark Volkmann > Object Computing, Inc. > > > > -- John --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Questions about a Clojure Datalog

2009-02-04 Thread John Fries
AFAICT, Datalog only supports the closed-world assumption. Does anyone prefer an open-world assumption reasoner? In my opinion, they are significantly more powerful. On Feb 4, 6:16 am, Timothy Pratley wrote: > > providing relations from clojure-sets and sql-queries. > > Wow - this is really ne

Re: Questions about a Clojure Datalog

2009-02-04 Thread John Fries
> I expect to provide full-on evaluable predicates, which I believe are > outside of the original Datalog scope, but I will still require the > "safe query" rules for those. > > On Feb 4, 12:41 pm, John Fries wrote: > > AFAICT, Datalog only supports the closed-world

Re: Questions about a Clojure Datalog

2009-02-05 Thread John Fries
d to support an audience whose primary language was Java, the user must express their queries using a Java class-based syntax. But this seems like a perfect use of Clojure, which could provide a much more natural query syntax. On Thu, Feb 5, 2009 at 4:29 AM, Rich Hickey wrote: > > >

Re: Questions about a Clojure Datalog

2009-02-07 Thread John Fries
s. I hope it is relevant, and apologize for the length. -John Initially, I had a lot of trouble understanding why the concept of satisfiability was relevant to reasoning. I just wanted to know whether or not a sentence was true; whether or not it was satisfiable didn't seem relevant. Here

Re: Questions about a Clojure Datalog

2009-02-08 Thread John Fries
27;ve appended a long rant about SAT-based reasoners and open-world semantics. I hope it is relevant, and apologize for the length. -John Initially, I had a lot of trouble understanding why the concept of satisfiability was relevant to reasoning. I just wanted to know whether or not a sentence was

Re: Questions about a Clojure Datalog

2009-02-09 Thread John Fries
. On Mon, Feb 9, 2009 at 4:34 AM, Rich Hickey wrote: > > > > On Feb 7, 2:25 pm, John Fries wrote: > > I agree with Jeffrey that there is no reason to have just one option. > > I never suggested there ought to be only one option, nor am I trying > to argue against the ut

Re: [Discuss] Contribs with dependencies

2009-04-15 Thread John Newman
in the JDK. >> > >> > Obviously, without care and rules it could get crazy quickly, and I >> > want to avoid the kitchen-sink effect. It is very important that >> > things remain [truly, not just apparently] simple. >> > >> > Looking for suggestions, >

Re: The Path to 1.0

2009-04-17 Thread John Newman
> and when to incur it. > > > > - Perception > > > > Obviously, a 1.0 designation impacts perception. I am not interested > > in pursuing it just to influence perception, but rather to > > (collectively) acknowledge a milestone in usability and stability. > &

Re: The Path to 1.0

2009-04-18 Thread John Newman
Well, perhaps if str-utils becomes the universal standard for string operations, it would be rolled into Clojure come 2.0? On Sat, Apr 18, 2009 at 2:58 PM, Konrad Hinsen wrote: > > On 18.04.2009, at 12:15, John Newman wrote: > > > 2) One way to maintain Clojure's flexibility

Re: The Path to 1.0

2009-04-18 Thread John Newman
> I do not agree with John Newman that the Java standard library > should be the Clojure standard library. > I'm not saying that. I'm saying that: 1) Requiring Java's standard library on every system is unfortunate enough -- it's too big for some of the smaller de

Re: What is Contrib?

2009-05-13 Thread John Newman
dure. I think an > officially labelled and maintained standard library is important, but > there could well be a collection of independent (and differently > licenced) libraries on top of that. > > Konrad. > > > > > -- John --~--~-~--~~~---~--~

Re: Clojure at JavaOne

2009-05-18 Thread John Newman
ro- > > Clojure, not anti- anything else. > > > > The audience is Java developers, many of whom will have never seen > > Clojure or any Lisp. > > > > I'd appreciate some suggestions *and help* preparing demos for the > > Script Bowl. What (that c

Re: 3d viewer

2009-05-20 Thread John Newman
Including import statements at the top would make it easier for me to try it out. Thanks, On Wed, May 20, 2009 at 4:09 AM, kyle smith wrote: > > I have uploaded 3d-viewer.clj to the files section. If anyone finds > it useful, I would appreciate some feedback. > &g

Re: 3d viewer

2009-05-20 Thread John Newman
r. Left click and drag to rotate, and > use the scroll wheel to zoom in/out. > > > -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Clojure at JavaOne

2009-05-21 Thread John Newman
iginating in some XML off the > web, being passed to some filtering/walking code, getting displayed, > stored in a DB, all without specific DOM/model/recordset APIs, a > couple of lines for each task. This demonstrating the difference of > not being OO - using generic abstract data types l

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread John Newman
e cleary than eclojure). Looks like an interesting >> candidate to me. >> > > Since I'm quite uncapable of finding good names > I simply rip-off one I already have: > > EclipseClojure ;) > > Sincerely > Meikel > > -- John --~--~-~--~~---

Newbie Question on re-split

2009-06-24 Thread John Carnell
rt of the code examples from Stu Halloway's book. Thanks, John --~--~-~--~~~---~--~~ 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 Not

Re: ants.clj and render thread starvation

2009-06-30 Thread John Newman
with the sleep times in such a way as to increase the > > probability of the renderer actually completing a snapshot, but this > > process felt hacky and ad-hoc. What works on my netbook might well be > > sub-optimal on another system. > > > > How could one change the desi

Mysterious ClassFormatError after simple code change.

2009-07-05 Thread John Harrop
I had this: (defn- subexpressions-of-sum** [[n p] terms] (let-print [sum (cons '+ (map #(factor-term % n p) terms)) prod (rest (make-product* n p))] (concat [sum] (subexpressions-of-product (cons sum prod) in a source file with other definitions. Load-file worked. I then change

Re: ants.clj and render thread starvation

2009-07-05 Thread John Newman
ve tried this with a build of > a1397390d8b3b63f2039359520629d87b152d717 (July 4), I tried > :min-history values of 2 and 9, which didn't help, meaning the window > stayed blank because the rendering agent does not run to completion. I > was able to get something to display by dial

Re: Mysterious ClassFormatError after simple code change.

2009-07-05 Thread John Harrop
something that large from a number being changed. This is frankly quite baffling. The changes to the function are innocent from a large-literal or pretty much any other perspective. On 7/5/09, Stephen C. Gilardi wrote: > On Jul 5, 2009, at 2:01 AM, John Harrop wrote: > >> and got: &g

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 8:53 AM, Chouser wrote: > > On Sun, Jul 5, 2009 at 3:51 PM, John Harrop wrote: > > > > This is frankly quite baffling. The changes to the function are > > innocent from a large-literal or pretty much any other perspective. > > Both your func

Re: Is this unquote dangerous?

2009-07-06 Thread John Harrop
> > Or if you really do need a list: > > (for [x [1 2 3]] (cons 'some-symbol (list x))) > Why not (for [x [1 2 3]] (list 'some-symbol x)) ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 3:58 PM, Emeka wrote: > (defn- subexpressions-of-sum** [[n p] terms] > (let-print [sum (cons '+ (map #(factor-term % n p) terms)) >prod (rest (make-product* n p))] >(cons sum > (map #(cons '* (cons sum (rest %))) >(concat prod (subexpressions-of-p

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman wrote: > > > Since it's not apparently a simple bug in my function above, but > > something about a combination of that version of that function and > > some other part of my code, I can't think of a way to track the > > cause down short of the very

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Mon, Jul 6, 2009 at 11:25 PM, John Harrop wrote: > On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman wrote: > >> Have you tried simpler things like splitting the offending function >> into a separate namespace, or seeing what happens with (or without) >> AOT compila

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Tue, Jul 7, 2009 at 9:30 AM, Stephen C. Gilardi wrote: > > On Jul 7, 2009, at 5:51 AM, John Harrop wrote: > > Somehow, code that is treated as valid when compiled a function at a time >> is treated as invalid when compiled all at once. That pretty much proves >> it

Passing primitives from an inner loop to an outer loop efficiently

2009-07-07 Thread John Harrop
Problem: Passing primitives from an inner loop to an outer loop efficiently. Here is what I've found. The fastest method of result batching, amazingly, is to pass out a list and: (let [foo (loop ... ) x (double (first foo)) r1 (rest foo) y (double (first r1)) r2 (rest r1) z (double (first r2))] .

Re: Passing primitives from an inner loop to an outer loop efficiently

2009-07-08 Thread John Harrop
On Wed, Jul 8, 2009 at 3:42 AM, Frantisek Sodomka wrote: > > If result is a vector v, then from these 4 cases: > (let [v [1 2 3]] > (let [[a b c] v] a b c) > (let [a (v 0) b (v 1) c (v 2)] a b c) > (let [a (nth v 0) b (nth v 1) c (nth v 2)] a b c) > (let [x (first v) r1 (rest v) y (first r1) r

Re: Save current namespace like a Smalltalk image

2009-07-08 Thread John Harrop
On Wed, Jul 8, 2009 at 5:14 AM, Robert Campbell wrote: > > Thanks Daniel, that makes perfect sense, especially about having > random - and forgotten - code in the image. I have a lot of this > during my exploration sessions. Perhaps instead of saving an image, it should be able to save a transc

Re: Homoiconicity and printing functions

2009-07-08 Thread John Harrop
On Wed, Jul 8, 2009 at 9:11 AM, Mike wrote: > One of the things that drew me to Clojure was the fact that it's > homoiconic (and my previous lisp [Scheme] was not necessarily), which > means code is data, macro writing is easy etc. etc. > > What I'm missing is why I can't print a function. I und

Re: Passing primitives from an inner loop to an outer loop efficiently

2009-07-08 Thread John Harrop
Interesting. How are these timings affected if you add in the time taken to pack the list or vector in the first place, though? I have the feeling it may be slightly cheaper to unpack a vector, but noticeably cheaper to pack a list... --~--~-~--~~~---~--~~ You recei

Re: Help with example from "A Field Guide to Genetic Programming"

2009-07-08 Thread John Harrop
On Wed, Jul 8, 2009 at 1:57 PM, Robert Campbell wrote: > If it's okay, could somebody explain the difference between what's > happening here: > > user> (def my-func (list + 1 2)) > #'user/my-func > user> (my-func) > ; Evaluation aborted. > > and here: > > user> (def my-func (list + 1 2)) > #'user

Re: Passing primitives from an inner loop to an outer loop efficiently

2009-07-08 Thread John Harrop
On Wed, Jul 8, 2009 at 4:57 PM, Frantisek Sodomka wrote: > > So far it seems that vectors win in Clojure: > > (timings 3e5 > (let [v (vector 1 2 3) a (nth v 0) b (nth v 1) c (nth v 2)] (+ a b > c)) > (let [lst (list 1 2 3) a (nth lst 0) b (nth lst 1) c (nth lst 2)] (+ > a b c))) > > => > 680.63

Re: Clojure in Clojure?

2009-07-09 Thread John Harrop
On Thu, Jul 9, 2009 at 11:10 AM, tmountain wrote: > > I just finished watching the Bay Area Clojure Meetup video, and Rich > spent a few minutes talking about the possibility of Clojure in > Clojure. The prospect of having Clojure self-hosted is incredibly > cool, but it brought a few questions t

Re: Best way to create nonref variable?

2009-07-10 Thread John Harrop
On Thu, Jul 9, 2009 at 10:29 PM, J. McConnell wrote: > You can try with-local-vars. I'm not sure of the performance > characteristics of this versus using an atom, but it certainly feels > more imperative: It's slow. I suspect it (and binding) uses Java's ThreadLocal, which is slow. Loop/recur

*math-context*

2009-07-10 Thread John Harrop
It would be useful to have a *math-context* or similar that had a sensible default and could be set with binding to affect bigdec calculations within the temporal scope of said binding. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: *math-context*

2009-07-10 Thread John Harrop
On Fri, Jul 10, 2009 at 9:22 AM, Rich Hickey wrote: > On Jul 10, 9:01 am, Chouser wrote: > > On Fri, Jul 10, 2009 at 7:14 AM, John Harrop > wrote: > > > It would be useful to have a *math-context* or similar that had a > sensible > > > default and could be

ArithmeticException with doubles

2009-07-10 Thread John Harrop
This is odd: user=> (/ 1.0 0.0) # Shouldn't it be Double/POSITIVE_INFINITY? --~--~-~--~~~---~--~~ 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 post

Re: Compilation troubles...

2009-07-13 Thread John Harrop
On Mon, Jul 13, 2009 at 3:11 PM, Morgan Allen wrote: > It's a shame about the lack of official support for java-side > invocation- the bulk of my code is still implemented in java (largely > for efficiency reasons), so it would be handy to be able to initiate > things largely from that side. It

Re: Performance question (newbie)

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 11:39 AM, B Smith-Mannschott wrote: > An explicit loop with some type hints is faster, though likely not as > fast as Java: > > (defn sum-of-range-4 [range-limit] > (loop [i (int 1) s (long 0)] >(if (< i range-limit) > (recur (inc i) (+ s i)) > s))) > > This

Re: EY map reduce contest

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 4:53 AM, hosia...@gmail.com wrote: > > > http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/ > > Has anyone got access to hundreds of thousands of machines that I > could borrow for 30 hours ? ;) Don't know any botnet herders; sorry. :)

Re: Clojure vectors

2009-07-15 Thread John Harrop
On Wed, Jul 15, 2009 at 12:58 PM, Mark Engelberg wrote: > > It looks like stack-rot is going to be the bottleneck in your app > since it requires traversing the whole vector to build the new one, > but I think the list-based implementation would be a bit worse, so I > think your choice to use vecto

Re: How to achieve indirection?

2009-07-16 Thread John Harrop
On Thu, Jul 16, 2009 at 11:34 AM, Dragan wrote: > Thanks for the tip, I meant something else. > Let's say that I want to write a function do-something. There could be > 2 implementations: do-something-quickly and do-something-elegantly. > The parameters are the same and there are no differences i

Re: Very minor problem in the REPL

2009-07-17 Thread John Harrop
On Fri, Jul 17, 2009 at 11:31 AM, Stephen C. Gilardi wrote: > It looks like somehow you're seeing a very old REPL or it's not the default > REPL you get from launching Clojure via clojure.main. > I can confirm the described behavior for the enclojure REPL. --~--~-~--~~~--

Re: Is there a standard function testing if a sequence starts with a sequence

2009-07-17 Thread John Harrop
On Fri, Jul 17, 2009 at 4:41 PM, Mark Engelberg wrote: > > On Fri, Jul 17, 2009 at 1:32 PM, samppi wrote: > > > > Is there a function in clojure.core or clojure.contrib so that: > > (and (mystery-fn '(a b c d) '(a b)) > >(not (mystery-fn '(a b c d) '(a b d > > > how about something li

Re: "let" a variable number of bindings

2009-07-18 Thread John Harrop
On Fri, Jul 17, 2009 at 11:52 PM, Rowdy Rednose wrote: > > How can I lexically bind names like "let" does in a macro, when names > and values for those bindings are passed in? > > This here works fine when I pass a literal collection: > > (defmacro let-coll > [coll & body] > `(let ~(vec coll) ~.

Re: "let" a variable number of bindings

2009-07-18 Thread John Harrop
On Sat, Jul 18, 2009 at 1:22 AM, Meikel Brandmeyer wrote: > Using eval is not really a solution. > > (def foo '[a 1 b 2]) > (let-coll foo ...) > > will probably work with eval, but > > (let [foo '[a 1 b 2]] > (let-coll foo ...)) > > will not. > No, for that you need to make the "macro" run-time

Re: Simple data structure access macro

2009-07-21 Thread John Harrop
On Mon, Jul 20, 2009 at 4:31 PM, Moses wrote: > > I come primarily from a perl programming background, but am trying > to learn Clojure. > > I'm looking for a clojure equivalent to the following. > > Perl: > > my $nestedDS = [ "foo", { hi => there, hello => ["buddy"] }, "hi"] > > my $foo =

Re: Confusion with apply.

2009-07-22 Thread John Harrop
On Wed, Jul 22, 2009 at 5:17 PM, mmwaikar wrote: > So if this is the intended behavior of apply, which function should I > use in this case? Is there anything in Clojure where I can apply any > user-defined function to each and every element of a list one-by-one? Use map: user=> (map #(* 5 %)

Re: How to write performant functions in clojure (and other functional languages)

2009-07-26 Thread John Harrop
On Sat, Jul 25, 2009 at 4:40 PM, atucker wrote: > > I wonder if any of the Clojurians on here might like to describe how > one might write the factorial function as a parallel one? Taking > advantage of the associativity of multiplication, along the lines of > > 16! = (((1*2)*(3*4)) * ((5*6)*(7*

Website down?

2009-07-27 Thread John Newman
I've been trying to get to Clojure.org <http://clojure.org> for a few days now and I can't get to it from my military network, nor my civilian satellite connection (I'm deployed). I can't ping it though (resolves to 75.126.104.177). Is anyone else having t

Re: Website down?

2009-07-27 Thread John Newman
Yea, false alarm. I guess my network at work is just jacked up. On Mon, Jul 27, 2009 at 2:21 PM, Glen Stampoultzis wrote: > Seems to be up. > http://downforeveryoneorjustme.com/clojure.org > <http://downforeveryoneorjustme.com/clojure.org> > > 2009/7/27 John Newman >

  1   2   3   4   5   6   7   8   9   10   >