Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-25 Thread Brian Marick
> On Aug 24, 2016, at 9:28 PM, adrian.med...@mail.yu.edu wrote: > > I do not think your tone and lack of constructive feedback to Alex's (and > others) thoughtful responses is helping your case. Probably not(*), though I would characterize the responses differently. They are polite, and they

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-24 Thread Brian Marick
> On Aug 24, 2016, at 7:46 PM, Brian Marick wrote: > So why not do it in the bottom layer? Is there some deep reason why only an > unserious programmer would want information in anything other than the > current clojure.spec order? (We’re talking here about reordering a list.) An

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-24 Thread Brian Marick
> On Aug 24, 2016, at 8:39 AM, Stuart Halloway > wrote: > > 3. "Follow the inverted pyramid so people see what is most important." This > kind of thing is easily done in a layer above spec, e.g. a custom REPL > printer for spec macro errors. Worth working on but not critical to getting > sp

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-23 Thread Brian Marick
> On Aug 22, 2016, at 7:50 PM, Alex Miller wrote: > You've complained in other channels about the "learning to read" error > messages part and I think you've taken it entirely the wrong way or maybe I > just disagree. There are benefits from reporting errors in a generic, > consistent way. […

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-22 Thread Brian Marick
> On Aug 22, 2016, at 11:23 AM, Leon Grapenthin > wrote: > > Still the error messages are simply far from good enough and that is what > appears to me as the main problem OP has. This is important. Will the new, stricter error messages be improved before 1.9 is finalized? -- You receive

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-21 Thread Brian Marick
As an update. I’ve fixed the `ns` oopsie in Suchwow (one file), and the coincident `ns` oopsie in Midje (one file). But this happens when running Midje’s self-tests against Clojure 1.9alpha11: > Exception in thread "main" java.lang.IllegalArgumentException: Call to > clojure.core/fn did not con

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-20 Thread Brian Marick
> On Aug 20, 2016, at 6:30 PM, Timothy Baldridge wrote: > > Brian, let's make it more concrete then...why should the Clojure compiler > continue to support undocumented features that make code unportable? Because: 1. People who want to port to clojurescript will incur exactly the same cost

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-20 Thread Brian Marick
> On Aug 20, 2016, at 5:26 PM, s...@corfield.org wrote: > > I disagree (strongly) with your position here Brian. I’ll try to explain > clearly why but first a little background… I too have felt the pain of having to maintain backward compatibility. However, I’m reminded, in this case, of Mark

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-20 Thread Brian Marick
> On Aug 20, 2016, at 9:03 AM, Alex Miller wrote: > > We discussed this before releasing the specs and decided to start on the > strict side. That said, this is still an alpha and there is plenty of time to > change our minds prior to official release of 1.9 if that ends up being a > catastro

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-20 Thread Brian Marick
> On Aug 20, 2016, at 9:03 AM, Alex Miller wrote: > > You left out this next important line too since it points you to exactly the > file and line where the error occurs: > > , compiling:(such/sequences.clj:1:1) This is interesting. Here’s why I missed it. I attach the error message I saw f

Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-20 Thread Brian Marick
Yesterday, a bug was filed against Suchwow under 1.9alpha11. It turns out to have been a use of `ns …(require…` instead of `(ns …(:require`. Not in Suchwow, but in Midje. Unfortunately, the Suchwow file the bug report pointed at *also* had that typo - apparently I am prone to it - so adding the

ANN: Structural-typing 2.0.1

2016-04-17 Thread Brian Marick
"Structural typing for Clojure, somewhat inspired by Elm. Tailored to 'flow-style' programming, where complex structures flow through a series of functions, each of which makes a smallish change. Can also be used in testing tools and the like that need to describe how a nested structure differs

Re: Return from a function

2016-04-17 Thread Brian Marick
Colin Yates wrote: Also, you might want to invest in either core.typed or prismatic schema for validating shapes of data. I think Brian Marick of Midje fame has a similar answer but I can't recall the name. https://github.com/marick/structural-typing/ -- You received this message be

Re: conditional logic implemented as pattern-matching and restructuring in the signature of the function

2016-02-13 Thread Brian Marick
To add to the list, I wrote `defpatterned` for /Functional Programming for the Object-Oriented Programmer/. https://github.com/marick/patterned There are probably many others. Moving pattern matching closer to `clojure.core` might be a good thing for a roadmap. I'm pretty excited by pattern-match

ANN: Suchwow 5.0.0

2016-02-11 Thread Brian Marick
Suchwow is my grab-bag library of Clojure functions. 5.0.0 is a major version bump because I dropped support of Clojure 1.5. Otherwise, it adds a few new functions plus one potentially significant new namespace. In two jobs, I've wanted to slurp in tabular data (CSV or relational queries) an

Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-31 Thread Brian Marick
Timothy Baldridge wrote: This is a good example of a DSL, and it falls under the criticisms I level at most DSLs, mainly they aren't Clojure. If we dive into I note that Midje once had an intermediate “semi-sweet” functional interface that the `fact` macro expanded into. (It was most similar

Re: [ANN] fudje - unit testing library vaguely resembling midje, but with less 'calories'

2016-01-26 Thread Brian Marick
dimitris wrote: This is a small testing library inspired by midje. For what it's worth, I (author of Midje) think this is wonderful. You might consider emphasizing that you have similar checkers, as I think that's one of Midje's strong points. I've been recently incorporating https://github.

Re: [ANN] Clojure 1.8.0-RC3

2015-12-14 Thread Brian Marick
Noam: does this mean it's not an issue with Midje? If it is, I'll look into it. Noam Ben-Ari wrote: After upgrading to [reduce-fsm "0.1.4"] all my tests pass with RC3 :-) On Tuesday, December 8, 2015 at 3:14:21 PM UTC+2, Noam Ben-Ari wrote: Thanks for the prompt response, I have filed a t

[ANN] Specter book approach: please evaluate

2015-11-22 Thread Brian Marick
I announced a while back that I'd be writing a short book on Specter https://github.com/nathanmarz/specter After some thrashing and the usual interruptions, I have the first chapter written. I've taken an unusual approach: teaching Specter by having you implement parts of it. I'm curious to hea

[ANN] Structural-typing 1.0

2015-11-01 Thread Brian Marick
https://github.com/marick/structural-typing/ This is a validation or type-checking library for Clojure, playing in roughly the same space as Prismatic Schema, Bouncer, or Validateur. It was inspired by Elm's structural typing and my previous need to validate complex data structures flowing int

lazyseq?

2015-10-18 Thread Brian Marick
Is there a way to tell if `v` is a lazyseq other than `(instance? clojure.lang.LazySeq v)`? Seems like there should be, but I'm not seeing it. [Preparing to say "duh!"] -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: deprecation warnings?

2015-10-17 Thread Brian Marick
William la Forge wrote: Going forward, I'd like to deprecate some functions and have a warning displayed on first use. So I've done this: I use defprecate https://github.com/alexander-yakushev/defprecated -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: midje only 1 test

2015-09-12 Thread Brian Marick
Roland Kaercher wrote: I *strongly* recommend doing all your testing in a repl buffer. That given, there are two ways to solve your problem. The first, which I prefer, is to start by testing everything: (use 'midje.repl) (autotest) Other than having a REPL, is t

Re: midje only 1 test

2015-09-05 Thread Brian Marick
I *strongly* recommend doing all your testing in a repl buffer. That given, there are two ways to solve your problem. The first, which I prefer, is to start by testing everything: (use 'midje.repl) (autotest) Then, when you change any text and save the namespace it's in, all tests tha

Interest in a book on Nathan Marz's Specter?

2015-08-28 Thread Brian Marick
en starting out, I would have liked a short, exercise- and example-filled book on Specter. I'm thinking of writing that book. Leanpub lets people indicate their interest on a book's webpage, which is here: https://leanpub.com/specter If you are, please do. Brian Marick -- You rece

Re: How can find something inside heavily nested data structure ?

2015-08-25 Thread Brian Marick
Dave Tenny wrote: Specter looks nice. I didn't see any examples in the readme or tests for working with more deeply nested data structures such as those discussed in this thread, any pointers? Here's an example that might be relevant to the original question. Suppose you have this structure

Re: How can find something inside heavily nested data structure ?

2015-08-23 Thread Brian Marick
Andy- wrote: I have yet to evaluate it myself but this might do help you: https://github.com/nathanmarz/specter Specter is great. -- 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

Re: [ANN] suchwow: a grab-bag library with some twists

2015-08-06 Thread Brian Marick
Colin Fleming wrote: I think that would be great. It would be preferable to have a single repo for docstring improvements so that tools can obtain them without bringing in other things from e.g. such-wow. Note that everything in suchwow is public domain, so the docstrings there can be grabbe

Re: Tool authors: ClojureScript support in tools.namespace?

2015-07-25 Thread Brian Marick
Midje Stuart Sierra wrote: 1. Do you need/want ClojureScript support? Eventually, but not soon. 2. What namespaces (repl, find, dir, file, parse) do you call in tools.namespace? repl, dir, track, reload 3. How would you like to distinguish between "get me Clojure sources" a

Deprecation library

2015-07-12 Thread Brian Marick
Is there a library out there for deprecating functions? I'm looking for something that prints a deprecation message, but only once, allows deprecation messages to be turned off (probably from environment variable), and perhaps allows something other than `println` to be plugged in as the messag

Re: [ANN] suchwow: a grab-bag library with some twists

2015-07-12 Thread Brian Marick
Colin Fleming wrote: I just saw this the other day, in particular the better docstrings are great. See also Andy Fingerhut's Thalia project. I'm planning to provide doc from both of these in Cursive soon. That does look nice. Wish I'd known of it earlie

[ANN] suchwow: a grab-bag library with some twists

2015-07-11 Thread Brian Marick
https://github.com/marick/suchwow Partly this is yet another collection of useful functions, but it has grown some unusual features: * I am a bear of very little brain. As such, the official Clojure doc strings are sometimes unclear to me. When that happens, I add new doc strings to `such.be

Re: Looking for library to annotate structures with grammar descriptions

2015-07-07 Thread Brian Marick
Aaron Cohen wrote: Have you looked at: clojure.walk ? clojure.zip ? Yes - I use zippers heavily in midje. Futzing with metadata is awkward, so I was hoping for something more specialized. (Sorry for the delayed reply.) -- You received this message because you are subscribed to the Google

Looking for library to annotate structures with grammar descriptions

2015-06-25 Thread Brian Marick
Suppose we have a structure like this: [ :a [:a :b :c][:a [:b1 :b2] :c ] ] That is a *required* list. It consists of keywords and *paths* (nested vector like [:a :b :c] above). A path consists of keywords and *alternates* (a twice-nested vector like [:b1 :b2]) above. It's easy

Re: Clojure needs a web framework with more momentum

2015-05-03 Thread Brian Marick
Sven Richter wrote: For the rest I agree with what is mostly said here, the beauty of clojure lies in the nature of small composable building blocks and the same goes for frameworks, so, basically it's all there, one just has to put it together. If composable building blocks are superior to f

Re: Meaning of part of the doc string for `ns-resolve`

2015-04-24 Thread Brian Marick
Nicola Mometto wrote: It's talking about fully qualified symbols that map to an actual var. E.g user=> (ns-resolve *ns* 'clojure.string/join) #'clojure.string/join Ah. Thank you. Ambrose Bonnaire-Sergeant wrote: > Could you clarify why you expect that? > > Thanks, > Ambrose > Because "the

Meaning of part of the doc string for `ns-resolve`

2015-04-23 Thread Brian Marick
The last sentence of the `ns-resolve` documentation reads: Note that if the symbol is fully qualified, the var/Class to which it resolves need not be present in the namespace. What does that mean? I would expect something like the following to produce a non-nil value: user=> (ns-res

Re: Clojure Culture Question on TDD

2015-03-27 Thread Brian Marick
Sebastian Bensusan wrote: What is TDD culture in Clojure like? There are many ways to design a program, just as there are many ways to write a textbook. In both cases, the right way depends on the subject matter, but also on the personality and habits of mind of the writer(s). This is not a

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-06 Thread Brian Marick
Akos Gyimesi wrote: every function call has a corresponding mock call in the test, so whenever you modify the implementation (without even changing the top-level result) you have to modify the tests as well, and vica-versa. I once encountered a codebase that had thousands of lines of such "tests"

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-06 Thread Brian Marick
Akos Gyimesi wrote: Now, later that day I decide that I pass the whole user object to the check-pw function. Maybe I want to use the user ID as a salt, or maybe I just want to leave the possibility for checking password expiration, etc. So I modify the test and the implementation of check-pw so

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-04 Thread Brian Marick
Timothy Baldridge wrote: Stuff like with-redefs and providing muck with a developer's mental model of the source code. So instead of being able to say "well foo calls baz here, so this should work". They have to think "well foo calls baz unless someone re-deffs it, in which case I haven't a clue

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-04 Thread Brian Marick
Timothy Baldridge wrote: I assert that a simpler library, something that only provides deftest, assert and run-tests forces developers to think about the best way to test something, and to write their own macros (as patterns emerge) A not-unreasonable idea. Midje supports that by also running

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-02 Thread Brian Marick
Timothy Baldridge wrote: I don't recommend Midje at all. Many of the framework's mocking facilities (such as providing) are abominations. Hacker News notwithstanding, "idiosyncratic interface" is not a synonym for abomination. It may look cute, but I've lost countless hours to bugs and un

Re: How to handle refactoring with TDD and mocking/stubbing

2015-01-02 Thread Brian Marick
I use TDD and mocking/stubbing (conjure) to test each layer of my code. The problem is when I change the function signature and the tests do not break, because the mocks/stubs do not know when their argument lists no longer agree with the underlying function they are mocking. Is there a way to

Re: Bug? with-redefs fails on functions with primitive type hints

2014-11-28 Thread Brian Marick
Sean Corfield wrote: If you're mocking a function that is specifically declared to take a long (primitive), shouldn't the mocked call also be declared to take a long? Midje has an idea called a "metaconstant" https://github.com/marick/Midje/wiki/Metaconstants. Metaconstants are used to docu

Bug? with-redefs fails on functions with primitive type hints

2014-11-28 Thread Brian Marick
A Midje user reports a bug that is actually a Clojure behavior. Does it count as a bug? Consider the following: (defn test-fn [^long x] x); Note hint (defn do-something [x] (test-fn x)) (with-redefs [test-fn (fn [x] (prn :x x) x)] (do-something "non-int")) In Clo

Re: testing platform , midje or specjl ?

2014-11-15 Thread Brian Marick
On Nov 15, 2014, at 3:52 PM, Colin Yates wrote: > For example, in the early days I was particularly susceptible to writing > functions which did too much and called too many other functions. With Midje, > mocking these other functions was trivial, on hindsight a bit more pain would > have bee

Re: On Testing

2014-11-01 Thread Brian Marick
On Nov 1, 2014, at 1:58 PM, Alex Miller wrote: > It would be great if someone could enumerate more explicitly what "better" > test output means. What are the specific problems in the current test output > reporting? If there's any sort of consensus about test reporting, specifically how diff

Re: midje test : Can I only run 1 test

2014-10-27 Thread Brian Marick
On Oct 22, 2014, at 9:59 AM, Tobias Kortkamp wrote: > Yes, you can tag your facts, and then only run the facts with a specific tag. > See https://github.com/marick/Midje/wiki/Lein-midje under the :filter section. See also: https://github.com/marick/Midje/wiki/Using-metadata-to-filter-facts --

Re: testing platform , midje or specjl ?

2014-10-26 Thread Brian Marick
On Oct 26, 2014, at 12:51 PM, Roelof Wobben wrote: > Can I better learn midje and it this one still active maintained or can I > better learn specjl. I've fallen behind on Midje maintenance (and, indeed, many things other than work). I'm gradually ramping up again with ideas gained in a year

Re: "lein midje :autotest" problem - fast re-init?

2014-09-28 Thread Brian Marick
On Sep 28, 2014, at 9:57 AM, Steve Ford wrote: > Any suggestions besides killing and restarting "lein midje :autotest" from > time to time? (To be avoided given the long delay starting it.) You can use Stuart Sierra's workflow: description: http://thinkrelevance.com/blog/2013/06/04/clojure-wor

Re: 56 second GC on Heroku - seems a bit long

2014-06-17 Thread Brian Marick
On Jun 16, 2014, at 2:57 PM, Daniel Compton wrote: > You didn't mention whether this was on the free tier or a paid dyno. I would > expect the paid dynos to not be as heavily provisioned and could possibly > alleviate this. Paid. (And using 2X dynos didn't seem to make a difference.) --

Re: 56 second GC on Heroku - seems a bit long

2014-06-16 Thread Brian Marick
On Jun 16, 2014, at 1:19 PM, Timothy Baldridge wrote: > The rules for debugging this sort of thing are always 1) assume nothing. Yes, but. The plural of anecdote is data*. If there are five responses saying "we run Clojure on Heroku [or a Heroku-like environment], didn't tune GC, and we've ne

56 second GC on Heroku - seems a bit long

2014-06-16 Thread Brian Marick
We have a small Clojure app on Heroku that performs backend tasks for a Rails app. Low traffic (like a request a minute). Heap is 400M. We've been having long (10 sec) GC pauses using both the default and G1 GC (both untuned). Browsing our logs today, I found: [GC pause (young) 156M->36M(

Re: Defining test cases at runtime

2014-02-19 Thread Brian Marick
On Feb 19, 2014, at 1:14 PM, John Wiseman wrote: > Or the equivalent using midje instead of clojure.test > I realize the difference between the two seems small, but conceptually the > latter does more closely match what I'm doing and generates slightly more > useful output (failure names, test

Re: Lessons Learned from Adopting Clojure

2014-02-04 Thread Brian Marick
On Feb 4, 2014, at 6:06 AM, Jay Fields wrote: > - REPL driven development, putting TDD's 'rapid feedback' to shame. Pity I'll miss this, but I only come up to Chicago W-F. What I've found is that having autotest in the REPL dissolves most conflict between TDD and REPL-driven development. Or

Re: Coverage tools in Clojure

2014-02-04 Thread Brian Marick
On Feb 4, 2014, at 11:20 AM, Aaron France wrote: >> If you thoroughly test all your code when you write it why do you need a >> tool to tell you you missed something? > > This is just so brain-dead stupid. > > How do you *know* that you thoroughly tested your code? Where do you > get these me

[ANN] Midje 1.6

2014-01-12 Thread Brian Marick
Midje is a unit testing library that (some people think) provides more readable tests than test.unit. It has good support for treating programs as networks of functions that depend on each other (mocking, in OO terms). It allows gradual migration from test.unit. Version 1.6.0 has been out for a

Re: Reactive Patterns with Atoms - am I using too much state?

2013-11-30 Thread Brian Marick
On Nov 30, 2013, at 10:39 AM, Sam Ritchie wrote: > Brian, I like that too. It looks like you're providing the state when you do > the def-action? If I understand the question right, yes. A test of a state function would look like: (fact (incrementer {:value 1} 3) => {:value 4})) > Is the

Re: Reactive Patterns with Atoms - am I using too much state?

2013-11-29 Thread Brian Marick
On Nov 29, 2013, at 11:58 AM, Sam Ritchie wrote: > 2) a defstatefn macro that defines the "mark" and "mark!" versions at the > same time. I do that with agents: (def-action text :send [state number message]) … creates a `text*` and a `text>!`, where `test>!` is (defn text>! [number message]

Re: Can we please deprecate the :use directive ?

2013-08-05 Thread Brian Marick
I find that having both `:use` and `:require` in my `ns` declarations can, with a little judicious formatting, communicate something about which packages are core and which are peripheral. Having to obfuscate that distinction with a `:refer :all` tacked - in a visually obscure way - onto `:requi

Re: Emitting a proper line numbers in code generated by macro

2013-08-01 Thread Brian Marick
On Jul 31, 2013, at 6:45 AM, Dmitry Groshev wrote: > > Is there any proper way to preserve line numbers in stack traces with code > generation? Midje goes to some effort to do this. It's not incredibly easy. src/midje/parsing/util/file_position.clj has the bulk of the code, but it's probabl

Re: test run startup time

2013-07-10 Thread Brian Marick
On Jul 10, 2013, at 12:36 PM, Brian Craft wrote: > The clojure start-up time is killing me, while working in a tight > edit-test-edit development loop. Is there any way to speed this up? I use autotest in a running repl. A screenshot and description about 2/3 of the way down this: https://g

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

2013-06-11 Thread Brian Marick
On Jun 11, 2013, at 2:08 PM, Tj Gabbour wrote: > Interesting; these arguments sound oddly like those surrounding Common Lisp's > "loop" macro. When reading Midje's docs, I got the weird impression Brian was > aware of the history of "non-lispy" macros. I was a Common Lisp user and implementor

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

2013-06-11 Thread Brian Marick
On Jun 11, 2013, at 10:02 AM, JeremyS wrote: > Now, opinion time (more opinionated actually). Midje might be full of macros > and abstractions that I don't understand when I read the code. Hell it's full > of them. But I honestly never had to read it to write my tests. More It's > well docume

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: [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: [pre-ANN] test2, the last Clojure testing framework

2013-06-09 Thread Brian Marick
On Jun 9, 2013, at 1:07 PM, Steven Degutis wrote: > I think we all agree that it's extremely important to discuss the SPEC as a > community. In fact, since this is a pre-ANN, let's consider this thread the > perfect place for such a discussion. I suggest that surveying users of the various exi

Re: Making things go faster

2013-06-05 Thread Brian Marick
On Jun 4, 2013, at 11:16 PM, Kevin Downey wrote: > midje makes each test a top level form, so test runs happen as a side effect > of code loading, which means you cannot really run tests in a good way from > the repl without doing some kind of ridiculous forced code reloading. I would > defin

Re: Making things go faster

2013-06-05 Thread Brian Marick
On Jun 4, 2013, at 11:16 PM, Kevin Downey wrote: > midje makes each test a top level form, so test runs happen as a side effect > of code loading, which means you cannot really run tests in a good way from > the repl without doing some kind of ridiculous forced code reloading. I would > defin

Re: Making things go faster

2013-06-05 Thread Brian Marick
On Jun 4, 2013, at 3:51 PM, David Pollak wrote: > * Is there a faster cycle than to change code, change tests and type "lein > test" to see the results? I use Midje in a repl. That looks like this: % lein repl (use 'midje.repl) (autotest) When I save a source or test file, the relevant

Re: Using lein profiles to change details of project

2013-05-29 Thread Brian Marick
On May 29, 2013, at 5:20 AM, phillip.l...@newcastle.ac.uk (Phillip Lord) wrote: > While I understand how to set up a new profile, I can't see whether I > can access the project map that I am using within the project so that I > can see up conditional logic --- like "ignore this test if I am my >

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-27 Thread Brian Marick
On May 27, 2013, at 1:38 PM, Armando Blancas wrote: >> It's fun to make use of esoterica like `seq`'s behavior with an empty list. >> Back in the early days, it was necessary. [2 examples] >> >> But, for the rest of us, the necessity has drained out of that kind of >> esoterica. > > I don't

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-27 Thread Brian Marick
On May 26, 2013, at 5:47 AM, "Alex L." wrote: > First, the use of seq as a > terminating condition is the idiomatic way to test whether a sequence is > empty. In natural languages, idioms change. Sometimes it's to the despair of purists: for example, I've had to accept that "hopefully" at the

Re: Utility libraries and dependency hygiene

2013-05-15 Thread Brian Marick
On May 15, 2013, at 8:28 AM, Dave Kincaid wrote: > One that I encountered last week was Midje. In trying to work through all of > its dependencies I discovered that Pomegranate is also dependent on Maven, > but I think I was able to work around that by adding 4 or 5 Maven libraries > into our

Re: Clojure on top of ObjC?

2013-04-24 Thread Brian Marick
On Apr 24, 2013, at 12:02 AM, Steven Degutis wrote: > Unfortunately, it's impractical to write the majority of a Mac or iOS app > using anything other than Xcode + ObjC, especially the UI. So the goal of > this endeavor would mainly be to write command line utilities in Clojure or > embed scr

Re: Test strategy

2013-04-22 Thread Brian Marick
On Apr 22, 2013, at 7:55 PM, Jonathon McKitrick wrote: > I guess the challenge is that the parsing and generating of the structures > from JSON descends to several layers of functions, and the database object is > created and inserted/updated at the lowest level. I've tried a bulk insert > a

Re: Good Clojure style?

2013-04-13 Thread Brian Marick
On Apr 12, 2013, at 1:18 PM, Softaddicts wrote: > The average career length of a programmer is 8 years in the US (2003 survey) > and > the main reason invoked by those that left is their perceived lack of > productivity. TL;DR: Opinions about unproductive older programmers is ahead of the sc

Re: Names and clojure.core

2013-03-28 Thread Brian Marick
On Mar 28, 2013, at 8:51 AM, Mark wrote: > In the course of writing about 30 lines of code last night, I accidentally > caused name collisions with two or three other existing functions in > clojure.core. Do other people have this problem? Am I just too uncreative? Am > I being too terse? Ol

Re: question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Brian Marick
On Mar 21, 2013, at 2:30 PM, Brian Marick wrote: > If you don't mind brackets Or, if you do mind brackets: user=> (str (apply list (map inc [1 2 3]))) "(2 3 4)" I'll stop now. Looking for employment as a Clojure programmer Latest book: /Functional

Re: question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Brian Marick
On Mar 21, 2013, at 2:20 PM, Brian Marick wrote: > I don't know if it's elegant, but: > > user=> (str (list* (map + [1 2 3]))) > "(1 2 3)" I wrote too soon. `list*` returns a lazy sequence, not a list, so I guess you shouldn't rely on it. If you don&#x

Re: question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Brian Marick
On Mar 21, 2013, at 1:54 PM, Razvan Rotaru wrote: > I'm curious, why doesn't toString of clojure.lang.LazySeq return the entire > sequence as a String, and returns the Java pointer instead? I don't know, but perhaps it's to avoid problems with infinite sequences? (Although it's interesting th

Re: Midje 1.5 released

2013-03-19 Thread Brian Marick
On Mar 19, 2013, at 7:19 AM, Murtaza Husain wrote: > Brain I would also like to use it to test my cljs code, is that possible ? If https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure is up to date, it would be moderately hard and tedious to port Midje to Clojurescript. D

Re: conflict using midje repl-tools

2013-03-19 Thread Brian Marick
On Mar 19, 2013, at 8:47 AM, Murtaza Husain wrote: > I am having trouble using midje repl-tools. I am using the facts intermingled > in my source code. Can you give a transcript of the failure? I can't reproduce the problem. I have a project with this source: > (ns scratch.core > (:use scr

Midje 1.5 released

2013-03-18 Thread Brian Marick
Midje is a test framework for Clojure that aims to be more readable than clojure.test and to allow styles of testing that clojure.test does not. 1.5 is the Enterprise Edition and Respect the Repl Release. Enterprise (integration with build servers) * Configuration files * Tests can be selected

New midje tutorial (and sales pitch) for clojure.test users

2013-03-01 Thread Brian Marick
Midje is a competitor to clojure.test. Version 1.5 has just entered the release candidate pipeline. It's a big release, and makes a big jump toward what's long been a goal of mine: "working with ease": http://www.exampler.com/ease-and-joy.html http://www.youtube.com/watch?v=0U0cfejYMOI In partic

Re: What is the difference between *source-path* and *file*?

2013-02-19 Thread Brian Marick
Duh. I'd managed to confuse myself. Sorry for the noise. (*file*: "t_core.clj"; *source-path*: "scratch/t_core.clj") Looking for employment as a Clojure programmer Latest book: /Functional Programming for the Object-Oriented Programmer/ https://leanpub.com/fp-oo -- -- You received thi

What is the difference between *source-path* and *file*?

2013-02-19 Thread Brian Marick
By the way, the doc string for `*file*` is wrong: > clojure.core/*file* > The path of the file being evaluated, as a String. > > Evaluates to nil when there is no file, eg. in the REPL. > It actually evaluates to "NO_SOURCE_PATH" Looking for employment as a Clojure programmer Late

Re: with-redefs for vars in a different namespace for tests (midje facts)

2013-02-18 Thread Brian Marick
On Feb 17, 2013, at 8:49 PM, Leonardo Borges wrote: > My theory behind why this works is that when I reload the cache > namespace it recompiles it - and at that point, the new var binding is > available. > > Is this the case? More importantly, is this how I should be doing this? Yes. If you l

Re: `let` to automatically add metadata / fn names?

2013-02-08 Thread Brian Marick
On Feb 8, 2013, at 7:56 PM, Daniel Glauser wrote: > > This sounds like a great idea. I was working with some tests today and it > would have been really useful to have some way to query the current > function/execution context. Seems like passing that through all lets would go > a long way,

Re: What compiles into a method body?

2013-02-04 Thread Brian Marick
> I checked out midje and tried macroexpanding the test that's giving you > problems: it expands to 140KB of Clojure source! The culprit is indeed the > creation of your metadata maps: the :midje/body-source and :midje/source keys > are each around 40KB literals. You are my hero. Somehow the :

What compiles into a method body?

2013-02-04 Thread Brian Marick
An individual Midje "fact" (test case, roughly) macroexpands into a form like this: (record-fact-existence! (letfn [(fun1 [] ...test code is here...) (fun2 [] (with-meta fun1 {...metadata...}))] (fun2)) Tabular facts in Midje are done via unification. A table with

Re: Hooking into doc and source

2013-01-31 Thread Brian Marick
On Jan 31, 2013, at 5:50 AM, Phillip Lord wrote: > So, I really would like to hook into the doc function so that I can > return a documentation string pulled directly from the underlying Java > object; I already have a function for doing this, but do not know how to > get the native Clojure facil

Re: clojure.test are macro

2013-01-28 Thread Brian Marick
On Jan 28, 2013, at 11:13 AM, Sean Corfield wrote: > In other words, don't use the same names for variables in your code > under test that you use for the placeholder variables in the `are` > binding and the test expressions. It might be a good practice to distinguish the roles via a naming con

Re: What people want from Clojure error messages

2013-01-24 Thread Brian Marick
I've also noticed that the messages that come from botched macroexpansions are often not useful in that they contain no clues about the original source, and sometimes not even a useful reference to the original namespace. I have a similar problem in Midje. When a macroexpansion blows up, I catch

Re: What people want from Clojure error messages

2013-01-24 Thread Brian Marick
A typo in an identifier should not lead to the following. Although I understand that `lein repl` trims stack traces, that should be the default, rather than having every substantial user-facing program trim `clojure.lang.Compiler` (etc.) messages for the sake of its users. > Exception in threa

Re: Clojure Literature

2013-01-18 Thread Brian Marick
On Jan 18, 2013, at 8:46 AM, Reginald Choudari wrote: > I am looking for a new Clojure book to get me started on the language. Here's a beginning Clojure reading list, with some discussion: http://regretful.ly/clojure/2013/01/16/beginning-clojure-reading-list/ Occasional consulting

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Brian Marick
On Jan 6, 2013, at 3:34 PM, Sean Corfield wrote: > Here's what I use to pull symbols from Enlive into FW/1: Midje plays similar tricks to make namespace abilities available via one `use`. Which makes me think: 1: In the old patterns world, there was a "rule of three" which claimed that som

Re: Creating a dynamic var

2013-01-03 Thread Brian Marick
On Jan 3, 2013, at 12:12 PM, Timothy Baldridge wrote: > If you need to change a var to be dynamic, you can set it manually with > .setDynamic. Perhaps `.setDynamic` should be promoted to be a clojure function? I kind of wish I didn't have subject-to-change method calls like .setDynamic and

Creating a dynamic var

2013-01-03 Thread Brian Marick
Why does this: (def ^{:dynamic true} bar 33) … work to create a dynamic var, but this: (intern *ns* (with-meta 'foo {:dynamic true}) 33) … doesn't? (Looking more for the justification than mechanics.) Occasional consulting on programming technique Contract programming

  1   2   3   >