Re: matching, assigning and branching in one form

2013-06-22 Thread Vincent
What about using condp? (condp re-find msg #"^:(.*?)!.*PRIVMSG (.*) :(.*)" :>> #(let [[_ from to message] %] (logic...))) Vincent On Friday, 21 June 2013 17:43:50 UTC+2, Steven Arnold wrote: > > Hi, I am writing a simple IRC bot, pretty much just for fun, starting with > a simple implementat

Clojure 1.6 API: clojure.lang.IFn and clojure.api.API

2013-06-22 Thread Jörg Winter
So these APIs are new in 1.6-SNAPSHOT and from what I understand provide an integration api between Java and Clojure-Runtime (symbols and their invocation). Apart from limitations which probably exist, what is the mode of execution for these API-calls ? For example if a tool/IDE starts a (REPL)

Commercial Users of Functional Programming 2013: Proposal due June 29!

2013-06-22 Thread Michael Sperber
Attached find the Call for Presentation Proposals for CUFP 2013 - do submit a proposal, and attend one of the premier events on applied functional programming! More info on the event is here: http://monkey.org/~marius/cufp.html -- Regards, Mike Sperber (co-chair) Commercial Users of Functional

multimethod noob question

2013-06-22 Thread Dennis Haupt
hi, i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n what exactly is "int" or "pr

can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
hi, i'm trying to compiler a clojure file using intellij. the error i get is: Clojure Compiler: java.io.IOException: The system cannot find the path specified, compiling:(D:\cloj\MultiMethod.clj:3) where the line number is pointing at a line that contains something that is declared in core.clr if

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
Dennis Haupt writes: > i was taking a look at multimethods: > (defmulti fac int) > (defmethod fac 1 [_] 1) > (defmethod fac :default [n] (*' n (fac (dec n > > this works > > however, this also works: > > (defmulti fac print) > (defmethod fac 1 [_] 1) > (defmethod fac :default [n] (*' n (fac (

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
On 22/06/13 15:09, Dennis Haupt wrote: where the line number is pointing at a line that contains something that is declared in core.clr core.clr and intelliJ? I've never used intelliJ but I was under the impression it was JVM only... are you sure you've got the right version of Clojure and p

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
i don't know what "properly set up the environment" means exactly, but i can run my script in the repl 2013/6/22 Jim - FooBar(); > On 22/06/13 15:09, Dennis Haupt wrote: > >> where the line number is pointing at a line that contains something that >> is declared in core.clr >> > > core.clr and

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
On 22/06/13 15:16, Dennis Haupt wrote: i don't know what "properly set up the environment" means exactly, but i can run my script in the repl what repl? intelliJ's repl? or a bare repl from your terminal? do you want to use Clojure JVM or Clojure CLR? Jim -- -- You received this message beca

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
i am not trying anything, i just want to figure out what happens. this is my output for the "print" version: user=> (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n #'user/fac # # user=> (fac 1) 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-2

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens 2013/6/22 Jim - FooBar(); > On 22/06/13 15:16, Dennis Haupt wrote: > >> i don't know what "properly set up the environment" means exactly, but i >> can run my script in the repl >> > > what repl? intelli

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
running the file works (from inside intellij), just intellijs compilation seems to be broken i can ignore the problem for now 2013/6/22 Dennis Haupt > clojure jvm, intellij's repl. i'll try to run the file via commandline and > see what happens > > > 2013/6/22 Jim - FooBar(); > >> On 2

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
On 22/06/13 15:21, Dennis Haupt wrote: clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens where did core.clr come from then? can you somehow see what version of clojure your intelliJ is using? I've got no experience with intelliJ really...it's just tha

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
Dennis Haupt writes: > i am not trying anything, i just want to figure out what happens. this is my > output for the "print" version: > user=> (defmulti fac print) > (defmethod fac 1 [_] 1) > (defmethod fac :default [n] (*' n (fac (dec n > #'user/fac > # > # > user=> (fac 1) > 10-1-2-3-4-5-6

Re: can't compile anything except "def"

2013-06-22 Thread Dennis Haupt
it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to compile clojure files, something strange happens. if i remove the option to compile the files (and instead just use clojure.main and run them) there is no problem 2013/6/22 Jim - FooBar(); > On 22/06/13 15:21, Dennis Haupt w

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > i am not trying anything, i just want to figure out what happens. this > is my output for the "print" vers

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
(ns experiments.MultiMethod) (defmulti fac identity) (defmethod fac 1 [n] (print "n:" n" <- ") 1) (defmethod fac :default [n] (*' n (fac (dec n (print (fac 125)) if i am getting this right, defmethod fac [] is the equivalent to a scala or haskell pattern match, where stuff is the "match" and

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
Dennis Haupt writes: > yes. all glory to the repl that makes me figure out the internals via > experiments :D > is there a way to just pass the given value along? Yes, that's what I meant by my inspect method in my original reply. It prints the value and passes it along: (defn inspect [

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
"identity" :) 2013/6/22 Chris Bilson > Dennis Haupt writes: > > > yes. all glory to the repl that makes me figure out the internals via > experiments :D > > is there a way to just pass the given value along? > > Yes, that's what I meant by my inspect method in my original reply. It > prints th

Re: try* macro to catch multiple exception classes with one body. feedback is needed.

2013-06-22 Thread Max Gonzih
I can't think about another name for my macro :). Any ideas? Regards, Max On 20 Jun 2013 23:26, "Herwig Hochleitner" wrote: > One thing to consider: try* is a compiler builtin form. Those are > currently not even namespaced. That might lead to confusion for readers. > > > 2013/6/20 Max Gonzih >

Re: Best practice for looping

2013-06-22 Thread P Martin
Ah ok - so I may be using it wrong. I am not calling the function itself - I was simply trying to bind local variables in a loop. I have placed the code into gists for easier reading! https://gist.github.com/anonymous/5841405#file-core-clj https://gist.github.com/anonymous/5841420#file-vec-clj

Re: Best practice for looping

2013-06-22 Thread Gary Trakhman
Do you have the stack trace? It's not simple to run the code, but I made a github project so we can look at it easier. https://github.com/gtrak/grad-descent-test When I run (gradient-descent example-grad [0 1] 0.001 0.001) Here's the actual problem: grad-descent.core> (pst *e) StackOverflowError

Re: Best practice for looping

2013-06-22 Thread Gary Trakhman
I think the way to understand what's going on is to realize that laziness (coming from map) creates extra thunks, for each iteration, you're creating an extra stack frame to dereference the elements of the lazy seq. (defmacro lazy-seq "Takes a body of expressions that returns an ISeq or nil, and

Packaging data_readers.clj with a Clojar

2013-06-22 Thread Joel Holdbrooks
Tagged literals are really neat. The other day I discovered what seems to be a fairly good use case for them (see discussion here). At the time I wasn't sure if data_readers.clj could be packaged with a Clojar but it appears it

ANN: vectorz-clj 0.10.0

2013-06-22 Thread Mike Anderson
Pleased to announce the latest 0.10.0 release of vectorz-clj, a matrix/vector maths library for Clojure vectorz-clj is designed so that you don't have to compromise: offering both high performance (about as fast as you can get on the JVM) and an idiomatic high-level Clojure API. New and notabl

Re: can't compile anything except "def"

2013-06-22 Thread Colin Fleming
Which version of the IntelliJ plugin are you using? You can see this by opening the settings, selecting plugins then selecting the La Clojure plugin. In recent versions the compiler has changed and I've had occasional problems with it. On 23 June 2013 02:29, Dennis Haupt wrote: > it happens wit

what execurtes what in clojure

2013-06-22 Thread jayvandal
in a project file the :main my-website.server) Is this like a go to statement or a do like statement it seems that the leiningen has default to the welcome clj file.If it doesn't find the welcome file what does leiningen do? In the my-website.server clj file , the main function ends with a :ns

Re: what execurtes what in clojure

2013-06-22 Thread Gary Trakhman
Check out https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L404 and https://github.com/clojure/clojure/blob/master/src/jvm/clojure/main.java On Sat, Jun 22, 2013 at 7:20 PM, jayvandal wrote: > in a project file the > :main my-website.server) > Is this like a go to statem

Re: Packaging data_readers.clj with a Clojar

2013-06-22 Thread Gary Trakhman
I don't think there's a way to make aliases for reader literals, which you would want in order to avoid breaking this rule: "Reader tags without namespace qualifiers are reserved for Clojure." from http://clojure.org/reader#The Reader--Tagged Literals But I haven't tried it myself, is that the cas

Cambridge (UK) Clojure user group

2013-06-22 Thread Ray Miller
The Cambridge (UK) Clojure group used to meet monthly, but has recently lost momentum. I'm trying to turn that around and get us back on track with a regular monthly meet-up. If you are in the Cambridge area and might be interested in attending these meet-ups, please take a few minutes to compl

Re: representing clojure source code as data?

2013-06-22 Thread kovas boguta
On Fri, Jun 21, 2013 at 6:08 PM, Brandon Bloom wrote: > You've outlined 2 out of the 3 interesting (to me) shapes: 1) raw data > structures and 2) datoms. I think that the 3rd interesting one is a > map/vector tree, like the CLJS analyzer output. > By "raw data structures", you mean the concrete