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

2014-09-23 Thread J David Eisenberg


On Saturday, September 13, 2014 11:47:28 PM UTC-7, dennis wrote:


 Hi , i am pleased to introduce defun https://github.com/killme2008/defun: 
 a beautiful macro to define clojure functions with pattern match.

 [snip]


This is totally wonderful. Elegant, and useful. 

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojure beginner: angst about doing things right

2014-09-22 Thread J David Eisenberg
As part of a larger program, I'm testing a function that will turn a string 
of days on which a class occurs (such as MWF) into a list of seven 
numbers: (1 0 1 0 1 0 0).
I first translateTH (Thursday) to R and SU (Sunday) to N to make 
things a bit easier.

I came up with the following code:

(defn days-number-maker
  Recursively compare first item in days of week with
first item in string of days. If matching, add a 1,
else add a zero to the result
  [all-days day-string result]
  (if (empty? all-days) (reverse result)
(if (= (first all-days) (first day-string))
  (recur (rest all-days)(rest day-string) (conj result 1))
  (recur (rest all-days) day-string (conj result 0)

(defn days-to-numbers
  Change string like MTTH to (1 1 0 1 0 0 0)
  [day-string]
  (let [days (clojure.string/replace
   (clojure.string/replace day-string #TH R) #SU N)]
(days-number-maker MTWRFSN days (list

The good news: the code works. The bad news: I'm convinced I'm doing it 
wrong, in the moral purity sense of the word. Something inside of me says, 
You could have just used (map...) to do this the *right* way, but I can't 
see how to do it with (map). So, my two questions are:

1) Is there such a thing as the Clojure way, and if so,
2) How can I rewrite the code to be more Clojure-ish?

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Useless Java error messages

2014-09-04 Thread J David Eisenberg


On Tuesday, September 2, 2014 5:13:49 PM UTC-7, Beau Fabry wrote:

 apologies, not a leiningen plugin. https://github.com/AvisoNovate/pretty


Thank you. This looks most interesting. I was able to find clj-pretty-error 
on Clojars; github is https://github.com/liquidz/clj-pretty-error, but it 
appears not to have any updates in the past couple of years.


 On Wednesday, September 3, 2014 2:17:21 AM UTC+10, John Gabriele wrote:

 On Monday, September 1, 2014 7:24:54 PM UTC-4, Beau Fabry wrote:

 The pretty-errors leiningen plugin might be worth a look


 Hm... I don't see that particular plug-in in the [main lein plug-in list](
 https://github.com/technomancy/leiningen/wiki/Plugins).

 Do you mean [clj-stacktrace](https://github.com/mmcgrana/clj-stacktrace)? 
 (not a lein plug-in)



-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Quil 2.1.0 released

2014-06-28 Thread J David Eisenberg


On Friday, June 13, 2014 12:48:34 PM UTC-7, Nikita Beloglazov wrote:

 Friday the 13th and a full moon is ideal time for a release!

 Happy to announce release of Quil 2.1.0. It is available on clojars: 
 https://clojars.org/quil

 Here is the list of changes:

- Middleware https://github.com/quil/quil/wiki/Middleware support.
- Functional mode 
https://github.com/quil/quil/wiki/Functional-mode-%28fun-mode%29 
support.
- Updated to Processing 2.2.1.
- New methods: resize http://quil.info/image.html#resize and 
state-atom http://quil.info/state.html#state-atom. 
- :no-safe-draw feature renamed to :no-safe-fns.
- Fixed NPE when exiting :p2d sketch using esc key. #110 
https://github.com/quil/quil/issues/110.
- Wrap all user-provided function to safe wrappers. #106 
https://github.com/quil/quil/issues/106. 

 Most interesting changes are middleware 
 https://github.com/quil/quil/wiki/Middleware and functional mode 
 https://github.com/quil/quil/wiki/Functional-mode-%28fun-mode%29. Take 
 a look at them.


Haven't time to experiment with it right now, but functional mode looks 
*wonderful*. 

 Thanks Maksim Karandashov for contributing and help with release testing.

 Future plans:

- Quil on ClojureScript - GSoC project which Maksim is working on. 
- More cool middleware. There some ideas on middleware wiki page, feel 
free to grab and implement them. Would be happy to get more 
ideas/implementations.
- Work on http://quil.info to make it more than simple API site. 

 Your feedback is welcome. 

 Happy hacking!


 Nikita Beloglazov


-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.