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!)
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.
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).
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
-
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,
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:
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
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
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
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
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
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
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?
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
30 matches
Mail list logo