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 req

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

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 sof

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 -

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 hosam

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 Apr

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-

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-bc

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-bc

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 mes

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 2

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 t

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 Kamphaus

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

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 e

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, tha

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 languag

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

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 > chara

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, se

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

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 Wednesd

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

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 C

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 b

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 feat

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) (-

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 al

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 > (:

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.

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 >> > B

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

[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

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 > ret

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 `mo

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

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. O

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: >> >>

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

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 functio

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 an

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 l

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

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 progres

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]

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" "

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. n

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

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

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 becau

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 p

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 wit