Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Cedric Greevey
You pass not the Discoverer's results to the Runner, but the Discoverer itself, which the Runner then invokes at need, possibly more than once. On Tue, Jun 11, 2013 at 1:35 AM, Steven Degutis wrote: > Originally we had Runner split into Discoverer and Runner, but I had to > combine them both in

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Steven Degutis
Originally we had Runner split into Discoverer and Runner, but I had to combine them both in Runner again so that we can have an autorunner. Imagine that you've started your autorunner at the command line, and you create a new test in your existing file and save it. The discoverer has already done

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Michael-Keith Bernard
Here is an alternative implementation that generalizes the encrypt/decrypt functionality. It also uses all printable characters for the source dictionary. https://gist.github.com/SegFaultAX/5754209 P.S. I accidentally posted this as a reply to an older question I happened to have open. On Mon

Re: swap keys / values in hash map

2013-06-10 Thread Michael-Keith Bernard
An alternative implementation that shuffles all printable characters. This version returns the encryption map and generalizes the encrypt/decrypt functionality. https://gist.github.com/SegFaultAX/5754209 On Tuesday, August 12, 2008 10:25:00 PM UTC-7, Joubert Nel wrote: > > Hello, > > I have a

Re: Clojure in production

2013-06-10 Thread Joseph Smith
I work for Nanonation Inc (Nanonation.net) and we have a couple internal tools as well as a new product, Viewpoint, where the backend and web portal are both 100% Clojure. --- Joseph Smith j...@uwcreations.com @solussd On Jun 10, 2013, at 6:48 PM, Ignacio Thayer wrote: > ReadyForZero.com u

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Steven Degutis
It's pretty frustrating that I, a regular old Clojure user who likes writing tests, can't mix and match tools from existing testing libraries. Seriously, there's 4 major ones (clojure.test, speclj, midje, expectations) and they each do mostly the same things but vary slightly in some areas. I can't

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Kelker Ryan
 Try this version. user> (defn gen-crypto [] (let [chars #(->> (iterate inc %) (map char) (take 26)) upper (chars 65) lower (chars 97) digit (take 10 (chars 48)) [sl su sd] (map shuff

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Shannon Severance
Thank you for your example. I especially like doing sl, su, sd in one line. However: user=> ((gen-crypto) "1 for me, 2 for you.") "1 zdu gy, 2 zdu fdx." The numbers are coming through without translation. I believe defining digit as: user=> (map #(char (+ 48 %)) (range 10)) (\0 \1 \2 \3 \4 \5 \6

Re: Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Kelker Ryan
Here's my re-write. user> (defn gen-crypto [] (let [atoz (range 65 91) upper (map char atoz) lower (map #(char (+ % 32)) atoz) digit (range 10) [sl su sd] (map shuffle [lower upper digit]) encrypt (reduce conj

Re: [ANN] if-and

2013-06-10 Thread Jean Niklas L'orange
On Monday, June 10, 2013 10:20:20 PM UTC+2, Steven Degutis wrote: > Sometimes I've wanted a function that takes a value and a bunch of tests, > and returns it if it passes every test, otherwise nil. > > Does this seem useful enough to put into core? > > A simpler variant already exists in core,

Re: [ANN] if-and

2013-06-10 Thread Ben Wolfson
On Mon, Jun 10, 2013 at 6:55 PM, Cedric Greevey wrote: > Hmmm? Maybe > > (defn if-and [x & tests] > (if (every? true? (map #(% x) tests)) x)) > > for a version that's a function, would short-circuit but for seq chunking, > and returns nil or x. > Yes, that's why you might as well use this: u

Re: [ANN] if-and

2013-06-10 Thread Cedric Greevey
Hmmm? Maybe (defn if-and [x & tests] (if (every? true? (map #(% x) tests)) x)) for a version that's a function, would short-circuit but for seq chunking, and returns nil or x. Incidentally, I think you can dechunk any seq with (map first (take-while seq (iterate next s))), but haven't tested t

Making cryptograms, my first Clojure function. Feedback welcome.

2013-06-10 Thread Shannon Severance
I'm new to Clojure, but with some lisp experience, I've dabbled in Scheme for a few years. Used Racket earlier this year for a couple of sectoins of a MOOC. And occasionally write Emacs lisp. The idea is to create cyptograms . These are word puzzles usi

Re: [ANN] if-and

2013-06-10 Thread Jiaqi Liu
you can just use (every? true? '(arg1 arg2 )) or def a simple function . i think the Core is powerful enough. 2013/6/11 Cedric Greevey > There's also the defmacro route: > > (defmacro if-and [test-expr binding & tests] > `(let [~binding ~test-expr] > (and ~@(concat tests [binding])))

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Timothy Baldridge
>> It might surprise you to know that there are actual human beings with feelings who write the software you slam. You are right. And I apologize for my strong words. For the goals that Midje strives for, it is an excellent library. My reaction is more against the ideas behind Midje (from the doc

Future of clojure.contrib.core/-?> macro

2013-06-10 Thread Daniel
you should also check out https://github.com/rplevy/swiss-arrows -- -- 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

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Brandon Bloom
There are currently 4 roles defined: Definer, Asserter, Runner, and Reporter. It looks like the "Runner" does finding, filtering, and execution. I think you could further break the Runner down into Discoverer and Executor. I might want to just ask "What tests do I have?" without actually runnin

Re: Clojure in production

2013-06-10 Thread Ignacio Thayer
ReadyForZero.com uses clojure exclusively (~50K lines) on the backend for http and api requests. Ignacio Thayer Co-founder/CTO ReadyForZero.com On Monday, June 10, 2013 2:47:25 PM UTC-7, Plinio Balduino wrote: > > Hi there > > I'm writing a talk about Clojure in the real world and I would like

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Brian Marick
On Jun 10, 2013, at 9:20 AM, Timothy Baldridge wrote: > Midje on the other hand, is a massive pile of macros and DSLs that so > complicate your code that advanced tests are insanely hard to debug. ... And > I can't tell you how many dozens of hours I've lost trying to figure out why > Midje do

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Frantisek Sodomka
I am just curious, not requesting this feature :-) How to represent negation in BNF? http://stackoverflow.com/questions/10922352/how-to-represent-negation-in-bnf http://pythonhosted.org/modgrammar/libref.html modgrammar.EXCEPT(grammar, exc_grammar, **kwargs) Match grammar, but only if it does

Re: Clojure in production

2013-06-10 Thread Plínio Balduino
Thanks. I went there before ask here =) Plínio On Jun 10, 2013 6:58 PM, "Softaddicts" wrote: > Look at this: > > http://dev.clojure.org/display/community/Clojure+Success+Stories > > Luc > > > > Hi there > > > I'm writing a talk about Clojure in the real world and I would like to > > know, if pos

Re: Clojure in production

2013-06-10 Thread Softaddicts
Look at this: http://dev.clojure.org/display/community/Clojure+Success+Stories Luc > Hi there > > I'm writing a talk about Clojure in the real world and I would like to > know, if possible, which companies are using Clojure for production or > to make internal tools. > > Thank you > > Plínio Ba

Re: Clojure in production

2013-06-10 Thread Dima Sabanin
Hi Plínio, We use Clojure heavily in beanstalkapp.com. Best, Dima On Mon, Jun 10, 2013 at 5:47 PM, Plínio Balduino wrote: > Hi there > > I'm writing a talk about Clojure in the real world and I would like to > know, if possible, which companies are using Clojure for production or > to make int

Clojure in production

2013-06-10 Thread Plínio Balduino
Hi there I'm writing a talk about Clojure in the real world and I would like to know, if possible, which companies are using Clojure for production or to make internal tools. Thank you Plínio Balduino -- -- You received this message because you are subscribed to the Google Groups "Clojure" gr

Re: [ANN] if-and

2013-06-10 Thread Cedric Greevey
There's also the defmacro route: (defmacro if-and [test-expr binding & tests] `(let [~binding ~test-expr] (and ~@(concat tests [binding] Evaluates test-expr, then evaluates to the result of that if the tests all pass, and to a falsey value otherwise (in fact, the first falsey value ret

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread JeremyS
Hi guys, > > This might not be a good idea but if the goal is to have a minimal testing utilities (or testing abstractions might I say ?) do you plan to port them to ClojureScript ? The idea of a minimal testing utility that would be extensible to suit everyone's taste and style of testing would

Re: [ANN] if-and

2013-06-10 Thread Ben Wolfson
On Mon, Jun 10, 2013 at 1:20 PM, Steven Degutis wrote: > Sometimes I've wanted a function that takes a value and a bunch of tests, > and returns it if it passes every test, otherwise nil. > > So I wrote if-and: > > (if-and "foo" > > string? > #(.startsWith % "f") > #(.cont

[ANN] if-and

2013-06-10 Thread Steven Degutis
Sometimes I've wanted a function that takes a value and a bunch of tests, and returns it if it passes every test, otherwise nil. So I wrote if-and: (if-and "foo" string? #(.startsWith % "f") #(.contains % "oo")) ;; => "foo" (if-and "foo" string? #(.start

Re: Best IDE

2013-06-10 Thread Sean Corfield
We have an admin option to start (& stop) a repl server inside our application so we can nrepl from Emacs into any live running instance and evaluate code in that live context - great for debugging "only happens on production" issues as well as making interactive development and debugging locally m

Re: with-open and for

2013-06-10 Thread Thomas Heller
Hey, I pasted the code into gist ( https://gist.github.com/thheller/5734642 ) and copy&pasted that into the post. Cheers, /thomas On Mon, Jun 10, 2013 at 6:01 PM, Alan Thompson wrote: > Hey Thomas - How'd you get the nice syntax highlighting in your post? > Alan > > > On Sat, Jun 8, 2013 at 7:

Re: with-open and for

2013-06-10 Thread Alan Thompson
Hey Thomas - How'd you get the nice syntax highlighting in your post? Alan On Sat, Jun 8, 2013 at 7:16 PM, Steven D. Arnold wrote: > Thanks for the responses! As suggested, wrapping in 'doall' does work. > > > On Jun 8, 2013, at 3:28 AM, Thomas Heller wrote: > > (defn filter-file [filename] >

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Timothy Baldridge
>> You can certainly use with-redefs with any testing library/framework, or you can pass dependencies into your production-code functions. I think perhaps I'm missing the detail you're seeing on how using a particular test framework encourages using global vars - can you elaborate? You're right, m

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Colin Jones
On Monday, June 10, 2013 9:20:31 AM UTC-5, tbc++ wrote: > > >> 1) testing recursive functions. I want to test what a recursion STEP > does, not the >> whole function. Can I mock 'recur'? > > You shouldn't need to, pull the body of the loop out as as separate > function, then test that function.

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Timothy Baldridge
>> 1) testing recursive functions. I want to test what a recursion STEP does, not the >> whole function. Can I mock 'recur'? You shouldn't need to, pull the body of the loop out as as separate function, then test that function. >> 2) testing sequence, esp. lazy For this, I often create a generat

Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread Shlomi Vaknin
oh thats a much better option! thanks! On Mon, Jun 10, 2013 at 4:30 PM, James Reeves wrote: > On 10 June 2013 13:59, Nicola Mometto wrote: > >> >> They're in the core.incubator contrib repository >> https://github.com/clojure/core.incubator > > > They're also in the clojure.core namespace for

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-10 Thread Brian Marick
On Jun 10, 2013, at 12:22 AM, julianrz wrote: > This may be a little off topic, but does this, or any other framework, solve > some testing inconveniences that exist in Clojure and probably other > functional languages: > 1) testing recursive functions. I want to test what a recursion STEP doe

Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread James Reeves
On 10 June 2013 13:59, Nicola Mometto wrote: > > They're in the core.incubator contrib repository > https://github.com/clojure/core.incubator They're also in the clojure.core namespace for Clojure 1.5 onward, but renamed to some-> and some->>. - James -- -- You received this message because

Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread Shlomi Vaknin
great, thanks! On Mon, Jun 10, 2013 at 3:59 PM, Nicola Mometto wrote: > > They're in the core.incubator contrib repository > https://github.com/clojure/core.incubator > > shlomivak...@gmail.com writes: > > > Hey, its been a while since this discussion ended.. > > > > I read through it and now i

Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread Nicola Mometto
They're in the core.incubator contrib repository https://github.com/clojure/core.incubator shlomivak...@gmail.com writes: > Hey, its been a while since this discussion ended.. > > I read through it and now i am fully confused, where did -?> and -?>> end > up being in? > > Thanks, > Shlomi > > On

Re: Future of clojure.contrib.core/-?> macro

2013-06-10 Thread shlomivaknin
Hey, its been a while since this discussion ended.. I read through it and now i am fully confused, where did -?> and -?>> end up being in? Thanks, Shlomi On Thursday, April 21, 2011 5:51:59 PM UTC+3, Ivan Koblik wrote: > > Hi Paul, > > Thanks, good to know. Sorry for the misleading email. > >

Re: Best IDE

2013-06-10 Thread Antonio Terreno
Not sure how it's obvious or granted as I am pretty new to the clojure world but I am really loving having a repl namespace in our projects, compiling the repl file kicks in the (web) application in the same way it gets kicked in from the -main. Server goes up, any time we C-x X-s a file we also c

Re: Best IDE

2013-06-10 Thread Jay Fields
2013/6/8 Jay Fields > > My favorite recent addition - I can run my app from within emacs, allowing >> me to change my app with a simple C-x C-e and see my changes immediately in >> the running app (no restart, refresh or reload necessary). > > > Would you mind to extend on that ? > > How is thi

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Mark Engelberg
On Mon, Jun 10, 2013 at 2:57 AM, Frantisek Sodomka wrote: > Googling the exception operator: > http://avisynth.org/mediawiki/User:Gzarkadas/EBNF > Exception The effect is the logical negation of the rule > following. For example -"a" becomes ? all characters not equal to a ?. > Yeah, th

Re: New Functional Programming Job Opportunities

2013-06-10 Thread Jiaqi Liu
any job opportunity in China ? 2013/5/27 Functional Jobs > Here are some functional programming job opportunities that were posted > > recently: > > > > Clojure Programmer at Triggit > > http://functionaljobs.com/jobs/148-clojure-programmer-at-triggit > > > > Cheers, > > Sean Murphy > > Functio

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Frantisek Sodomka
Large bounded repetition is a theoretical question. My use case requires to ensure repetition of only small number of digits - one digit, two digits and similar. I would use bounded repetition to ensure the needed number of digits. Yes, different workarounds will work for me, so it is not a pre

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Mark Engelberg
On Mon, Jun 10, 2013 at 2:13 AM, Frantisek Sodomka wrote: > EBNF syntax for bounded repetition could be just simply A 3*5 and these > are equal: > A? is A*1 > A+ is A1* > A* is A0* > Right now, in the EBNF syntax, numbers are valid non-terminal identifiers. So for example, rather than "S = A B+",

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Frantisek Sodomka
EBNF syntax for bounded repetition could be just simply A 3*5 and these are equal: A? is A*1 A+ is A1* A* is A0* Frantisek On Monday, June 10, 2013 11:04:52 AM UTC+2, Frantisek Sodomka wrote: > > Hello Mark, > I have few suggestions: > > 1. I was going through the tutorial and comparing EBNF an

Re: [ANN] Instaparse 1.1.0

2013-06-10 Thread Frantisek Sodomka
Hello Mark, I have few suggestions: 1. I was going through the tutorial and comparing EBNF and ABNF grammars. ABNF adds Bounded Repetition 3*5 A. Is there any chance of adding it also to EBNF? I don't know, how the syntax would be, but it can be useful at times. Repetition of characters can be

Re: Compiler bug?

2013-06-10 Thread Frantisek Sodomka
Thank you for the fix, now it works without the problem. It's fun to write grammars with Instaparse :-) On Friday, June 7, 2013 1:29:32 AM UTC+2, puzzler wrote: > > On Thu, Jun 6, 2013 at 4:27 PM, Mark Engelberg > > > wrote: > >> Short answer: This is fixed in 1.2.0-SNAPSHOT. >> > > To be clea