Re: Why does the `def-` not exist?

2018-03-05 Thread Chris Ford
This isn't foolproof Léo, but sometimes folks use docstrings to make that distinction i.e. if it's got a docstring it's part of the public API. Codox, for example, takes this approach when deciding what to include in generated API documentation. On 4 March 2018 at 12:50, Léo Noel

Re: Decomplecting Clojure

2015-08-13 Thread Chris Ford
I enjoyed the post. It's easy for those of us who've been in the community for a while to take such things for granted and not properly explain them to new folks. One suggestion - perhaps concurrency and immutability each deserve their own section? That wouldd give you a chance to dig deeper into

Re: Does function core.async/poll! work?

2015-03-23 Thread Chris Ford
If you look on the core.async Github page https://github.com/clojure/core.async, it describes this as what you need to pull the latest alpha into your project.clj: [org.clojure/clojure 1.6.0] [org.clojure/core.async 0.1.346.0-17112a-alpha] There's also a link to a list of other versions on

Re: Deterministic macro expansion for Clojure?

2015-03-23 Thread Chris Ford
I think it's useful to think of macros as an odd form of I/O. Just as you would separate out your templating from your domain functions, separate out your defmacro from regular functions that just happen to manipulate symbols. These functions will be easier to test. On 23 March 2015 at 16:23,

Re: [GSoC] Typed Overtone proposal

2015-03-21 Thread Chris Ford
That sounds a cool idea. One interesting challenge will be how specific you can make the types of things like unit generators, which can be used in very different ways e.g. low frequency for vibrato, high frequency for tones themselves. On 21 March 2015 at 17:14, Ambrose Bonnaire-Sergeant

Re: Typed Clojure paper draft

2015-03-14 Thread Chris Ford
function with the current dispatch value to learn new types via normal occurrence typing is almost always sufficient to type check the current defmethod body. Thanks for the feedback. Ambrose On Fri, Mar 13, 2015 at 5:20 PM, Chris Ford christophertf...@gmail.com wrote: I like the paper

Re: Typed Clojure paper draft

2015-03-13 Thread Chris Ford
I like the paper. One small piece of feedback - I didn't understand what about the multimethods section justifies the claim of surprising synergy in the introduction. Perhaps you could elaborate on the novelty? Chris El 12/03/2015 02:50, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com

Re: Extending the LispReader with embeded language lorms

2015-02-11 Thread Chris Ford
As an example of pushing data into an external DSL you could check out John Cowie's Scenic wrapper for Bidi - https://github.com/johncowie/scenic. Note that Scenic loads data from the external file at _compile_ time - so it comes closer to being like embedding a DSL in Clojure source and less

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia giba@gmail.com wrote: Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
#toro_tokens_rest.components.database.Database{:path /tmp/dev-leveldb}, :jetty-server nil} So, I bet I'm doing something wrong. On Tue, Feb 10, 2015 at 9:45 AM, Chris Ford christophertf...@gmail.com wrote: Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto

Re: Modelling in Clojure

2014-10-18 Thread Chris Ford
James might be too modest to mention this as an exemplar as he's the maintainer, but for me, Ring https://github.com/ring-clojure/ring is a great example of the success of data-as-API. HTTP requests are represented as a nested map with well-known keys, and middleware works with these fields or

Re: Code health metrics

2014-07-02 Thread Chris Ford
A little more context on what I'm considering. I work in a team of about 10 developers on a Clojure project. In the larger enterprise there are mainly Java applications. I'm interested in a way to visualise which parts of the codebase are getting sticky and might require intervention. As well as

Code health metrics

2014-07-01 Thread Chris Ford
Hi all, Are there any good tools for measuring the health of a Clojure codebase? What is even useful to measure for Clojure? Afferent/efferent coupling, cyclomatic complexity and unit test coverage are metrics I would use for Java, but do they apply equally to Clojure? I'm aware of Clique

Re: Hello, here´s a new clojur adict... with a question.

2014-01-14 Thread Chris Ford
Unless you are worrying about concurrency, you probably don't need an atom at all: (def sx2 [2 3 4]) (println (sx2 1)) On 14 January 2014 14:45, Andreas Olsson photoguy@gmail.com wrote: Okay,.. ..learning one step at a time hear. =) I´m good at basic.. this is some thing else. Den

Re: what does defserverfn mean?

2013-10-10 Thread Chris Ford
Hi, Clojure allows the creation of macros, which means that developers can define new things that look like the keywords from other languages. For example, even defn is just a macro that builds on top of the underlying def and fn forms. I expect that the Twitter storm team have a macro called

Re: Help to morph this imperative snippet into a functional one

2013-08-18 Thread Chris Ford
Can you explain what the code is supposed to do in English? Java is a little hard to read. :-) Are you doing Huffman coding or similar? On 18 August 2013 16:51, Hussein B. hubaghd...@gmail.com wrote: Hi! Would you please help me transforming this imperative code into functional one? The

Re: Help to morph this imperative snippet into a functional one

2013-08-18 Thread Chris Ford
written in an imperative style that I'm trying to transfer into a functional one. The amount of mutation and the if statements are blocking me from doing it in Clojure. On Sunday, August 18, 2013 4:27:43 PM UTC+2, Chris Ford wrote: Can you explain what the code is supposed to do in English

Re: Help to morph this imperative snippet into a functional one

2013-08-18 Thread Chris Ford
bar 8)) On 18 August 2013 18:03, Chris Ford christophertf...@gmail.com wrote: This is close, though it only permits values at leaves and stores the values in the reverse order. Depending on what you need, this might be sufficient: (defn insert [container letters value] (update-in container

Re: Do you like the Clojure syntax?

2013-08-14 Thread Chris Ford
Two obviously. It's the only compromise between those who want everything to be a prime number, and those who want everything to be a power of two. On 14 August 2013 18:48, Phillip Lord phillip.l...@newcastle.ac.uk wrote: Răzvan Rotaru razvan.rot...@gmail.com writes: Statistics. I want to

Re: trying out overtone, leipzip, chris-ford's functional composition code

2013-08-04 Thread Chris Ford
. At LambdaJam I saw Chris Ford give a great demo of functional composition [music]. I want to show my 16-yo the same code working, since he's really doing well with Racket (and Gregor Kiczales' MOOC via UBC) and loving it, and he loves music and music composition too. Chris Ford posted his code here

Re: trying out overtone, leipzip, chris-ford's functional composition code

2013-08-04 Thread Chris Ford
Ooops. Try this instead: (use 'goldberg.variations.canone-alla-quarta) On 4 August 2013 17:57, Geoffrey Knauth ge...@knauth.org wrote: On Sunday, August 4, 2013 9:06:35 AM UTC-5, Chris Ford wrote: Thanks for taking an interest. :-) Of course, Chris. Your stuff is fantastic. I can't

Re: the snake game with core.async and swing

2013-08-03 Thread Chris Ford
Cool! If you want to make the Swing stuff more idiomatic, you could take a look at Seesaw https://github.com/daveray/seesaw. On 2 August 2013 17:11, eliassona...@yahoo.com wrote: Below is a little (stupid) snake game I wrote using core.async and swing. It uses channels for timer, keyboard

Re: Pair programming session on EuroClojure Conference

2013-07-28 Thread Chris Ford
Seniority is relative. All you need to be able to teach someone is maybe a year's more experience than them. If you had the time to dedicate to this idea, some kind of structured jam could be useful. At LambdaJam this month, each afternoon we had a puzzle of some kind (spelling correction etc) to

Re: How to set up a Clojure nREPL using Vim Fireplace

2013-07-28 Thread Chris Ford
If you don't regularly use vim, and you want a pre-canned Clojure setup, you can try https://github.com/ctford/vim-fireplace-easy, which is a project of Dave Ray's I updated for Fireplace. Cheers, Chris On 28 July 2013 22:29, Joe Cooljure clooj...@gmail.com wrote: One of the cool things

Re: anaphoric macro?

2013-07-23 Thread Chris Ford
I use a similar macro in my music codehttps://github.com/ctford/leipzig/blob/master/src/leipzig/scale.clj, because I want to take a sequence and explicitly give parts of it names. (defmacro defs [names docstring values] `(do ~@(map (fn [name value] `(def ~name ~docstring ~value))

Re: Domain modelling question

2013-07-06 Thread Chris Ford
I find the modelling Clojure data structures very similar to working out what your aggregates roots are for domain-driven design or using a document data store. I would suggest avoiding using refs in a customer map. In this case, it sounds like customer is your natural aggregate root, so you

Re: I need a configuration solution

2013-06-17 Thread Chris Ford
Hi Mingqi, Could you please give us some more context? What kind of configuration are you trying to manage? Cheers, Chris On 17 June 2013 10:45, Mingqi mingqi.s...@gmail.com wrote: I need a configuration solution -- -- You received this message because you are subscribed to the Google

Re: In what OS do you code?

2013-06-17 Thread Chris Ford
Robert, the Leiningen survey might under-report Windows-based usage of Clojure, as I think Eclipse+Counter-clockwise is especially popular there. On 17 June 2013 02:03, Robert Levy r.p.l...@gmail.com wrote: There's the State of Clojure Survey:

Re: Data vs API

2013-06-12 Thread Chris Ford
Antonio, I think he means that the onus is on the consumer of an API to make a sensible decision about what they depend on. Consumers could choose to depend on implementation details rather than provided abstractions. When they do so, they need to accept the burden of adapting should those

Re: Defining the ground truth

2013-05-23 Thread Chris Ford
On every project I've ever worked on, specs were ephemera, falling out of date almost immediately despite occasional herculean efforts to keep them up-to-date. Personally, the best answer I've found to the spec/code dilemma to be automated tests, as they evolve along with the code and fail if

Re: How to: reduce boolean operations?

2013-05-22 Thread Chris Ford
The reason and is a macro is that it's designed to short-circuit - ie if the first result is false the rest shouldn't even be evaluated. Using it on raw booleans works, because booleans evaluate to themselves, but it's really designed to be given forms. The absence of a pure function for

Re: ritz-nrepl starts up slowly?

2013-05-14 Thread Chris Ford
You could try lein -o to make sure that your startup isn't blocking on network. On 14 May 2013 01:50, yizhen wei yizhenwe...@gmail.com wrote: I heard using a sdd can reduce the time a lot. Maybe 5x? Can someone confirm on that? On Monday, May 13, 2013 6:17:38 PM UTC-4, Warren Lynn wrote:

Re: Meta-eX: Hacking Overtone on the Stubnitz - Thurs 16th May

2013-05-14 Thread Chris Ford
Wish I could be there... On 14 May 2013 15:45, BERYANN PARKER beryann.par...@gmail.com wrote: Hi Sam, thanks for the link, good project and good ! I like very much your philosophy: The source code is our instrument and we play it live i follow it now! Cheers! Beryann Le lundi 13 mai

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Chris Ford
Sounds to me like there's enough meat in this topic for someone to consider submitting a talk to the upcoming EuroClojure http://euroclojure.com/2013/ or Clojure/conj http://clojure-conj.org/ on what Clojure means for DI. It's a commonly asked question, and it could be an opportunity for The

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

2013-05-11 Thread Chris Ford
IMHO it's a bit subjective, but empty? is defined as (not (seq coll)), so using (not (empty? coll)) is really saying (not (not (seq coll))), which feels a bit backwards. Using seq also plays nicely with if-let: (if-let [foo (seq hey)] (print foo)) (if-let [foo (seq )] (print foo)) Chris On 11

Re: Not using dependency injection - how do I share services around?

2013-05-10 Thread Chris Ford
A good question. One way is to use partial application to bake the data source into a fn: (def read (partial read-from-db *data-source*)) On 10 May 2013 14:04, Colin Yates colin.ya...@gmail.com wrote: (newbie, getting better each day!) I assume we all know DI. Through the use of a central

Re: memorize-clj

2013-04-29 Thread Chris Ford
Jorge, reinventing the wheel is a very worthwhile pursuit. Maybe you'll come up with something new, and certainly you'll learn something. Thanks for sharing. Chris On 29 April 2013 08:23, Baishampayan Ghose b.gh...@gmail.com wrote: One more reason to read Clojure's source code. Trust me,

Re: Test strategy

2013-04-19 Thread Chris Ford
I'm a little unclear as to what your specific challenge is. I understand you're trying to test fns that take a map produced by the JSON parser, and extract specific fields. Would it be sufficient to just create literal maps to fake the output of the JSON parser, use those as inputs to your

Re: Trying to understand Java better to understand Clojure better

2013-03-14 Thread Chris Ford
You could also consider visually breaking up Java code that is across multiple files. You've got // Contents of: comments, but a break in the grey background would also be helpful. Nice post. The world needs more people willing to explain basic concepts in a clear, un-patronising way. Cheers,

Re: What's the point of - ?

2013-03-11 Thread Chris Ford
I wouldn't say imperative, rather pipelined. - can be used to represent a deeply nested expression as a pipeline. On 11 March 2013 13:58, edw...@kenworthy.info wrote: So I understand that: (- foo bar wibble) is equivalent to (wibble (bar (foo))) With the advantage that the latter

Re: (def function* ... ???

2013-02-28 Thread Chris Ford
Sometimes people separate a macro into the macro itself, and a normal function that does the actual work. The normal function often has the same name as the macro but with a * suffix. Chris On 28 February 2013 13:38, Dave Sann daves...@gmail.com wrote: I see cases of * after function names.

Re: wouldn't it make sense for identity to take variadic args?

2013-02-27 Thread Chris Ford
Can you give an example use case? Personally, I would be a little surprised to find out that identity worked like this. After all, why return the first argument, why not the last? Or a vector of all the arguments? Cheers, Chris On 27 February 2013 15:02, Jim foo.bar jimpil1...@gmail.com wrote:

Re: Clojure Position

2013-02-12 Thread Chris Ford
Murtaza, I'm guessing you probably didn't want to send us all your resume... Cheers, Chris On 13 February 2013 09:57, Murtaza Husain murtaza.hus...@sevenolives.comwrote: Alex are you still looking for clojure developers. I am attaching my resume. On Saturday, June 16, 2012 11:44:41 PM

Re: Clojure - Python Style suggestion

2013-02-06 Thread Chris Ford
If someone does write a Lisp with significant whitespace, can we please call it Whitespathe? On 7 February 2013 10:30, Marco Munizaga drchoc...@gmail.com wrote: We had this talk with scheme. They called it I expressions. Here is the link http://srfi.schemers.org/srfi-49/srfi-49.html Do it

Re: [ANN] Overtone 0.8.0 - Performance Ready

2013-01-27 Thread Chris Ford
Thanks to everyone who worked hard to make 0.8.0 happen, especially Sam. :-) On 27 January 2013 02:00, Sam Aaron samaa...@gmail.com wrote: On 26 Jan 2013, at 20:17, Sam Aaron samaa...@gmail.com wrote: I pulled out the GUI widgets from this release as I found a number of issues with them at

Re: clojure.string/capitalize API

2012-12-12 Thread Chris Ford
This seems like quite a specialised function to have in a core string library. To me, the only behaviour that would be generic enough to include in a core library would be to capitalise all the letters of the string. On 12 December 2012 17:12, Pierre Allix pierre.allix.w...@gmail.com wrote:

Re: help choosing dev environment for clojure

2012-11-27 Thread Chris Ford
When considering the availability of a debugger, keep in mind that your workflow might be different when you code Clojure compared to how you approach Java, Ruby etc. Because functions require less context to run than methods of an object, I find that experimenting at the REPL (or rather

Re: slow repl startup because of package finding

2012-11-02 Thread Chris Ford
Are you using Seesaw 1.4.1? I just upgraded to 1.4.2, which fixed the same issue with Overtone. In general, Phil Hagelberg advised me it's a result of a bad dependency somewhere. I found that this error meant that I couldn't run my project without network connectivity (unless I did lein -o).

Re: Plural dispatch

2012-09-11 Thread Chris Ford
to run clear-implementations! if one does want to forget all the implementations. On Wednesday, September 5, 2012 6:48:36 AM UTC-4, Chris Ford wrote: I was watching David Nolan's talk about predicate dispatchhttp://blip.tv/clojure/david-nolen-predicate-dispatch-5953889, and he articulated

Plural dispatch

2012-09-05 Thread Chris Ford
I was watching David Nolan's talk about predicate dispatchhttp://blip.tv/clojure/david-nolen-predicate-dispatch-5953889, and he articulated something that I've found frustrating about multimethods - the set of implementations is open, but the dispatch function is closed. That means that if your

clojure.org down

2012-08-27 Thread Chris Ford
Hi, clojure.org seems to be down. I've mailed h...@wikispaces.com. Cheers, Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be

Re: clojure.org down

2012-08-27 Thread Chris Ford
Looks like it's back up. On 27 August 2012 20:28, Chris Ford christophertf...@gmail.com wrote: Hi, clojure.org seems to be down. I've mailed h...@wikispaces.com. Cheers, Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: clojure.org down

2012-08-27 Thread Chris Ford
Adam Frey from wikispaces pinged me back. Seems like he fixed whatever the problem was. On 27 August 2012 20:42, Mayank Jain firesof...@gmail.com wrote: Working fine for me. On Tue, Aug 28, 2012 at 12:58 AM, Chris Ford christophertf...@gmail.comwrote: Hi, clojure.org seems to be down

Re: doubt about clojure.test output

2012-08-18 Thread Chris Ford
Would you be able to post some code demonstrating what you have observed, perhaps reduced to the minimal case? Cheers, Chris On 18 August 2012 13:49, Vincent vincent@gmail.com wrote: Dear , I am using clojure.test for test in one 'deftest , i had used 3 'is function to assert

Re: Attractive examples of function-generating functions

2012-08-09 Thread Chris Ford
I use quite a few of these in my Overtone rendering of Bachhttp://skillsmatter.com/podcast/home/functional-composition : ; Defining a scale function from intervals (defn sum-n [series n] (reduce + (take n series))) (defn scale [intervals] (fn [degree] (if-not (neg? degree) (sum-n

Re: [ldnclj] Re: 6 December 2012 - London - Clojure eXchange - Call for Presentations

2012-07-31 Thread Chris Ford
Will this be the best Clojure event? http://skillsmatter.com/event/clojure/haskell-exchange-2012 Chris On 31 July 2012 16:15, cassiel n...@cassiel.com wrote: Yep... my presentation proposal went in last week...

Re: Idea around SCMs and Clojure

2012-07-18 Thread Chris Ford
I really hope that refactoring-aware diffs are on their way. They'll allow for a whole class of merge conflicts to be resolved automatically. Chris On 18 July 2012 14:19, Leonardo Borges leonardoborges...@gmail.com wrote: I haven't been following this discussion that closely so far but I'd

Re: How to speed up Clojure Training for New Recruitment

2012-06-18 Thread Chris Ford
When it comes to new graduates, they'll probably latch onto Clojure just as quickly as to Java or anything else. At EuroClojure, Jon Pither and Hakan Raberg mentioned that in their mixed Java/Clojure ecosystem they train new hires on Clojure, which eventually makes them better Java programmers!

Re: How about 'nth' accepts maps?

2012-06-12 Thread Chris Ford
While it would be possible to support it, I don't think that it makes sense for maps (or sets). While first and next need to be supported to make maps and sets sequable, I don't think that conceptually the elements are ordered. Cheers, Chris On 12 June 2012 11:03, Yoshinori Kohyama

Re: How about 'nth' accepts maps?

2012-06-12 Thread Chris Ford
Meikel is quite right. I should have said that maps and sets support seq... I guess the question should then be, should nth call seq on its argument? On 12 June 2012 11:31, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Dienstag, 12. Juni 2012 12:10:08 UTC+2 schrieb Chris Ford

Re: Slow 'quick sort'

2012-06-08 Thread Chris Ford
Another advantage to choosing the first element as a pivot is that you can use destructuring: (defn qsort [[pivot coll]] (if coll) On 8 June 2012 08:44, Mark Engelberg mark.engelb...@gmail.com wrote: last and drop-last are slow operations on seqs, and no matter what you pass in for the

Re: function evaluation inside list literal

2012-05-28 Thread Chris Ford
To add to Tassilo's answer, quoting blocks evaluation all the way down. So even though I don't have the functions foo or bar defined: user= '(foo (bar)) (foo (bar)) There's no error, because neither is evaluated. Chris On 28 May 2012 18:58, Tassilo Horn tass...@member.fsf.org wrote: Maris

Re: docstrings of if-let and when-let incorrect

2012-05-16 Thread Chris Ford
Personally, I would intuitively assume that none of the bindings from if-let would be available in the else branch. On 16 May 2012 14:36, Moritz Ulrich ulrich.mor...@googlemail.com wrote: On Wed, May 16, 2012 at 3:16 PM, Aaron Cohen aa...@assonance.org wrote: What should happen on the else

Re: Clojure beginner in search of peer-induced enlightenment

2012-05-14 Thread Chris Ford
Are there any Clojure dojos near where you live? We have a monthly one in London, which is a great way for people of different experience levels to come together. Cheers, Chris On 14 May 2012 12:45, James abbott...@gmail.com wrote: When a new technology (a programming language) comes out,