Re: [ANN] Grimoire: up to date Clojure web docs

2014-07-12 Thread Reid McKenzie
While I appreciate the interest, I think that attempting to officiate Grimoire is a bad move. We already have clojure.org. clojure.org is the only official site. Grimoire is not condoned by Rich. Using #clo?j.*\.org would detract from any future documentation effort Rich and co. may make and

Why does the first expression take much longer

2014-07-12 Thread Cecil Westerhof
I do the following (with range-length 1e8): (time (let [[t d] (split-with #( % 12) (range range-length))] [(count d) (count t)])) (time (let [[t d] (split-with #( % 12) (range range-length))] (into [] (reverse [(count t) (count d)] ​This gives:

Re: [ANN] Clojure cheatsheet variants with links to Grimoire

2014-07-12 Thread Colin Fleming
Please, please, no harsh words about what people besides yourself ought to do. I hope my comments the other day didn't come across as harsh - if so, I apologise, it certainly wasn't my intention. I greatly appreciate the effort that goes into developing these sites in people's spare time. I'm

Re: Land of lisp to Clojure

2014-07-12 Thread Cecil Westerhof
2014-07-09 5:11 GMT+02:00 Timothy Baldridge tbaldri...@gmail.com: Prefer vectors over quoted lists '(1 2) vs [1 2]. There's rarely a case (outside of macros) that you want the former. ​I did this mostly. The exception is: (def nodes { :living-room ['(You are in the living-room.)

Re: Why does the first expression take much longer

2014-07-12 Thread James Reeves
The JVM optimises sections of code that are frequently executed, so the second expression benefits from the optimisation that happens during the first expression. My guess is that if you were to swap the two expressions around, you'd find that the first expression always takes longer, no matter

Re: Why does the first expression take much longer

2014-07-12 Thread Cecil Westerhof
2014-07-12 11:56 GMT+02:00 James Reeves ja...@booleanknot.com: The JVM optimises sections of code that are frequently executed, so the second expression benefits from the optimisation that happens during the first expression. My guess is that if you were to swap the two expressions around,

Re: ANN: Om, a ClojureScript binding to Facebook's React

2014-07-12 Thread Alexander Semenov
Hi, David. May I ask you - in Om you queue rendering in requestAnimationFrame by passing a function which calls forceUpdate on the affected components. But as I understand forceUpdate does not guarantee to execute immediately and is also queued. So, the rendering should be out of sync with

Re: Why does the first expression take much longer

2014-07-12 Thread James Reeves
You're right; now that I look more closely, there is a difference between the two expressions. The split-with function is literally a combination of take-while and drop-while, like so: (defn split-with [pred coll] [(take-while pred coll) (drop-while pred coll)]) This is important because it

import functions from different .clj files

2014-07-12 Thread sorin cristea
Hi all, I have file fileB.clj (ns a.b.c) (defn inc-sample [no] (+ no 1)) and file fileA.clj (ns a.b.c.d (:require [a.b.c.fileB :as fB])) (defn method-a [] (println number incremented (fB/inc-sample 2)) ) in fileA.clj I'm not able to see the functions from fileB.clj even

import functions from different .clj files

2014-07-12 Thread Mike Fikes
Normally, the initial elements of the namespace are used to create directories and the last element matches the filename. So, for your first example, there would be an a/b/c.clj file. Perhaps this is at the root of the issue. -- You received this message because you are subscribed to the

import functions from different .clj files

2014-07-12 Thread Mike Fikes
And alternatively you could declare the first namespace as being a.b.c.fileB -- 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

Re: import functions from different .clj files

2014-07-12 Thread sorin cristea
I want to do something like when you import a file from a clojure package, for example the case of jdbc, you wrote* (:require [clojure.java.jdbc :as sql])* than you call functions from clojure jdbc with statement (sql/fc-name..) but seams that this not working in case you have two .clj

Re: import functions from different .clj files

2014-07-12 Thread Mike Fikes
I think the root cause is that you need to follow the directory name and filename conventions. For example clojure.java.jdbc is in a clojure/java/jdbc.clj file https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj -- You received this message because

Humble request/challenge to Clojure Geeks

2014-07-12 Thread Jabari Zakiya
Hi All, Well, I've developed this prime sieve algorithm, which is available to read and download from the link below: The Segmented Sieve of Zakiya (SSoZ). http://www.scribd.com/doc/228155369/The-Segmented-Sieve-of-Zakiya-SSoZ I have implemented it in C++, D, et al, and want to see how

Re: [ANN] Grimoire: up to date Clojure web docs

2014-07-12 Thread Tim Gilbert
Well, clojure-grimoire.com is available, FWIW. Tim On Saturday, July 12, 2014 2:46:18 AM UTC-4, Reid McKenzie wrote: While I appreciate the interest, I think that attempting to officiate Grimoire is a bad move. We already have clojure.org. clojure.org is the only official site. Grimoire

Ring mock with GET parameters

2014-07-12 Thread Jonathon McKitrick
I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them. Here is the relevant part of the handler: (GET /outlines [speaker :as r] (println (str Request r))

Re: Ring mock with GET parameters

2014-07-12 Thread James Reeves
You need to make sure your handler has the wrap-params middleware applied to it in order for it to accept query parameters. - James On 12 July 2014 20:41, Jonathon McKitrick jmckitr...@gmail.com wrote: I'm using ring.mock.request to test an API. POST parameters work fine, but for GET

Re: Ring mock with GET parameters

2014-07-12 Thread Jonathon McKitrick
Hmm, except I don't have any issues when accessing it via an http client. Only with the mock. On Saturday, July 12, 2014 6:24:28 PM UTC-4, James Reeves wrote: You need to make sure your handler has the wrap-params middleware applied to it in order for it to accept query parameters. -

Re: Ring mock with GET parameters

2014-07-12 Thread Jonathon McKitrick
Here's my handler setup: (def app (routes (- (handler/api api-routes) (wrap-params) (wrap-restful-format) (wrap-reload)) (- (handler/site www-routes) (wrap-resource public) (wrap-content-type) (wrap-reload On Saturday, July 12, 2014 7:42:53

Re: Ring mock with GET parameters

2014-07-12 Thread Jonathon McKitrick
Sorry, I just got it... I needed to use 'app' in the test, not 'api-routes.' On Saturday, July 12, 2014 7:42:53 PM UTC-4, Jonathon McKitrick wrote: Hmm, except I don't have any issues when accessing it via an http client. Only with the mock. On Saturday, July 12, 2014 6:24:28 PM UTC-4,

Re: An Averaging function

2014-07-12 Thread Stephen Feyrer
Hi, Just to let you guys know I am paying attention and am trying to get all my ducks in order. I will definitely check out the resources you've mentioned. Thank you. On 11 July 2014 08:11, Adrian Mowat adrian.mo...@gmail.com wrote: Hi Blake Brian Marick's book on FP for OO programmers is

core.async and memoize

2014-07-12 Thread Yehonathan Sharvit
I'd like to use memoize for a function that uses core.async ! e.g *(defn foo [x] (go (! (timeout 2000)) (* 2 x)))* (In a real-life, it could be useful in order to cache the results of server calls) I was able to achieve that by writing a core.async version of memoize (almost the same