Re: ring streaming efficiency

2014-04-23 Thread James Reeves
Signed S3 URLs do expire, but you can set the expiry date far in the
future, or you could generate the URLs on the fly and add them to a
temporary redirect.

My understanding is that you can also upload to S3 using temporary URLs,
but I haven't tried it.

In any case, I'd advise implementing it with blocking I/O first, ensuring
you have plenty of threads, then run some benchmarks to see how your
application performs.

- James


On 23 April 2014 05:25, Andrew Chambers  wrote:

> I need access control for the static files. The alternative is signed s3
> urls which expire. Uploads still require streaming through ring however as
> i cant generate signed upload urls with the parameters that I need.
>
>
> On Wednesday, April 23, 2014 3:27:09 PM UTC+12, James Reeves wrote:
>
>> Java input streams are blocking, rather than asynchronous, so yes it
>> would use a thread per stream.
>>
>> In theory an asynchronous solution would be more efficient, and there are
>> adapters, like http-kit, that support this optimisation.
>>
>> However, in practice, Java can handle many threads in a single process,
>> so it's unlikely you'll run into difficulties until you have to support
>> 1000s of concurrent downloads. It's often a good idea to avoid premature
>> optimisations, particularly if you lack concrete benchmarks.
>>
>> It also depends a lot on how you're generating the downloads. If you're
>> generating the files dynamically, you may find that your bottleneck is
>> CPU-bound, rather than I/O-bound; in which case, there would be little
>> benefit to going async. If you're just serving static files, then it might
>> be useful hosting your files on a service like S3, and redirecting your
>> users instead.
>>
>> - James
>>
>>
>> On 23 April 2014 04:03, Andrew Chambers  wrote:
>>
>>> When you set the body of a ring response to a java input stream and
>>> return it, is this still a thread per stream? or does it use some sort of
>>> java event loop for efficiency?
>>> I'm worried that a traffic download/upload server in ring wouldn't
>>> handle many concurrent large file uploads and downloads as efficiently as
>>> something like google go or nodejs would.
>>> I would like to use ring because I want Datomic to manage the access
>>> permissions.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Phillip Lord

Cite the URL. It's the correct identifier, it's got the relevant data on
it, and it's archived in archive.org.

If the journal editor or other academic tells you that you need a
"proper" academic reference, just ignore them, because they are wrong.

Phil

 writes:

> For the purposes of academic publications (in areas well outside of SIGPLAN 
> and such), are there any preferred citations for Clojure and EDN? Or could 
> a recommendation for a citation for both (especially EDN) be proposed if 
> there isn't one currently?

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben
Hello, 

I do not understand why this work.

I have to check if someone is between 12 and 20 years.

So after some trail and error this seems to work

(defn teen? [age]
  (if (< 12 age 20)
  true;
  false))

Is it right it stated 12 < age <  20 ?

Roelof

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread James Reeves
(< a b c) is equivalent to (and (< a b) (< b c)), so yes, (< 12 age 20) is
the same as 12 < age < 20.

You could write your function more concisely as:

(defn teen? [age]
  (< 12 age 20))

The "if" statement is unnecessary.

- James


On 23 April 2014 11:11, Roelof Wobben  wrote:

> Hello,
>
> I do not understand why this work.
>
> I have to check if someone is between 12 and 20 years.
>
> So after some trail and error this seems to work
>
> (defn teen? [age]
>   (if (< 12 age 20)
>   true;
>   false))
>
> Is it right it stated 12 < age <  20 ?
>
> Roelof
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben
Thanks, 

But something is not going right.

When delete the if as you said and have this : 

(defn boolean [x]
  (or (false? x)(nil? x))
  false;
  true)

(defn abs [x]
  (< x 0)
(* x -1);
x)

(defn teen? [age]
  (< 12 age 20)
  true;
  false)

Then all tests fail and if I put a if before it , they all work well. 

Roelof

Op woensdag 23 april 2014 12:19:01 UTC+2 schreef James Reeves:

> (< a b c) is equivalent to (and (< a b) (< b c)), so yes, (< 12 age 20) is 
> the same as 12 < age < 20.
>
> You could write your function more concisely as:
>
> (defn teen? [age]
>   (< 12 age 20))
>
> The "if" statement is unnecessary.
>
> - James
>
>
> On 23 April 2014 11:11, Roelof Wobben >wrote:
>
>> Hello, 
>>
>> I do not understand why this work.
>>
>> I have to check if someone is between 12 and 20 years.
>>
>> So after some trail and error this seems to work
>>
>> (defn teen? [age]
>>   (if (< 12 age 20)
>>   true;
>>   false))
>>
>> Is it right it stated 12 < age <  20 ?
>>
>> Roelof
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Dave Della Costa
What James meant was that you should use it like so:

=> (defn teen? [age] (< 12 age 20))
#'user/teen?
=> (teen? 50)
false
=> (teen? 10)
false
=> (teen? 14)
true
=> (if (teen? 14) "yes is a teen" "no, not a teen")
"yes is a teen"

You don't need to set up these wrappers returning true and false.  nil
and false are false in Clojure, everything else is true.  Remember that
and you'll be good to go.

DD

(2014/04/23 19:45), Roelof Wobben wrote:
> Thanks,
> 
> But something is not going right.
> 
> When delete the if as you said and have this :
> 
> (defn boolean [x]
>   (or (false? x)(nil? x))
>   false;
>   true)
> 
> (defn abs [x]
>   (< x 0)
> (* x -1);
> x)
> 
> (defn teen? [age]
>   (< 12 age 20)
>   true;
>   false)
> 
> Then all tests fail and if I put a if before it , they all work well.
> 
> Roelof
> 
> Op woensdag 23 april 2014 12:19:01 UTC+2 schreef James Reeves:
> 
> (< a b c) is equivalent to (and (< a b) (< b c)), so yes, (< 12 age
> 20) is the same as 12 < age < 20.
> 
> You could write your function more concisely as:
> 
> (defn teen? [age]
>   (< 12 age 20))
> 
> The "if" statement is unnecessary.
> 
> - James
> 
> 
> On 23 April 2014 11:11, Roelof Wobben  > wrote:
> 
> Hello,
> 
> I do not understand why this work.
> 
> I have to check if someone is between 12 and 20 years.
> 
> So after some trail and error this seems to work
> 
> (defn teen? [age]
>   (if (< 12 age 20)
>   true;
>   false))
> 
> Is it right it stated 12 < age <  20 ?
> 
> Roelof
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> 
> Note that posts from new members are moderated - please be
> patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> 
> ---
> You received this message because you are subscribed to the
> Google Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to clojure+u...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout
> .
> 
> 
> -- 
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben


Op woensdag 23 april 2014 13:23:17 UTC+2 schreef David Della Costa:
>
> What James meant was that you should use it like so: 
>
> => (defn teen? [age] (< 12 age 20)) 
> #'user/teen? 
> => (teen? 50) 
> false 
> => (teen? 10) 
> false 
> => (teen? 14) 
> true 
> => (if (teen? 14) "yes is a teen" "no, not a teen") 
> "yes is a teen" 
>
> You don't need to set up these wrappers returning true and false.  nil 
> and false are false in Clojure, everything else is true.  Remember that 
> and you'll be good to go. 
>
> DD 



Thanks, 

The only thing which is failing now is this one ; 

(defn abs [x]
  (< x 0)
(* x -1);
x)

I keep getting -2 as answer where it must be 2 

Roelof
 

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem in loop (for loop) with Cascalog results

2014-04-23 Thread sindhu hosamane
Hello friends , 
i want to get results using cascalog queries .I need to get data between 2 
timestamps datefrom and dateto  as shown below in code . I have a problem 
in loop , where i cannot update the timestamp value .
I am using clojure cli-time .

(ns Recallnack.core

 (:use [cascalog.api]

[cascalog.more-taps :only (hfs-delimited)])

 (:require [clj-time.core :as t])

(:require [clj-time.format :as f])

 (:require [cascalog.ops :as c])

 (:gen-class))


 (def info

  (hfs-delimited  
"/Volumes/SindhuHosamane/Master_thesis_docs/burner_changed.txt"

   :delimiter ";"

   :outfields ["?timestamp" "?assembly" "?sensor" 
"?value"]

   :classes[String String String Float]

   :skip-header? false))


(def info-tap

  (<- [?timestamp ?value]

  ((select-fields info ["?timestamp" "?value"]) ?timestamp ?value)))


(def datefrom "12:05:2010 00:00:00")

 (def dateto "12:05:2010 01:01:00")


(def custom-formatter (f/formatter "dd:MM: HH:mm:ss"))

(def hour-part (t/hour (f/parse custom-formatter datefrom)))

(def minute-part(t/minute (f/parse custom-formatter datefrom)))


(loop [hour-part 01]

  (when (>= minute-part 00)

(?<- (stdout) [?timestamp-out ?value-out]

  (info-tap  ?timestamp ?value) (c/limit [1] ?timestamp ?value :>?timestamp-out 
?value-out
)

 )

 (recur (+  minute-part 01

where am i wrong in the loop ? Any advice!!

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread kurofune
I'm about halfway through all of them, and find the back and forth to actually 
be helpful. First and foremost though, i recommend you go through the "clojure 
koans" video series on YouTube and get started with 4clojure.com (subsequent, 
difficult problems will become easier for you as you progress). After that, I 
would say dive into JOC because you are not a beginner and can google things 
you don't understand. Once the Clojure in Action 2nd edition comes out that is 
certainly worth reading for practical, in depth tutorials on topics ranging 
from web services to data analysis and finite state machines. Clojure 
programming (Oreilly) is a more intellectual approach, very good for 
understanding the inner-workings of the language. Also, there are some really 
amusing blogs out there: Clojure for the brave and true and Clojure from the 
ground up, to name those I found most helpful. Once you learn the basics, you 
will find yourself engaging a lot of really amazing libraries. Welcome to the 
party!

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Marc Limotte
Roelof,

Your abs definition doesn't have an (if), so those statements are just
executed in order, and the last one 'x' is the return value for the whole
thing.

Probably what you want is:
(defn abs [x] (if (pos? x) x (- x)))

user=> (abs -2)
2
user=> (abs 2)
2
user=> (abs 0)
0

marc



On Wed, Apr 23, 2014 at 7:48 AM, Roelof Wobben  wrote:

>
>
> Op woensdag 23 april 2014 13:23:17 UTC+2 schreef David Della Costa:
>
>> What James meant was that you should use it like so:
>>
>> => (defn teen? [age] (< 12 age 20))
>> #'user/teen?
>> => (teen? 50)
>> false
>> => (teen? 10)
>> false
>> => (teen? 14)
>> true
>> => (if (teen? 14) "yes is a teen" "no, not a teen")
>> "yes is a teen"
>>
>> You don't need to set up these wrappers returning true and false.  nil
>> and false are false in Clojure, everything else is true.  Remember that
>> and you'll be good to go.
>>
>> DD
>
>
>
> Thanks,
>
> The only thing which is failing now is this one ;
>
> (defn abs [x]
>   (< x 0)
> (* x -1);
> x)
>
> I keep getting -2 as answer where it must be 2
>
> Roelof
>
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben  writes:

> The only thing which is failing now is this one ; 
>
> (defn abs [x]
>   (< x 0)
> (* x -1);
> x)
>
> I keep getting -2 as answer where it must be 2 

Well, the function contains three forms where the results of the first
two are ignored and only the value of the last one is returned.  So here
you need an `if`.

  (defn abs [x]
(if (< x 0)
  (* x -1)
  x))

Bye,
Tassilo

BTW: Why do you have those semicolons in your code?  That ends a
statement in C-like languages but in Lisps including Clojure it starts a
comment spanning till the end of the line.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread Daniel Higginbotham
"Clojure Programming" was the most useful to me when I started with Clojure 
(I already had a bit of Lisp experience). Kyle Kingsbury has an online 
series going, "Clojure from the Ground Up" 
(http://aphyr.com/tags/Clojure-from-the-ground-up). I'm writing a book as 
well, "Clojure for the Brave and True" (http://www.braveclojure.com/). I 
hope this helps!

On Tuesday, April 22, 2014 2:18:09 PM UTC-4, Cecil Westerhof wrote:
>
> I have a ‘little’ to learn. ;-) I have worked with a lot of languages, 
> including Lisp. I was thinking about the following books (in that order):
> - Practical Clojure
> - Clojure in Action
> - The Joy of Clojure
> - Clojure Programming
> - Programming Clojure
>
> Someone told me it was better to start with Programming Clojure and after 
> that The Joy of Clojure. Any idea's about this?
>
> -- 
> Cecil Westerhof 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben


Op woensdag 23 april 2014 14:26:14 UTC+2 schreef Tassilo Horn:
>
> Roelof Wobben > writes: 
>
> > The only thing which is failing now is this one ; 
> > 
> > (defn abs [x] 
> >   (< x 0) 
> > (* x -1); 
> > x) 
> > 
> > I keep getting -2 as answer where it must be 2 
>
> Well, the function contains three forms where the results of the first 
> two are ignored and only the value of the last one is returned.  So here 
> you need an `if`. 
>
>   (defn abs [x] 
> (if (< x 0) 
>   (* x -1) 
>   x)) 
>
> Bye, 
> Tassilo 
>
> BTW: Why do you have those semicolons in your code?  That ends a 
> statement in C-like languages but in Lisps including Clojure it starts a 
> comment spanning till the end of the line. 
>


oke, 
So if I understand everything well when I want true or false I do not need 
a if . In all other cases I need a if.
Regarding the ; I thought I was a divider between the then and the else 

Roelof 

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bug in clojure.algo.monads prevents you from using :require :as ns declaration

2014-04-23 Thread Rick Moynihan
Hi all,

I think I've found a minor bug in clojure.algo.monads.

If you do the following:

(ns foo.bar
  (:require [clojure.algo.monads :as mon]))

You cannot use mon/m-lift (and possibly others) as m-lift expands like so:

user> (macroexpand '(mon/m-lift 1 prn))
(fn* ([mv_4553] (m-bind mv_4553 (fn [x_4554] (m-result (prn x_4554))

Note that m-bind is not fully qualified which results in errors like this:

CompilerException java.lang.RuntimeException: Unable to resolve symbol:
m-bind in this context,
compiling:(/private/var/folders/6j/vpfh3hk97mq82r9nmq7d2h0hgn/T/form-init2703504198066353121.clj:1:1)


The github page for clojure.algo.monads does not mention how to post bug
requests.  I'm assuming as it's a contrib project it's done through
Clojure's JIRA.

Can anyone offer some guidance?

Thanks.

R.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben
Chips I thought I understand it 
But this does not work 

(defn divides? [divisor n]
  (mod n divisor))

I still get a cannot be cast error message.

Roelof


Op woensdag 23 april 2014 14:32:41 UTC+2 schreef Roelof Wobben:

>
>
> Op woensdag 23 april 2014 14:26:14 UTC+2 schreef Tassilo Horn:
>>
>> Roelof Wobben  writes: 
>>
>> > The only thing which is failing now is this one ; 
>> > 
>> > (defn abs [x] 
>> >   (< x 0) 
>> > (* x -1); 
>> > x) 
>> > 
>> > I keep getting -2 as answer where it must be 2 
>>
>> Well, the function contains three forms where the results of the first 
>> two are ignored and only the value of the last one is returned.  So here 
>> you need an `if`. 
>>
>>   (defn abs [x] 
>> (if (< x 0) 
>>   (* x -1) 
>>   x)) 
>>
>> Bye, 
>> Tassilo 
>>
>> BTW: Why do you have those semicolons in your code?  That ends a 
>> statement in C-like languages but in Lisps including Clojure it starts a 
>> comment spanning till the end of the line. 
>>
>
>
> oke, 
> So if I understand everything well when I want true or false I do not need 
> a if . In all other cases I need a if.
> Regarding the ; I thought I was a divider between the then and the else 
>
> Roelof 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Gary Verhaegen
It looks like you overgeneralized a bit. In Clojure, you should almost
always replace (if expr true false) with just expr. However, it only
applies when the last two elements are true and false in that order.

(if expr1 expr2 expr3), as you had for abs, may not usually be simplified
in that way.

On Wednesday, 23 April 2014, Roelof Wobben  wrote:

>
>
> Op woensdag 23 april 2014 14:26:14 UTC+2 schreef Tassilo Horn:
>>
>> Roelof Wobben  writes:
>>
>> > The only thing which is failing now is this one ;
>> >
>> > (defn abs [x]
>> >   (< x 0)
>> > (* x -1);
>> > x)
>> >
>> > I keep getting -2 as answer where it must be 2
>>
>> Well, the function contains three forms where the results of the first
>> two are ignored and only the value of the last one is returned.  So here
>> you need an `if`.
>>
>>   (defn abs [x]
>> (if (< x 0)
>>   (* x -1)
>>   x))
>>
>> Bye,
>> Tassilo
>>
>> BTW: Why do you have those semicolons in your code?  That ends a
>> statement in C-like languages but in Lisps including Clojure it starts a
>> comment spanning till the end of the line.
>>
>
>
> oke,
> So if I understand everything well when I want true or false I do not need
> a if . In all other cases I need a if.
> Regarding the ; I thought I was a divider between the then and the else
>
> Roelof
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> clojure+unsubscr...@googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben  writes:

> So if I understand everything well when I want true or false I do not
> need a if.

No, when the last form of your function already returns true or false,
e.g., (< 12 age 20), then you don't need to wrap that in an `if` which
checks if the result is true to return true, or return false otherwise.

I mean, in a Java/C/Pascal/whatever-like language, you also wouldn't
write

  boolean teen(age) {
if (age > 12 && age < 20) {
  return true;
} else {
  return false;
}
  }

but simply

  boolean teen(age) {
return age > 12 && age < 20;
  }

because the <, >, and && operators already result in booleans, right?

> In all other cases I need a if.

You always need an `if` if the value you want to return is not identical
with the value of the test expression.

> Regarding the ; I thought I was a divider between the then and the
> else

Lisps have no need for syntactical irregularities like that.

Bye,
Tassilo

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Tassilo Horn
Roelof Wobben  writes:

> Chips I thought I understand it 
> But this does not work 
>
> (defn divides? [divisor n]
>   (mod n divisor))

It seems that `divides?` should be a predicate but your definition
returns a number and no boolean.  A number n is divisible by some
divisor if the result of `mod` is zero.  That is, you want

 (defn divides? [divisor n]
   (zero? (mod n divisor)))

Bye,
Tassilo

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben


Op woensdag 23 april 2014 14:55:39 UTC+2 schreef Tassilo Horn:
>
> Roelof Wobben > writes: 
>
> > Chips I thought I understand it 
> > But this does not work 
> > 
> > (defn divides? [divisor n] 
> >   (mod n divisor)) 
>
> It seems that `divides?` should be a predicate but your definition 
> returns a number and no boolean.  A number n is divisible by some 
> divisor if the result of `mod` is zero.  That is, you want 
>
>  (defn divides? [divisor n] 
>(zero? (mod n divisor))) 
>
> Bye, 
> Tassilo 
>


Thanks, 

Now hopefully I can figure out how to output a boolean.

Roelof
 

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] data.avl 0.0.12 -- sorted collections with slice, nth, transient support

2014-04-23 Thread Michał Marczyk
Hi,

I am pleased to announce the 0.0.12 release of data.avl, a Clojure
Contrib library providing drop-in replacements for Clojure(Script)'s
built-in sorted maps and sets with additional functionality:

 1. real (non-view) logarithmic-time slicing and splits;

 2. logarithmic-time nearest neighbour lookups and rank queries;

 3. support for transients.

This release is identical to 0.0.12-alpha1 except for the fact that
the Vars clojure.data.avl/empty-{set,map}-hash{eq,code} are now marked
private, as they should be.

Changes since 0.0.11 include an important fix to the rebalancing
algorithm, so I would strongly advise all users of 0.0.11 to upgrade
as soon as possible. There are also several new additions to the API,
on which more below.

  [org.clojure/data.avl "0.0.12"]

  
org.clojure
data.avl
0.0.12
  

  org.clojure:data.avl:0.0.12

The following transcript of a REPL session includes calls to each of
the new public functions:

  (require '[clojure.data.avl :as avl])

  (avl/nearest (avl/sorted-set 0 1 2) < 2)
  ;= 1

  (avl/subrange (avl/sorted-set 0 1 2 3 4 5) >= 1 < 4)
  ;= #{1 2 3}

  (avl/split-at 2 (avl/sorted-set 0 1 2 3 4 5))
  ;= [#{0 1} #{2 3 4 5}]

  (avl/split-key 3 (avl/sorted-set 0 2 4 6))
  ;= [#{0 2} nil #{4 6}]

All of these functions operate in time logarithmic in the size of
their inputs. avl/subrange returns a data.avl collection of the same
type as its input and completely independent from it -- that is, it
shares structure with the input where possible, but does not hold on
to any parts of the tree containing keys that should not be present in
the output. avl/split-at and avl/split-key return similarly
independent data.avl collections; the middle element of the vector
returned by split-key is the element at the split key if present in
the input, nil otherwise.

"split" is the name usually applied in the literature to the operation
that splits a tree into a "left" tree, a middle element and a "right"
tree. "subrange" could also be called "slice". The split-* functions
take their collection argument last to be consistent with
clojure.core's split-at and split-with. Arguments accepted by subrange
are analogous to those taken by subseq/rsubseq.

Many thanks to the two new contributors to this release (listed here
in chronological order of ticket creation): Pepijn de Vos, who
prompted me to develop the above-mentioned new features by creating
the ticket asking for what is now avl/nearest and mentioning
java.util.Navigable{Map,Set}, and who provided new tests for
avl/nearest; and Andy Fingerhut, who kept on top of the hashing
changes and provided the initial implementation of new-style hasheq
for data.avl with further tests.

Cheers,
Michał

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread Stefan Kamphausen
Would German be an option for you?

Just curious

stefan

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Roelof Wobben
found the solution:

(defn divides? [divisor n] 
   (zero? (mod n divisor))) 

Roelof


Op woensdag 23 april 2014 14:59:31 UTC+2 schreef Roelof Wobben:

>
>
> Op woensdag 23 april 2014 14:55:39 UTC+2 schreef Tassilo Horn:
>>
>> Roelof Wobben  writes: 
>>
>> > Chips I thought I understand it 
>> > But this does not work 
>> > 
>> > (defn divides? [divisor n] 
>> >   (mod n divisor)) 
>>
>> It seems that `divides?` should be a predicate but your definition 
>> returns a number and no boolean.  A number n is divisible by some 
>> divisor if the result of `mod` is zero.  That is, you want 
>>
>>  (defn divides? [divisor n] 
>>(zero? (mod n divisor))) 
>>
>> Bye, 
>> Tassilo 
>>
>
>
> Thanks, 
>
> Now hopefully I can figure out how to output a boolean.
>
> Roelof
>  
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why can I not parse the command line arguments in this way

2014-04-23 Thread Atamert Ölçgen
On Tue, Apr 22, 2014 at 2:57 PM, Aaron France wrote:

> One hates to be rude but:
>
> I've read all your questions over the past couple of weeks and it seems it
> would behoove you to pick up a book. There are plenty of recommendations on
> Google and archived threads.
>
Stackoverflow is also good. I usually get my questions answered within a
day.



> Good day.
> On 22 Apr 2014 16:48, "Cecil Westerhof"  wrote:
>
>> Obvious not very neat, but I tried as a first hack to do something with
>> the command line parameters with:
>> (doseq [type args]
>>
>> ​This does not work. Why not?
>> ​
>>
>> --
>> Cecil Westerhof
>>
>> --
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Kind Regards,
Atamert Ölçgen

-+-
--+
+++

www.muhuk.com

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Bug in clojure.algo.monads prevents you from using :require :as ns declaration

2014-04-23 Thread Andrey Antukh
Hi Rick

As far as I know, m-lift and similar functions should be used in monad
context (using with-monad macro).

Greetings.
Andrey


2014-04-23 14:41 GMT+02:00 Rick Moynihan :

> Hi all,
>
> I think I've found a minor bug in clojure.algo.monads.
>
> If you do the following:
>
> (ns foo.bar
>   (:require [clojure.algo.monads :as mon]))
>
> You cannot use mon/m-lift (and possibly others) as m-lift expands like so:
>
> user> (macroexpand '(mon/m-lift 1 prn))
> (fn* ([mv_4553] (m-bind mv_4553 (fn [x_4554] (m-result (prn x_4554))
>
> Note that m-bind is not fully qualified which results in errors like this:
>
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> m-bind in this context,
> compiling:(/private/var/folders/6j/vpfh3hk97mq82r9nmq7d2h0hgn/T/form-init2703504198066353121.clj:1:1)
>
>
> The github page for clojure.algo.monads does not mention how to post bug
> requests.  I'm assuming as it's a contrib project it's done through
> Clojure's JIRA.
>
> Can anyone offer some guidance?
>
> Thanks.
>
> R.
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrey Antukh - Андрей Антух -  / 
http://www.niwi.be 
https://github.com/niwibe

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Helmsman: Not another routing library?!

2014-04-23 Thread Jonathan Doane
Hello everyone,

I've been working on a library for VLACS called Helmsman. It's designed to 
let you construct and compose your web application while having an emphasis 
on navigation and relative URI generation so you can use the data you use 
to define your routes to also generate your URIs. I also have had a very 
good discussion the other day with some people on the #immutant channel on 
irc.freenode.net and the general consensus was that relative URIs are the 
best for the client because regardless of host name, or proxy, or anything 
that happens between the server and the client, a browser will always be 
able to figure out a relative URI from the location that you're already at. 
With that said, I created Helmsman with all of that in mind. I do 
understand that there are a number of routing libraries out there already, 
but I think the goal I'm trying to reach is a unique one and I hope I'm 
going down the right path to solve it, even more so since we (VLACS) are 
planning on constructing one web app out of various smaller apps and 
Helmsman will help facilitate that as well (among other libraries for 
templating and such.)

With that said, Helmsman lives on GitHub and 
on 
Clojars , so anyone can use it, the 
way it should be. I would appreciate any input on what I have so far. My 
hope is that someone here asks a question that I haven't asked myself yet 
so I don't have any gaping functionality holes that a developer would 
realistically need. Anyways, I'm interested in hearing what everyone has to 
say about it weather it's changes to the code, the README, the example app, 
anything.

Cheers,
Jon

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: comparison with 3 arguments. Do I understand it right ?

2014-04-23 Thread Xu Hui Hui
You should get familiar with the "syntax" of "if", comment and other basic
things in Clojure:

(defn boolean [x]
  (if (or (false? x) (nil? x))
  false
  true))
;; this is a comment
;; you should use Clojure's built-in "boolean" instead of define your own

(defn abs [x]
  (if (< x 0)
(- x)
x))
;; you could use Math/abs instead

(defn teen? [age]
  (< 12 age 20))
;; here the "if" **form** is not needed, not the "if" symbol/macro

2014-04-23 18:45 GMT+08:00 Roelof Wobben :

> (defn boolean [x]
>   (or (false? x)(nil? x))
>   false;
>   true)
>
> (defn abs [x]
>   (< x 0)
> (* x -1);
> x)
>
> (defn teen? [age]
>   (< 12 age 20)
>   true;
>   false)
>




Regards,
Xu Hui Hui

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: browser lisp editor

2014-04-23 Thread Evan Rowley
I have one more suggestion that a friend of mine made to me. I was able to
run it but not actually use it due to a firewall issue. There is also a
dependency on Datomic, which can complicate things for a beginner. Despite
that drawback, this browser-based coding environment does have some cool
features. Think of it as a REPL on steroids.

The project is called Session and here are some links for it:
https://medium.com/p/1a12997a5f70
https://github.com/kovasb/session



On Tue, Apr 22, 2014 at 7:37 PM, Brian Craft  wrote:

> Thanks everyone, this is very helpful.
>
>
> On Tuesday, April 22, 2014 6:53:45 AM UTC-7, Jony Hudson wrote:
>>
>> Codemirror is good too for this.
>>
>> http://codemirror.net
>>
>>
>> Jony
>>
>>
>> On Tuesday, 22 April 2014 05:30:23 UTC+1, Brian Craft wrote:
>>>
>>> Slightly off topic.
>>>
>>> Anyone know of a simple browser-based lisp editor that can be embedded
>>> in a page? Indenting & matching parens would be sufficient. I don't need
>>> evaluation.
>>>
>>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
 - EJR

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What's clojure killer app? I don't see any.

2014-04-23 Thread doug smith


> i am a language hobbyist with absolutely no formal training. i have an 
> idea for a killer app. 
>
what i envision includes:
-pedestal om session datomic type framework for teaching clojure  while it 
analyzes  YOUR learning process.
-an entry point that assumes no prior knowledge -but could be grown to an 
expert level
-is VERY fun and VERY entertaining

this could be a 'bridge'  to learning without 'complexity'

i'm ready to help




   

 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure Office Hours

2014-04-23 Thread Gustavo Matias
This is awesome guys, I really love the initiative some people of the 
Clojure community are taking. I just booked my first session.

On Wednesday, April 23, 2014 1:10:02 AM UTC-4, Cecil Westerhof wrote:
>
> 2014-04-18 11:35 GMT+02:00 Ulises >:
>
>> Inspired by Leif's offer, I've decided to offer Clojure office hours as 
>> well.
>>
>> I'm based in the UK so I reckon the times will be more amenable to those 
>> in Europe (not sure the times will be good for those in Asia unfortunately.)
>>
>> Sadly the offer is limited to 1h a day, but hopefully it'll still be 
>> useful.
>>
>> You can book me at https://ucb.youcanbook.me/
>>
>
> ​I had a session with Ulises yesterday. I found it very useful. I 
> recommend everyone who wants to start programming in Clojure to do a 
> session with a more experienced person: it gets your blood streaming. :-D​
>  
>
> -- 
> Cecil Westerhof 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojurescript: getting the value out of go-block

2014-04-23 Thread Dmitry Suzdalev
Hello!

I was interested in trying to wrap some callback-hellish JS async 
functionality into something that would look (and work) like a sync call. 
I thought that it could be some kind of function which internally uses 
core.async but does not expose this.

That is instead of having some function with callback on completion

(.findSomething jsLib (fn [res] (println res)))

I would like to have a sync-variant of it, something like this

(defn findSomething []
  "returns res"
  (let [c (chan)]
(go (!< (.findSomething jsLib (fn [res] (put! c res)))

(println (findSomething)) ;; => prints "res" value

It would work if go-macro returned last *value* read from the channel. But 
go macro returns a *channel* that contains the result. So to read it in 
clojurescript I have to ironically wrap go in go again.
Seems like when you started using channels there's no way out of this :)
On JVM I could just use http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Christopher Small

I have never had to cite Clojure, but I have cited other software packages 
that didn't have publications. In general, if there is an actual academic 
publication, it's best to cite that. Frequently there isn't of course, and 
in those cases I've cited the web address.

Cheers

Chris



On Wednesday, April 23, 2014 2:19:29 AM UTC-7, Phillip Lord wrote:
>
>
> Cite the URL. It's the correct identifier, it's got the relevant data on 
> it, and it's archived in archive.org. 
>
> If the journal editor or other academic tells you that you need a 
> "proper" academic reference, just ignore them, because they are wrong. 
>
> Phil 
>
> > writes: 
>
> > For the purposes of academic publications (in areas well outside of 
> SIGPLAN 
> > and such), are there any preferred citations for Clojure and EDN? Or 
> could 
> > a recommendation for a citation for both (especially EDN) be proposed if 
> > there isn't one currently? 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: puzzled by RuntimeException

2014-04-23 Thread Stephen Gilardi
> Just FYI, some background on keywords that start with a number...
> 
> The reader docs (http://clojure.org/reader) states that symbols (and keywords 
> follow symbols in these rules) must "begin with a non-numeric character".


Thanks, Alex. The REPL-y and sjacket issues cited the Clojure issues in Jira 
and I looked through them.

There seems to be an assumption in the discussion I've seen that the current 
description of keywords at http://clojure.org/reader means that the characters 
*after* the leading colon in a keyword have to follow the rules for a symbol.

I think another reasonable way to interpret the description of keywords is that 
the spelling of a keyword *including the leading colon* has to follow the rules 
for a symbol -- with the obvious exception that a symbol's spelling *cannot* 
begin with a colon. Since a colon is always non-numeric, keywords *always* pass 
the "begins with a non-numeric character" test.

When I looked in the past at what it takes to parse a token in Clojure, I 
concluded that the syntax of numbers vs. non-numbers (including the syntax for 
numbers with a radix component) was chosen such that a token represents a 
number if and only if it has a leading numeric character. I've always 
interpreted the "no leading numeric character" rule for the spelling of symbols 
(and keywords, including the leading colon) as in support of that simple 
distinction. More generally, the reader can classify a token by its leading 
character, or leading 2 characters in the case of a leading #.

I don't see a similarly compelling reason to disallow numeric characters 
immediately after the leading colon in a keyword.

--Steve

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread Cecil Westerhof
2014-04-23 15:05 GMT+02:00 Stefan Kamphausen :

> Would German be an option for you?
>

​With what is available, not for me, but maybe for others it would.​

-- 
Cecil Westerhof

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: puzzled by RuntimeException

2014-04-23 Thread Alex Miller


On Wednesday, April 23, 2014 11:24:44 AM UTC-5, squeegee wrote:
>
> > Just FYI, some background on keywords that start with a number... 
> > 
> > The reader docs (http://clojure.org/reader) states that symbols (and 
> keywords follow symbols in these rules) must "begin with a non-numeric 
> character". 
>
>
> Thanks, Alex. The REPL-y and sjacket issues cited the Clojure issues in 
> Jira and I looked through them. 
>
> There seems to be an assumption in the discussion I’ve seen that the 
> current description of keywords at http://clojure.org/reader means that 
> the characters *after* the leading colon in a keyword have to follow the 
> rules for a symbol. 
>

This was not an assumption - Rich told me to interpret the page in this way.
 

> I think another reasonable way to interpret the description of keywords is 
> that the spelling of a keyword *including the leading colon* has to follow 
> the rules for a symbol


— with the obvious exception that a symbol’s spelling *cannot* begin with a 
> colon. Since a colon is always non-numeric, keywords *always* pass the 
> “begins with a non-numeric character” test. 
>
> When I looked in the past at what it takes to parse a token in Clojure, I 
> concluded that the syntax of numbers vs. non-numbers (including the syntax 
> for numbers with a radix component) was chosen such that a token represents 
> a number if and only if it has a leading numeric character. I’ve always 
> interpreted the “no leading numeric character” rule for the spelling of 
> symbols (and keywords, including the leading colon) as in support of that 
> simple distinction. More generally, the reader can classify a token by its 
> leading character, or leading 2 characters in the case of a leading #. 
>

I think you are reasoning from implementation, which may change. The 
http://clojure.org/readers page should be the normative reference. (as much 
as anything in Clojure is normative :) 
 

> I don’t see a similarly compelling reason to disallow numeric characters 
> immediately after the leading colon in a keyword. 
>

There is not any particularly compelling reason which is why we deemed it 
of lesser importance than breaking people's existing programs and reverted 
the change.
 

>
> —Steve 
>
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] data.avl 0.0.12 -- sorted collections with slice, nth, transient support

2014-04-23 Thread Alex Miller
Great work as always!

Are there any places where data.avl performs worse than the built-in sorted 
maps and sets?


On Wednesday, April 23, 2014 7:59:59 AM UTC-5, Michał Marczyk wrote:
>
> Hi, 
>
> I am pleased to announce the 0.0.12 release of data.avl, a Clojure 
> Contrib library providing drop-in replacements for Clojure(Script)'s 
> built-in sorted maps and sets with additional functionality: 
>
>  1. real (non-view) logarithmic-time slicing and splits; 
>
>  2. logarithmic-time nearest neighbour lookups and rank queries; 
>
>  3. support for transients. 
>
> This release is identical to 0.0.12-alpha1 except for the fact that 
> the Vars clojure.data.avl/empty-{set,map}-hash{eq,code} are now marked 
> private, as they should be. 
>
> Changes since 0.0.11 include an important fix to the rebalancing 
> algorithm, so I would strongly advise all users of 0.0.11 to upgrade 
> as soon as possible. There are also several new additions to the API, 
> on which more below. 
>
>   [org.clojure/data.avl "0.0.12"] 
>
>
> org.clojure 
> data.avl 
> 0.0.12 
>
>
>   org.clojure:data.avl:0.0.12 
>
> The following transcript of a REPL session includes calls to each of 
> the new public functions: 
>
>   (require '[clojure.data.avl :as avl]) 
>
>   (avl/nearest (avl/sorted-set 0 1 2) < 2) 
>   ;= 1 
>
>   (avl/subrange (avl/sorted-set 0 1 2 3 4 5) >= 1 < 4) 
>   ;= #{1 2 3} 
>
>   (avl/split-at 2 (avl/sorted-set 0 1 2 3 4 5)) 
>   ;= [#{0 1} #{2 3 4 5}] 
>
>   (avl/split-key 3 (avl/sorted-set 0 2 4 6)) 
>   ;= [#{0 2} nil #{4 6}] 
>
> All of these functions operate in time logarithmic in the size of 
> their inputs. avl/subrange returns a data.avl collection of the same 
> type as its input and completely independent from it -- that is, it 
> shares structure with the input where possible, but does not hold on 
> to any parts of the tree containing keys that should not be present in 
> the output. avl/split-at and avl/split-key return similarly 
> independent data.avl collections; the middle element of the vector 
> returned by split-key is the element at the split key if present in 
> the input, nil otherwise. 
>
> "split" is the name usually applied in the literature to the operation 
> that splits a tree into a "left" tree, a middle element and a "right" 
> tree. "subrange" could also be called "slice". The split-* functions 
> take their collection argument last to be consistent with 
> clojure.core's split-at and split-with. Arguments accepted by subrange 
> are analogous to those taken by subseq/rsubseq. 
>
> Many thanks to the two new contributors to this release (listed here 
> in chronological order of ticket creation): Pepijn de Vos, who 
> prompted me to develop the above-mentioned new features by creating 
> the ticket asking for what is now avl/nearest and mentioning 
> java.util.Navigable{Map,Set}, and who provided new tests for 
> avl/nearest; and Andy Fingerhut, who kept on top of the hashing 
> changes and provided the initial implementation of new-style hasheq 
> for data.avl with further tests. 
>
> Cheers, 
> Michał 
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Phillip Lord

Actually, I am not sure I would agree. For example, there are quite a
few publications on Scala but most of the academic publications are
about something; so, the semantics of it's type system, or the blending
of function and OO or so on. So, which should you cite? Well, you could
pick the language spec, of course, and scala has a very nice one (well,
long anyway, haven't read it). But even this is about the semantics of
the language, and not Scala as in "I used Scala to do this" which is
about the language, the runtime and the tool chain.

The idea that you can't cite websites is a conceit that ensures that
academics continue to spend a 1000s of pounds a paper on puplication
costs, when you can achieve much the same with a blog, some metadata and
archive.org.

Ah, that was good, I feel better now!

Phil



Christopher Small  writes:
> I have never had to cite Clojure, but I have cited other software packages 
> that didn't have publications. In general, if there is an actual academic 
> publication, it's best to cite that. Frequently there isn't of course, and 
> in those cases I've cited the web address.
>
> Cheers
>
> Chris
>
>
>
> On Wednesday, April 23, 2014 2:19:29 AM UTC-7, Phillip Lord wrote:
>>
>>
>> Cite the URL. It's the correct identifier, it's got the relevant data on 
>> it, and it's archived in archive.org. 
>>
>> If the journal editor or other academic tells you that you need a 
>> "proper" academic reference, just ignore them, because they are wrong. 
>>
>> Phil 
>>
>> > writes: 
>>
>> > For the purposes of academic publications (in areas well outside of 
>> SIGPLAN 
>> > and such), are there any preferred citations for Clojure and EDN? Or 
>> could 
>> > a recommendation for a citation for both (especially EDN) be proposed if 
>> > there isn't one currently? 
>>

-- 
Phillip Lord,   Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk
School of Computing Science,
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,   skype: russet_apples
Newcastle University,   twitter: phillord
NE1 7RU 

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Ben Wolfson
On Wed, Apr 23, 2014 at 9:44 AM, Phillip Lord
wrote:

>
> The idea that you can't cite websites is a conceit that ensures that
> academics continue to spend a 1000s of pounds a paper on puplication
> costs, when you can achieve much the same with a blog, some metadata and
> archive.org.
>
> Ah, that was good, I feel better now!
>

The woes of academic publishing have nothing to do with the idea that you
can't cite websites; MLA and Chicago style both have provisions for citing
websites and I'm sure less widespread style guides do as well.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojurescript: getting the value out of go-block

2014-04-23 Thread Timothy Baldridge
What you want is not possible since core.async does not do full program
rewriting, only code within a go is transformed. This is for both
performance and practical reasons.

So yes, wrapping a go in a go may seem a bit pointless, but that's exactly
the semantic that you want, in a single threaded environment like JS VMs it
is also the only possible solution.

If you think about it, the semantics of what you are asking for is not
possible. For how would you pause the execution of the (println) until the
async evaluation of its arguments had completed?

Timothy




On Wed, Apr 23, 2014 at 3:56 AM, Dmitry Suzdalev  wrote:

> Hello!
>
> I was interested in trying to wrap some callback-hellish JS async
> functionality into something that would look (and work) like a sync call.
> I thought that it could be some kind of function which internally uses
> core.async but does not expose this.
>
> That is instead of having some function with callback on completion
>
> (.findSomething jsLib (fn [res] (println res)))
>
> I would like to have a sync-variant of it, something like this
>
> (defn findSomething []
>   "returns res"
>   (let [c (chan)]
> (go (!< (.findSomething jsLib (fn [res] (put! c res)))
>
> (println (findSomething)) ;; => prints "res" value
>
> It would work if go-macro returned last *value* read from the channel. But
> go macro returns a *channel* that contains the result. So to read it in
> clojurescript I have to ironically wrap go in go again.
> Seems like when you started using channels there's no way out of this :)
> On JVM I could just use  ClojureScript.
>
> Wanted some advice/pointers from experienced programmers as I've just
> started and might get something completely wrong :)
> Thanks in advance,
> Dmitry.
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What's clojure killer app? I don't see any.

2014-04-23 Thread Mike Haney
This sounds similar to what the Cognician guys are doing.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread Plínio Balduino
A nice post by Nikola Peric about this subject with what to read and what
to avoid.

http://deltadata.wordpress.com/2014/04/19/learning-clojure-tutorial-books-and-resources-for-beginners/

Plínio


On Wed, Apr 23, 2014 at 1:27 PM, Cecil Westerhof wrote:

> 2014-04-23 15:05 GMT+02:00 Stefan Kamphausen :
>
>> Would German be an option for you?
>>
>
> ​With what is available, not for me, but maybe for others it would.​
>
> --
> Cecil Westerhof
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Christopher Small
I'm not disagreeing with you. When you're talking about a language, and
none of the papers specifically points to the language as a whole - that's
fine. But in the case of specific software packages/programs, I think it is
often better to cite a paper if it exists. For example, if I write a paper
that uses BEAST in an analysis, I'm going to cite the paper for BEAST, not
the BEAST website. But if I cite R, I'll cite the website (as running
`citation()` from the command line suggests I should).

However, I think you're generalizing a bit too strongly when it comes to
academic publications. For example, BEAST2 was published in an Open Access,
online only journal called PLoS (
http://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.1003537).
No paper need apply, and all of the content is CC :-) That's not to say
that PLoS isn't an island of refuge in sea of ossified stodginess, or that
even it couldn't be better in ways. But it's not *all* so bad, and does
serve *some* purpose. Something to consider is this - citing a paper (if it
exists) could be more beneficial professionally for the authors of the
paper, as those things are (I think) tracked more closely.

Lastly, sometimes formats have publications. For example -
http://www.plosone.org/article/info:doi/10.1371/journal.pone.0031009. I
don't know if Edn does or not though. I would just search around for one,
or cite the website if you don't find it.

Chris



On Wed, Apr 23, 2014 at 9:52 AM, Ben Wolfson  wrote:

> On Wed, Apr 23, 2014 at 9:44 AM, Phillip Lord <
> phillip.l...@newcastle.ac.uk> wrote:
>
>>
>> The idea that you can't cite websites is a conceit that ensures that
>> academics continue to spend a 1000s of pounds a paper on puplication
>> costs, when you can achieve much the same with a blog, some metadata and
>> archive.org.
>>
>> Ah, that was good, I feel better now!
>>
>
> The woes of academic publishing have nothing to do with the idea that you
> can't cite websites; MLA and Chicago style both have provisions for citing
> websites and I'm sure less widespread style guides do as well.
>
> --
> Ben Wolfson
> "Human kind has used its intelligence to vary the flavour of drinks, which
> may be sweet, aromatic, fermented or spirit-based. ... Family and social
> life also offer numerous other occasions to consume drinks for pleasure."
> [Larousse, "Drink" entry]
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/pLxZPvlPHBw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojurescript: getting the value out of go-block

2014-04-23 Thread Dmitry Suzdalev
Oh, right! Example with println clears it.
I should gave it some more thought from the how-it-works-internally
perspective!
Guess I just was blown away by the expressiveness of the syntax which makes
everything look so simple and straightforward and sync-like :)

Thanks, Timothy! :)


On 23 April 2014 20:53, Timothy Baldridge  wrote:

> What you want is not possible since core.async does not do full program
> rewriting, only code within a go is transformed. This is for both
> performance and practical reasons.
>
> So yes, wrapping a go in a go may seem a bit pointless, but that's exactly
> the semantic that you want, in a single threaded environment like JS VMs it
> is also the only possible solution.
>
> If you think about it, the semantics of what you are asking for is not
> possible. For how would you pause the execution of the (println) until the
> async evaluation of its arguments had completed?
>
> Timothy
>
>
>
>
> On Wed, Apr 23, 2014 at 3:56 AM, Dmitry Suzdalev  wrote:
>
>> Hello!
>>
>> I was interested in trying to wrap some callback-hellish JS async
>> functionality into something that would look (and work) like a sync call.
>> I thought that it could be some kind of function which internally uses
>> core.async but does not expose this.
>>
>> That is instead of having some function with callback on completion
>>
>> (.findSomething jsLib (fn [res] (println res)))
>>
>> I would like to have a sync-variant of it, something like this
>>
>> (defn findSomething []
>>   "returns res"
>>   (let [c (chan)]
>> (go (!< (.findSomething jsLib (fn [res] (put! c res)))
>>
>> (println (findSomething)) ;; => prints "res" value
>>
>> It would work if go-macro returned last *value* read from the channel.
>> But go macro returns a *channel* that contains the result. So to read it in
>> clojurescript I have to ironically wrap go in go again.
>> Seems like when you started using channels there's no way out of this :)
>> On JVM I could just use > in ClojureScript.
>>
>> Wanted some advice/pointers from experienced programmers as I've just
>> started and might get something completely wrong :)
>> Thanks in advance,
>> Dmitry.
>>
>> --
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What's clojure killer app? I don't see any.

2014-04-23 Thread doug smith
For sure I see using the libs I mentioned.  I was referring to an app for
very basic leaning  of " stuff".  Is that what you have heard they are
working on ?

On Wednesday, April 23, 2014, Mike Haney  wrote:

> This sounds similar to what the Cognician guys are doing.
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/YCnG3rmOp5w/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


JSON authentication with cemerick/friend?

2014-04-23 Thread Ivan Schuetz
Hi,

I'm trying to get a simple use case running - send a login request to 
/login and get success or fail response, preferably in JSON format.

I followed the example in https://github.com/cemerick/friend#workflows


(def users {"root" {:username "root"
:password (creds/hash-bcrypt "admin_password")
:roles #{::admin}}
"jane" {:username "jane"
:password (creds/hash-bcrypt "test")
:roles #{::user}}})


(defroutes app-routes

  (GET "/test" [] {:body {:my-map "helo"}})
  
  (route/resources "/")
  
  (route/not-found "Not found"))

(def app
  (->
  (handler/api app-routes)
  (middleware/wrap-json-body)
  (middleware/wrap-json-response)

   (friend/authenticate {:credential-fn (partial 
creds/bcrypt-credential-fn users)
:workflows [
(workflows/interactive-form)]})
  )
  )



I'm testing with curl:

curl -v --data "username=jane&password=test" http://localhost:3000/login

Or:

curl -v --request POST 
 "http://localhost:3000/login?username=jane&password=test";

And I get:

* About to connect() to localhost port 3000 (#0)
*   Trying ::1...
* connected
* Connected to localhost (::1) port 3000 (#0)
> POST /login?username=jane&password=test HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 
OpenSSL/0.9.8y zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 302 Found
< Date: Wed, 23 Apr 2014 22:25:15 GMT
< Location: http://localhost:3000/login?&login_failed=Y&username=
< Content-Length: 0
< Server: Jetty(7.6.8.v20121106)
< 
* Connection #0 to host localhost left intact
* Closing connection #0


This looks like authentication failed, but the data is correct. I reviewed 
the curl request, and this seems to be the correct way to send a POST. But 
&username= gives me the impression it's not being parsed correctly.

Also, how can I get a JSON response instead of a header?

Thanks.

P.S. Maybe it would be positive if this library has an own Google Group.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


JSON authentication with cemerick/friend?

2014-04-23 Thread Ivan Schuetz
Hi,

I'm trying to get a simple use case running - send a login request to 
/login and get success or fail response, preferably in JSON format.

I followed the example in https://github.com/cemerick/friend#workflows


(def users {"root" {:username "root"
:password (creds/hash-bcrypt "admin_password")
:roles #{::admin}}
"jane" {:username "jane"
:password (creds/hash-bcrypt "test")
:roles #{::user}}})


(defroutes app-routes

  (GET "/test" [] {:body {:my-map "helo"}})
  
  (route/resources "/")
  
  (route/not-found "Not found"))

(def app
  (->
  (handler/api app-routes)
  (middleware/wrap-json-body)
  (middleware/wrap-json-response)

   (friend/authenticate {:credential-fn (partial 
creds/bcrypt-credential-fn users)
:workflows [
(workflows/interactive-form)]})
  )
  )



I'm testing with curl:

curl -v --data "username=jane&password=test" http://localhost:3000/login

Or:

curl -v --request POST  "
http://localhost:3000/login?username=jane&password=test";

And I get:

* About to connect() to localhost port 3000 (#0)
*   Trying ::1...
* connected
* Connected to localhost (::1) port 3000 (#0)
> POST /login?username=jane&password=test HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 
OpenSSL/0.9.8y zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 302 Found
< Date: Wed, 23 Apr 2014 22:25:15 GMT
< Location: http://localhost:3000/login?&login_failed=Y&username=
< Content-Length: 0
< Server: Jetty(7.6.8.v20121106)
< 
* Connection #0 to host localhost left intact
* Closing connection #0


This looks like authentication failed, but the data is correct. I reviewed 
the curl request, and this seems to be the correct way to send a POST. But 
&username= gives me the impression it's not being parsed correctly.

Also, how can I get a JSON response instead of only a header?

Thanks.

P.S. Maybe it would be positive if this library has an own Google Group.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Books for learning Clojure

2014-04-23 Thread Hercules Merscher
I saw this, very nice.

These days i started with Programming Clojure Book and i'm enjoying :)


On Wed, Apr 23, 2014 at 2:14 PM, Plínio Balduino wrote:

> A nice post by Nikola Peric about this subject with what to read and what
> to avoid.
>
>
> http://deltadata.wordpress.com/2014/04/19/learning-clojure-tutorial-books-and-resources-for-beginners/
>
> Plínio
>
>
> On Wed, Apr 23, 2014 at 1:27 PM, Cecil Westerhof 
> wrote:
>
>> 2014-04-23 15:05 GMT+02:00 Stefan Kamphausen :
>>
>>> Would German be an option for you?
>>>
>>
>> ​With what is available, not for me, but maybe for others it would.​
>>
>> --
>> Cecil Westerhof
>>
>> --
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Hercules Lemke Merscher
http://www.herculesdev.com.br

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: JSON authentication with cemerick/friend?

2014-04-23 Thread Sam Ritchie
I wrote a post that tries to explain all the crazy cases you need to 
handle to dispatch Friend responses based on content type:


http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/

Liberator can be helpful for this.


Ivan Schuetz 
April 23, 2014 3:28 PM
Hi,

I'm trying to get a simple use case running - send a login request to 
/login and get success or fail response, preferably in JSON format.


I followed the example in https://github.com/cemerick/friend#workflows 




(def users {"root" {:username "root"
:password (creds/hash-bcrypt "admin_password")
:roles #{::admin}}
"jane" {:username "jane"
:password (creds/hash-bcrypt "test")
:roles #{::user}}})


(defroutes app-routes

  (GET "/test" [] {:body {:my-map "helo"}})
  (route/resources "/")
  (route/not-found "Not found"))

(def app
  (->
  (handler/api app-routes)
  (middleware/wrap-json-body)
  (middleware/wrap-json-response)

   (friend/authenticate {:credential-fn (partial 
creds/bcrypt-credential-fn users)

:workflows [
(workflows/interactive-form)]})
  )
  )



I'm testing with curl:

curl -v --data "username=jane&password=test" http://localhost:3000/login

Or:

curl -v --request POST 
 "http://localhost:3000/login?username=jane&password=test 
"


And I get:

* About to connect() to localhost port 3000 (#0)
*   Trying ::1...
* connected
* Connected to localhost (::1) port 3000 (#0)
> POST /login?username=jane&password=test HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 
OpenSSL/0.9.8y zlib/1.2.5

> Host: localhost:3000
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Wed, 23 Apr 2014 22:25:15 GMT
< Location: http://localhost:3000/login?&login_failed=Y&username= 


< Content-Length: 0
< Server: Jetty(7.6.8.v20121106)
<
* Connection #0 to host localhost left intact
* Closing connection #0


This looks like authentication failed, but the data is correct. I 
reviewed the curl request, and this seems to be the correct way to 
send a POST. But &username= gives me the impression it's not being 
parsed correctly.


Also, how can I get a JSON response instead of only a header?

Thanks.

P.S. Maybe it would be positive if this library has an own Google Group.
--
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem in loop (for loop) with Cascalog results

2014-04-23 Thread Di Xu
Isn't your "loop [hour-part 01]" should be "loop [minute-part 01]"? because
you recur with "(recur (+ minute-part 01))"?

I'm not very familiar with cascalog, maybe you should post this to
https://groups.google.com/forum/#!forum/cascalog-user

Thanks,
Di Xu


2014-04-23 20:15 GMT+08:00 sindhu hosamane :

> Hello friends ,
> i want to get results using cascalog queries .I need to get data between 2
> timestamps datefrom and dateto  as shown below in code . I have a problem
> in loop , where i cannot update the timestamp value .
> I am using clojure cli-time .
>
> (ns Recallnack.core
>
>  (:use [cascalog.api]
>
> [cascalog.more-taps :only (hfs-delimited)])
>
>  (:require [clj-time.core :as t])
>
> (:require [clj-time.format :as f])
>
>  (:require [cascalog.ops :as c])
>
>  (:gen-class))
>
>
>  (def info
>
>   (hfs-delimited
> "/Volumes/SindhuHosamane/Master_thesis_docs/burner_changed.txt"
>
>:delimiter ";"
>
>:outfields ["?timestamp" "?assembly" "?sensor"
> "?value"]
>
>:classes[String String String Float]
>
>:skip-header? false))
>
>
> (def info-tap
>
>   (<- [?timestamp ?value]
>
>   ((select-fields info ["?timestamp" "?value"]) ?timestamp ?value)))
>
>
> (def datefrom "12:05:2010 00:00:00")
>
>  (def dateto "12:05:2010 01:01:00")
>
>
> (def custom-formatter (f/formatter "dd:MM: HH:mm:ss"))
>
> (def hour-part (t/hour (f/parse custom-formatter datefrom)))
>
> (def minute-part(t/minute (f/parse custom-formatter datefrom)))
>
>
> (loop [hour-part 01]
>
>   (when (>= minute-part 00)
>
> (?<- (stdout) [?timestamp-out ?value-out]
>
>   (info-tap  ?timestamp ?value) (c/limit [1] ?timestamp ?value 
> :>?timestamp-out ?value-out
> )
>
>  )
>
>  (recur (+  minute-part 01
>
> where am i wrong in the loop ? Any advice!!
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: citing Clojure and EDN?

2014-04-23 Thread Ambrose Bonnaire-Sergeant
Here's a good citation for Clojure:
http://dl.acm.org/citation.cfm?id=1408682

Thanks,
Ambrose


On Wed, Apr 23, 2014 at 1:46 PM, Christopher Small wrote:

> I'm not disagreeing with you. When you're talking about a language, and
> none of the papers specifically points to the language as a whole - that's
> fine. But in the case of specific software packages/programs, I think it is
> often better to cite a paper if it exists. For example, if I write a paper
> that uses BEAST in an analysis, I'm going to cite the paper for BEAST, not
> the BEAST website. But if I cite R, I'll cite the website (as running
> `citation()` from the command line suggests I should).
>
> However, I think you're generalizing a bit too strongly when it comes to
> academic publications. For example, BEAST2 was published in an Open Access,
> online only journal called PLoS (
> http://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.1003537).
> No paper need apply, and all of the content is CC :-) That's not to say
> that PLoS isn't an island of refuge in sea of ossified stodginess, or that
> even it couldn't be better in ways. But it's not *all* so bad, and does
> serve *some* purpose. Something to consider is this - citing a paper (if
> it exists) could be more beneficial professionally for the authors of the
> paper, as those things are (I think) tracked more closely.
>
> Lastly, sometimes formats have publications. For example -
> http://www.plosone.org/article/info:doi/10.1371/journal.pone.0031009. I
> don't know if Edn does or not though. I would just search around for one,
> or cite the website if you don't find it.
>
> Chris
>
>
>
> On Wed, Apr 23, 2014 at 9:52 AM, Ben Wolfson  wrote:
>
>> On Wed, Apr 23, 2014 at 9:44 AM, Phillip Lord <
>> phillip.l...@newcastle.ac.uk> wrote:
>>
>>>
>>> The idea that you can't cite websites is a conceit that ensures that
>>> academics continue to spend a 1000s of pounds a paper on puplication
>>> costs, when you can achieve much the same with a blog, some metadata and
>>> archive.org.
>>>
>>> Ah, that was good, I feel better now!
>>>
>>
>> The woes of academic publishing have nothing to do with the idea that you
>> can't cite websites; MLA and Chicago style both have provisions for citing
>> websites and I'm sure less widespread style guides do as well.
>>
>> --
>> Ben Wolfson
>> "Human kind has used its intelligence to vary the flavour of drinks,
>> which may be sweet, aromatic, fermented or spirit-based. ... Family and
>> social life also offer numerous other occasions to consume drinks for
>> pleasure." [Larousse, "Drink" entry]
>>
>>  --
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/pLxZPvlPHBw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Style - Keyword access or accessors?

2014-04-23 Thread Mars0i
One of the things I hated about Java when I did Java programming for a 
living, a number of years ago, was having to define accessors, over, and 
over, and over again for each class.  What a waste of time!  (Not to 
mention the instance in which we made a client move to using paper rather 
than software for three days while I tracked down a null pointer exception 
resulting from forgetting to modify a name after copying and pasting from 
another accessor.)  Granted, there are tools that can automate this process 
(we couldn't afford them then), but why?  Why do you need a special tool 
just to get the language to do what you're usually going to need, anyway, 
by default.

Why define an accessor when Clojure has already defined one for you--i.e. 
the keyword.  (Unless you need it.  I define an accessor when I need two 
different record types to return the same kind of data even though they 
don't share the same internal structure.)

mho

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] data.avl 0.0.12 -- sorted collections with slice, nth, transient support

2014-04-23 Thread Michał Marczyk
Cheers Alex!

See below for the results of yesterday's run of my benchmark suite for
the basic operations. (I'll post some benchmark results for the new
functions in a separate message sometime soon.)

In general, it's fair to expect (persistent) assoc/dissoc to be slower
with data.avl maps, since AVL trees do more work to rebalance
themselves than red-black trees. (That's on average, of course.)

The upside is that lookups in AVL trees are faster on average,
sometimes quite dramatically, due to the trees being shallower. It's
worth pointing out that this really is "on average" -- individual
timings depend on the path through the tree the lookup operation needs
to traverse, and for nodes at exactly the same position in the tree
the built-ins are slightly faster (23.9 ns vs. 25.5 ns for a lookup
succeeding at the root node, see the (get % 131071) benchmark case
below; as I recall, 0 happens to occupy the same position in both
benchmark maps as well) -- but if we hit a deeper part of a red-black
tree, data.avl is likely to win by a large margin, as in the case of
the 311 ns (data.avl) vs. 588 ns (built-in) result for looking up
29 in the two benchmark maps.

For longer chains of "updates" -- including construction of instances
with more than a handful of elements -- data.avl wins thanks to its
support for transients; in particular, inserting 30 entries in
ascending order of keys took 197 ns with data.avl's sorted-map during
my benchmark run yesterday vs. 317 ns with the built-in.


;;; the setup:

(def ks   (range 30))
(def ksks (interleave ks ks))

(def rb  (apply sorted-map ksks))
(def avl (apply avl/sorted-map ksks))

;;; the actual benchmark run

Clojure 1.5.1
user=> (all-benchmarks)
(lookup-benchmarks)
===
(c/bench (get avl 0))
WARNING: Final GC required 17.95425214438086 % of runtime
WARNING: Final GC required 1.44548564181991 % of runtime
Evaluation count : 233348580 in 60 samples of 3889143 calls.
 Execution time mean : 257.269857 ns
Execution time std-deviation : 2.083817 ns
   Execution time lower quantile : 254.044412 ns ( 2.5%)
   Execution time upper quantile : 261.944879 ns (97.5%)
   Overhead used : 2.115402 ns

Found 1 outliers in 60 samples (1.6667 %)
low-severe 1 (1.6667 %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers
(c/bench (get rb 0))
WARNING: Final GC required 1.443796805141993 % of runtime
Evaluation count : 245219880 in 60 samples of 4086998 calls.
 Execution time mean : 244.222199 ns
Execution time std-deviation : 1.613109 ns
   Execution time lower quantile : 240.981893 ns ( 2.5%)
   Execution time upper quantile : 247.680884 ns (97.5%)
   Overhead used : 2.115402 ns
(c/bench (get avl 131071))
WARNING: Final GC required 1.538687432575083 % of runtime
Evaluation count : 2189108520 in 60 samples of 36485142 calls.
 Execution time mean : 25.463933 ns
Execution time std-deviation : 0.159206 ns
   Execution time lower quantile : 25.242537 ns ( 2.5%)
   Execution time upper quantile : 25.846594 ns (97.5%)
   Overhead used : 2.115402 ns

Found 2 outliers in 60 samples (3. %)
low-severe 2 (3. %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers
(c/bench (get rb 131071))
WARNING: Final GC required 1.544907815808739 % of runtime
Evaluation count : 2306183280 in 60 samples of 38436388 calls.
 Execution time mean : 23.873777 ns
Execution time std-deviation : 0.243375 ns
   Execution time lower quantile : 23.590693 ns ( 2.5%)
   Execution time upper quantile : 24.503250 ns (97.5%)
   Overhead used : 2.115402 ns

Found 3 outliers in 60 samples (5. %)
low-severe 1 (1.6667 %)
low-mild 2 (3. %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers
(c/bench (get avl 29))
WARNING: Final GC required 1.4317314000518289 % of runtime
Evaluation count : 192818880 in 60 samples of 3213648 calls.
 Execution time mean : 311.396507 ns
Execution time std-deviation : 2.029572 ns
   Execution time lower quantile : 308.219265 ns ( 2.5%)
   Execution time upper quantile : 315.544485 ns (97.5%)
   Overhead used : 2.115402 ns
(c/bench (get rb 29))
WARNING: Final GC required 1.424486278904469 % of runtime
Evaluation count : 102060180 in 60 samples of 1701003 calls.
 Execution time mean : 588.846851 ns
Execution time std-deviation : 3.124839 ns
   Execution time lower quantile : 584.394022 ns ( 2.5%)
   Execution time upper quantile : 594.415623 ns (97.5%)
   Overhead used : 2.115402 ns

Found 1 outliers in 60 samples (1.6667 %)
low-severe 1 (1.6667 %)
 Variance from outliers : 1.6389 % Variance is slightly inflated by outliers
(construction-benchmarks)
=
(c/bench (apply avl/sorted-map ksks))
WARNING: Final GC required 5.3006864743254365 % of runtime
Evaluation count : 360 i

Re: JSON authentication with cemerick/friend?

2014-04-23 Thread Erik Bakstad
Here is an example from our ajax-login form. After reading Sam's excellent 
writeup it should be understandable.

https://gist.github.com/ebaxt/11244031

kl. 00:28:45 UTC+2 torsdag 24. april 2014 skrev Ivan Schuetz følgende:
>
> Hi,
>
> I'm trying to get a simple use case running - send a login request to 
> /login and get success or fail response, preferably in JSON format.
>
> I followed the example in https://github.com/cemerick/friend#workflows
>
>
> (def users {"root" {:username "root"
> :password (creds/hash-bcrypt "admin_password")
> :roles #{::admin}}
> "jane" {:username "jane"
> :password (creds/hash-bcrypt "test")
> :roles #{::user}}})
>
>
> (defroutes app-routes
>
>   (GET "/test" [] {:body {:my-map "helo"}})
>   
>   (route/resources "/")
>   
>   (route/not-found "Not found"))
>
> (def app
>   (->
>   (handler/api app-routes)
>   (middleware/wrap-json-body)
>   (middleware/wrap-json-response)
>
>(friend/authenticate {:credential-fn (partial 
> creds/bcrypt-credential-fn users)
> :workflows [
> (workflows/interactive-form)]})
>   )
>   )
>
>
>
> I'm testing with curl:
>
> curl -v --data "username=jane&password=test" http://localhost:3000/login
>
> Or:
>
> curl -v --request POST  "
> http://localhost:3000/login?username=jane&password=test";
>
> And I get:
>
> * About to connect() to localhost port 3000 (#0)
> *   Trying ::1...
> * connected
> * Connected to localhost (::1) port 3000 (#0)
> > POST /login?username=jane&password=test HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 
> OpenSSL/0.9.8y zlib/1.2.5
> > Host: localhost:3000
> > Accept: */*
> > 
> < HTTP/1.1 302 Found
> < Date: Wed, 23 Apr 2014 22:25:15 GMT
> < Location: http://localhost:3000/login?&login_failed=Y&username=
> < Content-Length: 0
> < Server: Jetty(7.6.8.v20121106)
> < 
> * Connection #0 to host localhost left intact
> * Closing connection #0
>
>
> This looks like authentication failed, but the data is correct. I reviewed 
> the curl request, and this seems to be the correct way to send a POST. But 
> &username= gives me the impression it's not being parsed correctly.
>
> Also, how can I get a JSON response instead of only a header?
>
> Thanks.
>
> P.S. Maybe it would be positive if this library has an own Google Group.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.