{ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Hi , i am pleased to introduce defun https://github.com/killme2008/defun: a beautiful macro to define clojure functions with pattern match. Some examples: (defun say-hi ([:dennis] Hi,good morning, dennis.) ([:catty] Hi, catty, what time is it?) ([:green] Hi,green, what a good day!)

Productivity tip for code transformations with cider

2014-09-14 Thread Stathis Sideris
Hello all, There is some functionality in cider (C-c C-w) that can potentially save you a lot of typing when transforming Clojure code and I haven't seen many people using it, so I made a screencast to demonstrate: http://www.youtube.com/watch?v=LXhWW1Yqpt0 Hopefully you'll find it useful.

Re: ANN: Potemkin 0.3.0

2014-09-14 Thread Dave Sann
Does Potemkin work well with clojurescript? I have seen some discussion of issues in some places. Is there anywhere that notes challenges? I am particularly interested with the import-vars scenario (defining namespaces separately and then merging definitions into one namespace for usage).

Why You Should NOT Implement Layered Architecture

2014-09-14 Thread François Rey
Here is a link to an article which makes me think more people are seeing the light on the java side: http://java.dzone.com/articles/why-you-should-not-implement It's a nice illustrative demonstration that might be handy if you're looking for arguments for those left behind in

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Released 0.1.0-RC, defun collect :arglists metadata, another recursive function example: (defun accum ([0 ret] ret) ([n ret] (recur (dec n) (+ n ret))) ([n] (recur n 0))) (accum 100) ;; the result is 5050 2014-09-14 14:46 GMT+08:00 dennis zhuang killme2...@gmail.com:

Re: Designing API for a Markov Model

2014-09-14 Thread Jony Hudson
It's nice if the function returns the same sort of data as it consumes, because then it's easy to repeat it with `iterate` or `reduce`. So, if you take your first example, then you could write: (take 100 (iterate (partial progress-state markov-model) initial-state)) to get the next 100

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread adrian . medina
Friendly advice: when you describe anything you create with adjectives like beautiful, it comes off as unnecessarily arrogant to native English speakers. Adrian On Sunday, September 14, 2014 2:47:28 AM UTC-4, dennis wrote: Hi , i am pleased to introduce defun

Re: Designing API for a Markov Model

2014-09-14 Thread RJ Nowling
Thanks for the response! You make a really good point about the first interface -- makes it easy to use with the built in functions. The only things that really define the process is the model (a transition matrix) and the current state. The model doesn't change but the current state does. The

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread Herwig Hochleitner
Hi Dennis, marrying core.match to defn is a pretty neat idea. Thanks for releasing it! I see that you actually extended defn in that you made it possible to recur between different arities. Can you give a quick rundown on how you made that work? Are the arities still separate IFn arities? Does

Re: Why You Should NOT Implement Layered Architecture

2014-09-14 Thread edward
Looks like a pretty standard rather naif article by someone who knows enough to be dangerous but not enough to actually understand about trade-offs. And I'm not sure why you think it's even slightly relevant to Clojure: or did you think Clojure eschewed abstractions? -- You received this

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Hi Herwig Actually,defun just define a variadic arguments function,so it doesn't have different arities. And when using defun macro ,it walk through the body forms, find 'recur' forms and replace them with (recur (vector ...arguments)) instead. A macroexpand-1 result of accum: (macroexpand-1

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
And of course ,it still run in constant stack space just like normal recur form. P.S. I think adrian's advice is good, please forgive my poor english,and i changes the description to ' a macro to define clojure functions with pattern match just like erlang or elixir. 2014-09-15 0:26 GMT+08:00

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread adrian . medina
Criticism accepted Herwig. I apologize for not doing so initially. On Sunday, September 14, 2014 12:15:36 PM UTC-4, Herwig Hochleitner wrote: Hi Dennis, marrying core.match to defn is a pretty neat idea. Thanks for releasing it! I see that you actually extended defn in that you made it

Re: Why You Should NOT Implement Layered Architecture

2014-09-14 Thread Softaddicts
I think this article is partly true, at least in the OO world we know today. I dealt with a number of OO based commercial softwares in the past 10 years that used abstractions that were at best annoying, at worse made the internals obscure up to a point where you wondered if these were added

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread Bozhidar Batsov
Cool idea! I really wish something similar was available out-of-the-box - perhaps it makes sense to include such a macro in core.match itself as some point? — Cheers,  Bozhidar On September 14, 2014 at 9:47:21 AM, dennis zhuang (killme2...@gmail.com) wrote: Hi , i am pleased to introduce

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread Henrik Eneroth
For all the good qualities of the Clojure group, it can sometimes produce a bit of a harsh tone. Don't let that get you down though, it's great that you're building stuff and showing it off! As far as defun goes, it looks interesting. The out-of-the-box pattern matching was one of the things I

Re: Productivity tip for code transformations with cider

2014-09-14 Thread Ghadi Shayban
Nice useful demonstration, Stathis. Thanks! On Sunday, September 14, 2014 3:35:16 AM UTC-4, Stathis Sideris wrote: Hello all, There is some functionality in cider (C-c C-w) that can potentially save you a lot of typing when transforming Clojure code and I haven't seen many people using

Re: Productivity tip for code transformations with cider

2014-09-14 Thread Jony Hudson
Why did I never think of using that! Nice :-) Jony On Sunday, 14 September 2014 08:35:16 UTC+1, Stathis Sideris wrote: Hello all, There is some functionality in cider (C-c C-w) that can potentially save you a lot of typing when transforming Clojure code and I haven't seen many people

Re: jetty restart failing

2014-09-14 Thread Sven Richter
Hi Wilker, I have been going the same way and never really found out why this happens (I am using http-kit instead of jetty). However, one thing that I did not knew was that a refresh will delete references of vars. So if you keep your stop function somewhere and call refresh before the stop

Office Hour Requests

2014-09-14 Thread Timothy Washington
Hey all, Is anyone game for clojure office hours session. I even vaguely recall someone building a webapp that connected people who wanted to pair program. It was designed to be used on an ad-hoc basis. But I don't recall where that went. I want to focus on these things, in that order. -

Re: Pause a go loop

2014-09-14 Thread Jeremy Vuillermet
That's what I came up with. alts is very powerfull ! thanks On Friday, September 12, 2014 11:56:56 PM UTC+2, Dylan Butman wrote: How about this? https://gist.github.com/pleasetrythisathome/4f03ba9f729300beea40 On Friday, September 12, 2014 12:51:39 PM UTC-4, Jeremy Vuillermet wrote: thx,

Re: jetty restart failing

2014-09-14 Thread Wilker
Thanks for the info Sven. I also found out something, after watching this presentation: https://vimeo.com/100977463 I felt that was too much for me, but I'm digging into his source codes to learn more, and he seems to do a more robust way to shut down the server:

Re: Designing API for a Markov Model

2014-09-14 Thread Christopher Small
A few questions out of curiosity, if you don't mind: * Have you looked at existing MM libraries for Clojure? * Is there something you need that other's don't currently offer/emphasize; or is this more of a learning project? * Are you planning on or interested in open sourcing your work? Best

defrecord inside defmacro

2014-09-14 Thread Вук Мировић
Hi all, I started learning Clojure very recently by rewriting my old college Java project to Clojure. Having bunch of records I wanted to automate record creation with macros and to finally learn Clojure macros, but I got stuck. Example (Real code will be more complicated but I need to make

convert between PersistentArrayMap and HashMap

2014-09-14 Thread Makoto Hashimoto
I am writing clojure code calls java's method which parameters and return are HashMap. When I call java method with clojure's Map, the following error occurred. java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.HashMap So, I'd like to convert

Re: Designing API for a Markov Model

2014-09-14 Thread RJ Nowling
Hi Chris, I'm more than happy to answer questions. General background for the project: My friend Jay Vyas initiated BigPetStore, a big data application blueprint for the Hadoop ecosystem centered around transaction data for a fictional chain of pet stores. BigPetStore is currently part of the

Re: defrecord inside defmacro

2014-09-14 Thread Tobias Kortkamp
Hi, you need to syntax-quote the list you return from your macro. (defmacro some-record [some-name] `(defrecord ~some-name ['in 'out])) Note the backtick `. You then also have to explicitly quote your record field names (see 'in and 'out, try to remove the quotes to see why). Also

How do I track down a painfully long pause in a small web app?

2014-09-14 Thread larry google groups
I have an embarrassing problem. I convinced my boss that I could use Clojure to build a RESTful API. I was successful in so far as that went, but now I face the issue that every once in a while, the program pauses, for a painfully long time -- sometimes 30 seconds, which causes some requests

Re: How do I track down a painfully long pause in a small web app?

2014-09-14 Thread Shantanu Kumar
Few thing to consider: 1. Which API calls pause? If only certain calls pause, then probably you have something specific to suspect. Try adding a dummy REST call - see if that call pauses while others do. 2. Is any of your services running on a t1.micro or a burst-oriented EC2 instance on AWS?

Re: Productivity tip for code transformations with cider

2014-09-14 Thread Mayank Jain
Nice! Thanks for sharing! On Mon, Sep 15, 2014 at 1:40 AM, Jony Hudson jonyepsi...@gmail.com wrote: Why did I never think of using that! Nice :-) Jony On Sunday, 14 September 2014 08:35:16 UTC+1, Stathis Sideris wrote: Hello all, There is some functionality in cider (C-c C-w) that can