Re: Standard calling-a-function function?

2009-10-22 Thread Timothy Pratley
On Oct 22, 3:22 pm, John Harrop jharrop...@gmail.com wrote: user= (map call (map constantly [1 2 3])) (1 2 3) map call and map constantly are actually inverse operations. :) that makes me smile! --~--~-~--~~~---~--~~ You received this message because you

Re: Neophyte question

2009-10-22 Thread Christophe Grand
On Wed, Oct 21, 2009 at 5:50 PM, Lauri Pesonen lauri.peso...@iki.fi wrote: 2009/10/21 John Harrop jharrop...@gmail.com: Like this? (def hexchar? #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \a \B \b \C \c \D \d \E \e \F \f}) Yep, that's what I had in mind as well, but I got tired of typing ;-)

Re: college courses

2009-10-22 Thread Daniel Werner
On Oct 19, 5:03 pm, artg artgittle...@gmail.com wrote: I'm using Programming Clojure in a grad course and doing a short Clojure unit in a senior programming languages course at Calif State Univ Long Beach. Art, what kind of pre-existing knowledge do you expect or require in your students? In

Re: How does isa? work in multimethod dispatch?

2009-10-22 Thread Shel
Meikel Chouser - Thanks for your help. That does it. I clearly haven't quite grokked the namespace stuff in clojure yet. Better get on that Shel On Oct 21, 1:18 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 21.10.2009 um 20:49 schrieb Shel: (defmulti area (fn [s m] [(:shape

Re: Standard calling-a-function function?

2009-10-22 Thread RandyHudson
(apply arg) On Oct 21, 7:49 pm, samppi rbysam...@gmail.com wrote: Is there a standard function that takes one argument and calls it? That is, the function equivalent to #(%). Or is that the best idiom there is? --~--~-~--~~~---~--~~ You received this message

Binding broken in 1.1.0-alpha

2009-10-22 Thread Cameron McKay
Not sure if you guys know this but binding doesn't work in 1.1.0-alpha on Snow Leopard and apparently Linux. (def foo 10) ; = '#user/foo foo ; = 10 (binding [foo 42] foo) ; = 10 (binding [user/foo 42] foo) ; = 10 (binding [user/foo 42] (var-get #'user/foo)) ; = 10 Here's the post on

Clojure resources in Spanish

2009-10-22 Thread Angel Java Lopez
Hi people! Does anyone know about Clojure resources written in Spanish? Blog posts, tutorials, google group, email list, something else? I want to write about Clojure in English, but in Spanish (my mother tongue) too. And I want to mention any Spanish resource about Clojure. I found some links

Re: Neophyte question

2009-10-22 Thread Timothy Pratley
On Oct 22, 5:55 pm, Christophe Grand christo...@cgrand.net wrote: (def hexchar? (set 0123456789ABCDEFabcdef)) That's really nice! Here is my perverse entry for fun: (def hexchar? (set (map char (mapcat range [48 65 97] [58 71 103] --~--~-~--~~~---~--~~

Re: Binding broken in 1.1.0-alpha

2009-10-22 Thread Meikel Brandmeyer
Hi, On Oct 22, 2:15 am, Cameron McKay cdmc...@gmail.com wrote: Not sure if you guys know this but binding doesn't work in 1.1.0-alpha on Snow Leopard and apparently Linux. (def foo 10) ; = '#user/foo foo ; = 10 (binding [foo 42] foo) ; = 10 (binding [user/foo 42] foo) ; = 10

Re: Clojure resources in Spanish

2009-10-22 Thread Antonio Garrote
Hi Ángel. I much afraid most of the information about Clojure is in English but for some random blog posts. About the spanish Clojure group, I think is a great idean and I would be really interested in participating in such a group. Cheers! On 10/22/09 11:51 AM, Angel Java Lopez

Re: Slime and stuff

2009-10-22 Thread blcooley
I run SLIME with Clojure on Aquamacs, and I used Geoffrey Grosenbach's emacs starter kit (http://github.com/topfunky/emacs-starter-kit) to get set up. The emacswiki suggests that loading the .emacs file is deprecated (http://www.emacswiki.org/emacs/PreferencesInAquamacs), and I couldn't get it

Re: Converting symbols to strings

2009-10-22 Thread Sean Devlin
Yes, a macro is required. Otherwise the symbols are evaluated. On Oct 22, 10:22 am, Tzach tzach.livya...@gmail.com wrote: Hello all I’m writing a small facility which get vector of vectors of names (strings) and print them in a special format. Something like (foo [[“aname”

Re: Converting symbols to strings

2009-10-22 Thread Meikel Brandmeyer
Hi, On Oct 22, 4:22 pm, Tzach tzach.livya...@gmail.com wrote: I’m writing a small facility which get vector of vectors of names (strings) and print them in a special format. Something like (foo [[“aname” “a-different-name”] [ “oneMoreName”]]) This works fine, but make it hard to write all

Re: Converting symbols to strings

2009-10-22 Thread Sean Devlin
Or, you could just write foo as ;;Adjusting for 2d (defmacro foo [vec-vec-of-symbols] (let [vec-vec-of-str (vec (map (comp vec (partial map str)) vec-vec- of-symbols))] `(foo* ~vec-vec-of-str))) This let you write foo* to handle strings. Anyway, the key thing to note in both examples is

suggestion: repeatedly should take optional n, like repeat does

2009-10-22 Thread Stuart Halloway
If that sounds good, let me know and I will create an issue and a patch. Stu --~--~-~--~~~---~--~~ 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

Re: Clojure is two!

2009-10-22 Thread Tayssir John Gabbour
Hi, Just chiming in a bit late -- just wanted to say that Clojure has really been saving my butt these last three long days. My customer has a codebase which is written in a language without any sort of fancy REPL. I'm able to tap into that system and have Clojure draw out the info, so I can

Re: suggestion: repeatedly should take optional n, like repeat does

2009-10-22 Thread Sean Devlin
Hmmm... I'm torn. It certainly would be useful syntax, but it might be confusing because of laziness. I think the confusion is that it is designed around impure functions. I think this would be better use dotimes in these situations. Perhaps repeatedly itself might not be a good idea. Maybe

Re: function rebinding and logging

2009-10-22 Thread Tom Faulhaber
Hey Jeff, Craig McDaniels wrote a little trace library that does on-demand function wrapping that does pretty much what you're looking for. Look here: http://groups.google.com/group/clojure/browse_thread/thread/3ea8777880231e18/6fd1b352ac1a6744?lnk=gstq=trace#6fd1b352ac1a6744 I implemented a

Re: Clojure resources in Spanish

2009-10-22 Thread atreyu
I am afraid my blog it isnt a great example...it is is more a project than a reality and i am a beginner as clojure programmer and as blogger. Although Antonio Garrote has excellent posts in spanish (the best i found) and english about clojure: http://antoniogarrote.lacoctelera.net/tags/clojure

Re: Clojure is two!

2009-10-22 Thread Tayssir John Gabbour
On Oct 22, 5:05 pm, Tayssir John Gabbour tayssir.j...@googlemail.com wrote: What's been very helpful is clojure.zip and clojure.set; I needed to correlate data which came from a DB and an XML file -- and it was immediately obvious that clojure.set/join and clojure.set/rename could do it in 4

Re: Standard calling-a-function function?

2009-10-22 Thread samppi
That is indeed nice. Thanks for the code; I guess I don't really have to settle for #(%) after all. @RandyHudson: apply would work, but it's pretty slow, and not worth switching from #(%). On Oct 21, 11:49 pm, Timothy Pratley timothyprat...@gmail.com wrote: On Oct 22, 3:22 pm, John Harrop

Re: Clojure is two!

2009-10-22 Thread Luc Prefontaine
Félicitations Rich :))) Clojure has now a toe in the biometric market. A friend called me in August, he needed a quick integration software to generate data to feed two slave factories to get id cards and passports printed and wrap a bunch of tools to get consequent biometric data to be burned

Bindings

2009-10-22 Thread Gorsal
I would like to know if the following way is the only method to introduce global bindings which affect a new thread one starts. (let [global-var *global-var*] (with-thread nil (binding [*global-var* global-var] ))) Just wanted to make sure there wasn't anything easier:)

Bindings

2009-10-22 Thread Gorsal
I would like to know if the following way is the only method to introduce global bindings which affect a new thread one starts. (let [global-var *global-var*] (with-thread nil (binding [*global-var* global-var] ))) Just wanted to make sure there wasn't anything easier:)

Re: Best way to run multiple filters on the same [lazy] collection?

2009-10-22 Thread Meikel Brandmeyer
Hi, Am 22.10.2009 um 03:48 schrieb Dmitry Kakurin: Has someone developed a better support for paren problem for TextMate editor? Right now all it does is flashing matching open paren when I type the closing one. And that's it (apart from cmd-shift-B which is too much work). Also TextMate

Re: Clojure resources in Spanish

2009-10-22 Thread Angel Java Lopez
Hi People! Ok, I just created a Google group, dedicated to Clojure topics, in Spanish: http://groups.google.com/group/clojure-hispano Anyone is invited to join. We are few, but I hope this group could be an starting point. Angel Java Lopez http://www.ajlopez.com http://twitter.com/ajlopez On

Re: Bindings

2009-10-22 Thread Meikel Brandmeyer
Hi, Am 22.10.2009 um 19:56 schrieb Gorsal: I would like to know if the following way is the only method to introduce global bindings which affect a new thread one starts. (let [global-var *global-var*] (with-thread nil (binding [*global-var* global-var] ))) Just wanted to make

Clojure Job Opportunity

2009-10-22 Thread Jeff Straszheim
*ID 0020 - Clojure Developer* Velocitude, a provider in mobile web development and social media solutions, is looking for a Clojure Developer to assist in further developing the Velocitude Mobile Platform for mobile web services, for clients representing major US brands and other companies.

Removing duplication of redis/with-server in every function?

2009-10-22 Thread Radford Smith
I'm trying out redis-clojure. Right now, my code looks like this: (defn one [] (redis/with-server *db* (...))) (defn two [] (redis/with-server *db* (...))) (defn three [] (redis/with-server *db* (...))) It feels wrong to repeat myself every time I need to use the database.

Clojure gotcha: agent thread pool

2009-10-22 Thread Howard Lewis Ship
Just had a bit of a gotcha on Clojure that I thought I'd share. My tests started hanging after completion, which was a real pain on the continuous integration server. After some investigation, I determine that this unwanted behavior started when I first introduced agents into my code. I needed

Re: Removing duplication of redis/with-server in every function?

2009-10-22 Thread Richard Newman
It feels wrong to repeat myself every time I need to use the database. Is there a way to abstract out the (redis/with-server) part? Something like (defmacro def-with-redis [name args body] `(defn ~name ~args (redis/with-server *db* ~...@body))) then (def-with-redis one []

Re: Slime and stuff

2009-10-22 Thread Stuart Campbell
Thanks Brian. In fact, I hadn't properly installed SLIME. However, I discovered that clojure-mode has an installation function which downloads and installs all dependencies (clojure, clojure-contrib, slime and swank-clojure). It all seems to be working correctly now. 2009/10/22 blcooley

Re: Removing duplication of redis/with-server in every function?

2009-10-22 Thread Radford Smith
That works for functions with one argument list, but what about functions with multiple argument lists? ;; doesn't work (def-with-redis foo ([] …) ([arg] …)) Doc strings and metadata won't work either. It seems like I might as well copy-paste the code from (source defn). Is there another

Re: Removing duplication of redis/with-server in every function?

2009-10-22 Thread Richard Newman
That works for functions with one argument list, but what about functions with multiple argument lists? Hey, I was only answering the question you asked :) If you want to do this in the general case, take this approach: (defn fn-with-redis [f] (fn [ args] (redis/with-server *db*

Re: Clojure gotcha: agent thread pool

2009-10-22 Thread Chouser
On Thu, Oct 22, 2009 at 6:22 PM, Howard Lewis Ship hls...@gmail.com wrote: Just had a bit of a gotcha on Clojure that I thought I'd share. My tests started hanging after completion, which was a real pain on the continuous integration server. After some investigation, I determine that this

Private multimethods possible?

2009-10-22 Thread samppi
Are private multis possible? I notice that clojure.contrib.def does not have a defmulti-, which doesn't bode well, but it's still worth a question at the mailing list. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
samppi wrote: Are private multis possible? I notice that clojure.contrib.def does not have a defmulti-, which doesn't bode well, but it's still worth a question at the mailing list. Yes, you can make any symbol private. If you look at the definition of defn- you'll see all it does is set

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
So you could do the same when defining a multimethod, just give the name (symbol) of the method the metadata :private with the value true: (defmulti #{:private true} my-multi my-dispatch) I'm having a bad day for typos, the example should of course be: (defmulti #^{:private true} my-multi