Re: Clojure Kata

2010-01-25 Thread Edmund
Here a different version, without the sequence abstraction. I realise its idiomatically obsolete, but thought you guys might enjoy it. (defn sift Sift. Old Skool. [key-pred in-s] (reduce (fn [coll elem] (if (key-pred elem) (conj coll [(str elem) []]) (conj (pop

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Joonas Pulakka
I would be interested in native / C interoperability; perhaps either (or both) of these libraries: http://github.com/bagucode/clj-native http://github.com/Chouser/clojure-jna And others, if there are similar ones. In general, the Clojure way of interacting with native code. Best Regards, Joonas

Help needed regarding the use of macro

2010-01-25 Thread Manish
Hi, I am new to clojure. I want to use try-catch block to the (.getPage *wc* ~url) statement of code. But I am getting this error: java.lang.Exception: Can't bind qualified name:nlplabs.webfetch.agent/ exception Would u pls help me to sort out this problem? Thanx in advance Code snippet: (ns

Re: Help needed regarding the use of macro

2010-01-25 Thread Michael Wood
2010/1/25 Manish manish.zed...@gmail.com: Hi, I am new to clojure. I want to use try-catch block to the  (.getPage *wc* ~url) statement of code. But I am getting this error: java.lang.Exception: Can't bind qualified name:nlplabs.webfetch.agent/ exception Would u pls help me to sort out this

Re: Help needed regarding the use of macro

2010-01-25 Thread Manish
Nothing is declared in this namespace as exception On Jan 25, 5:03 pm, Michael Wood esiot...@gmail.com wrote: 2010/1/25 Manish manish.zed...@gmail.com: Hi, I am new to clojure. I want to use try-catch block to the  (.getPage *wc* ~url) statement of code. But I am getting this error:

Re: Help needed regarding the use of macro

2010-01-25 Thread Manish
Thanx for ur quick response, And its not making difference by changing exception to e. I am still getting this error: java.lang.Exception: Can't bind qualified name:nlplabs.webfetch.agent/ e Thanx Regards Manish Zedwal On Jan 25, 5:03 pm, Michael Wood esiot...@gmail.com wrote: 2010/1/25 Manish

Re: Help needed regarding the use of macro

2010-01-25 Thread Steve Purcell
I think you'll have to use exception# instead of exception, in order to generate a local symbol. Otherwise, the quoting will try to resolve exception in the current namespace. Also, don't expand ~url more than once -- what if the expression passed for url has side effects? It would get

Re: Help needed regarding the use of macro

2010-01-25 Thread Christophe Grand
Hi On Mon, Jan 25, 2010 at 12:41 PM, Manish manish.zed...@gmail.com wrote: Hi, I am new to clojure. I want to use try-catch block to the  (.getPage *wc* ~url) statement of code. But I am getting this error: java.lang.Exception: Can't bind qualified name:nlplabs.webfetch.agent/ exception

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Seth
* (ns) in depth, or at least why namespaces need at least one . * What's this error kit people keep talking about? duck streams? * Using Nailgun to avoid the JVM startup cost for tests in Leiningen (still in flight, see its group) * love, don't fear paredit (I really need this) Thanks for putting

Re: Promise/Deliver use cases

2010-01-25 Thread Jeff Rose
It might be nice to have a built-in mechanism to get with a timeout. Maybe (await-for ...) could be modified to work on both agents and promises? Note though, that getting a promise with a timeout doesn't require explicitly closing over the promise. The anonymous function that is created in the

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread mac
On 25 Jan, 12:18, Joonas Pulakka joonas.pula...@gmail.com wrote: I would be interested in native / C interoperability; perhaps either (or both) of these libraries: http://github.com/bagucode/clj-native http://github.com/Chouser/clojure-jna And others, if there are similar ones. In general,

Re: Clojure Conference Poll

2010-01-25 Thread Joop Kiefte
This group works as wave group as well :) 2010/1/24 Seth seth.schroe...@gmail.com: When: weekends Where: DC, Boston, NY, San Fran Who: at least one, probably more Newsgroups are such a painful way to vote on things. Google Wave or some other wiki-like thing would make it much easier to

Re: Jython interop

2010-01-25 Thread Marc Downie
One approach is to compile the Jython code into a class file. This requires some work on the Python side (similar to using gen-class in Clojure so that Clojure code can be called from Java), and the Python class of interest can't use multiple-inheritance. This approach is discussed in the

Re: Clojure Kata

2010-01-25 Thread Meikel Brandmeyer
Golf! Yeah! Here the low-level version: (defn sift [pred coll] (letfn [(step [sep [f :as s] xs] (if (or (not s) (pred f)) (cons [sep xs] (sift pred s)) (recur sep (next s) (conj xs f] (lazy-seq (when-let [s (seq coll)]

defn

2010-01-25 Thread Glen Rubin
I am trying to learn clojure by learning the programing by example open wiki book. For an excercise demonstrating iteration they give the following example: (defn factorial ([n] (factorial n 1)) ([n acc] (if (= n 0) acc (recur (dec n) (* acc n) first

Re: newbie question about ns and :require

2010-01-25 Thread Justin Kramer
You may find this ns cheatsheet helpful: http://gist.github.com/284277 Justin On Jan 24, 10:28 am, Manfred Lotz manfred.l...@arcor.de wrote: Hi all, I'm stumbling about the very basics. Calling clojure like this: rlwrap java -cp

Re: Clojure Conference Poll

2010-01-25 Thread Jevgeni Holodkov
I would suggest Estonia, but Germany is good as well! :) Br, Jevgeni On Jan 23, 3:45 pm, Heinz N. Gies he...@licenser.net wrote: On Jan 23, 2010, at 12:04 , Boštjan Jerko wrote: On 23.1.2010, at 10:33, Edmund wrote: East coast for we Europeans ? On Jan 23, 8:53 am, Christophe

Re: Help needed regarding the use of macro

2010-01-25 Thread Meikel Brandmeyer
Hi, On Jan 25, 12:41 pm, Manish manish.zed...@gmail.com wrote: I am new to clojure. I want to use try-catch block to the  (.getPage *wc* ~url) statement of code. But I am getting this error: java.lang.Exception: Can't bind qualified name:nlplabs.webfetch.agent/ exception Would u pls help

Why is this code so slow?

2010-01-25 Thread Nebojsa Stricevic
Greetings, I'm new to Clojure and working my way through Project Euler problems for learning. I stuck with problem 7, not with solution, but with performance. My code needs about 90sec to find solution. (ns problem7) (defn no-dividers? checks if number can be divided with any of

Re: Clojure Kata

2010-01-25 Thread Michał Marczyk
Hi Group, thought this nice puzzle would make a good occasion for a first post. :-) A solution to the original problem from c.l.s, with keywords replacing symbols: (ns sogaard-kata (:use clojure.contrib.seq-utils)) (defn sogaard-kata [xs] (map (fn [[k ys]] (into (vec k) (vec ys)))

Re: Clojure Conference Poll

2010-01-25 Thread looselytyped
I concur. Columbus, OH is a pretty good location :D [But then, I am just being selfish] In all seriousness, it does act as a pretty central location in the midwest region IMO. Raju On Jan 22, 4:15 pm, Wilson MacGyver wmacgy...@gmail.com wrote: I vote let's turn this into a clojure vacation,

Re: Reminder: IEEE Software Issue on Multiparadigm Programming

2010-01-25 Thread Violeta
Dear Mr Wampler, I'm interested in reviewing manuscripts for SI of IEEE Software on Multiparadigm Programming. Best regards, Dr. Violeta Damjanovic http://sites.google.com/site/vdamjanovic/ On Jan 23, 6:59 pm, Dean Wampler deanwamp...@gmail.com wrote: Hi, all, Apologies for duplicate

Domain Modelling

2010-01-25 Thread Barry Dahlberg
Hi, I'm an experienced C# / .Net developer and a relative Lisp newbie. In my .Net programming I have taken a lot of design inspiration Domain Driven Design and Eric Evans book in particular. The idea that a developing a strong model of the problem domain is the most important part of application

Re: Clojure Conference Poll

2010-01-25 Thread Ramakrishnan Muthukrishnan
On Sat, Jan 23, 2010 at 1:24 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 22 Jan 2010, at 22:15, Wilson MacGyver wrote: I vote let's turn this into a clojure vacation, and hold it in an exotic location. Otherwise, hey, Columbus Ohio is as good as any other city. :) My vote is for

Re: Jython interop

2010-01-25 Thread Marc Downie
On Sun, Jan 24, 2010 at 11:26 PM, rob r.p.l...@gmail.com wrote: Hi, I was wondering if anyone has tried somehow calling Jython functions from within Clojure, and how you went about doing this if so. I have not used Jython, but I would imagine the Jython interpreter can be invoked in the

Re: Announcement: Vijual Graph Layout Library for Clojure Version 0.1

2010-01-25 Thread Simon Brooke
On 22 Jan, 22:06, Conrad drc...@gmail.com wrote: http://lisperati.com/vijual/ Hope some of you find this library useful. Let me know if you have feature requests or want to help me improve this library. Many thanks! I shall most certainly use this. -- You received this message because you

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Meikel Brandmeyer
Hi, On Jan 25, 8:58 am, rb raphi...@gmail.com wrote: * interacting with a database in general, and covering clojureql in particular Beware the redesign: the ClojureQL DSL is currently revised. The end result is not clear, yet. However it will change. Sincerely Meikel -- You received this

Re: Cyclic require

2010-01-25 Thread Seth
No support for cyclical dependencies is biting me too. I'm trying to use one .clj file per protocoltype, which doesn't seem *too* smelly. It's a habit that goes way back... maybe time to revise my worldview :-) If a namespace is intended to be a stratum then I will refactor to fit that. Fewer,

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Rock
I think I have a good topic. How about the intricacies of syntax-quotes and in particular, nested syntax-quotes? When I was first learning Lisp (Common Lisp), I had to struggle with nested syntax-quotes (backquotes) very much. That was until I read Alan Bawden's superb paper on the subject, and

Clojure Talk in Paris Feb 15th

2010-01-25 Thread Howard Lewis Ship
While I'm in Paris to do some Tapestry training, I'll also be doing a FREE talk on Clojure: Clojure: Towards the Essence of Programming The talk is sponsored by SkillsMatter; it's aimed at people who haven't used Clojure before, but if people on the list want to come out to show some support,

Re: defn

2010-01-25 Thread Mike DeLaurentis
That's defining a function factorial that can be called with either one or two arguments. When called with one argument, it immediately calls itself with two arguments. So the (factorial n 1) call provides acc with an initial value of 1. The ([n] and ([n acc] lines are the declarations of the

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Adrian Cuthbertson
How about the intricacies of syntax-quotes and in particular, nested syntax-quotes? Yeah, +1. -- 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

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Sean Devlin
Rock, Could you please proved a link to Alan Bawden's paper? Thanks, Sean On Jan 25, 9:06 am, Rock rocco.ro...@gmail.com wrote: I think I have a good topic. How about the intricacies of syntax-quotes and in particular, nested syntax-quotes? When I was first learning Lisp (Common Lisp), I

Re: defn

2010-01-25 Thread Glen Rubin
wow! So if it is called with 1 argument, then the body of the function is: (factorial n 1) But if it is called with 2 arguments then the body of the function is: (if (= n 0) acc (recur (dec n) (* acc n))) Is this a standard feature of lisp? Sorry I am very noobish. thx! On

Re: Clojure Conference Poll

2010-01-25 Thread cburroughs
I agree that at least part (well I guess that would be half) of the conference should be on a weekend to permit attendance for those with work conflicts. A suggestion that I recall seeing a while ago was to dovetail ICFP 2010 http://www.icfpconference.org/. That would be late September in the

Re: Clojure Kata

2010-01-25 Thread Laurent PETIT
Hello, So far, i've encountered the term of kata applied to software in a somewhat similar sense as in the martial arts: very detailed step-by-step explanation of how one things about the problem, solves it bit by bit (does he first play with some functions at the REPL, does he start to code from

Re: A new lisper's question about a macro

2010-01-25 Thread joel r
On Mon, Jan 25, 2010 at 3:42 AM, Richard Newman holyg...@gmail.com wrote: The former is a lot clearer to read, as it uses standard Clojure datastructures. ... which offers other advantages beyond the human, such as (def page-names keys) user= (page-names foobar) (:page :posts :post)

Re: A new lisper's question about a macro

2010-01-25 Thread joel r
On Mon, Jan 25, 2010 at 3:09 AM, ataggart alex.tagg...@gmail.com wrote: (zipmap  (map keyword (take-nth 2 ~params))  (map (comp var-get resolve) (take-nth 2 (next ~params Neat :-) Thanks! - Joel Rosario. -- You received this message because you are subscribed to the Google Groups

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Rob Wolfe
Sean Devlin napisał(a): Rock, Could you please proved a link to Alan Bawden's paper? I guess Rock meant Quasiquotation in Lisp: https://eprints.kfupm.edu.sa/60346/1/60346.pdf BTW many thanks for your awesome videos. :) Br, Rob -- You received this message because you are subscribed to the

Re: Clojure Kata

2010-01-25 Thread Sean Devlin
Laurent, This thread is a set up. Specifically, I'm hoping these guys pick up the blog post: http://www.katacasts.com/ I plan on posting a video in about a week going through everything. Demonstrate the power of the sequence abstraction, and the similarities of regexs and predicates. Show how

Re: newbie question about ns and :require

2010-01-25 Thread Manfred Lotz
Hi, On Sun, 24 Jan 2010 17:07:23 +0100 Meikel Brandmeyer m...@kotka.de wrote: But why does this fail? my= (classpath) java.lang.Exception: Unable to resolve symbol: classpath in this context (NO_SOURCE_FILE:2) Because you used require. Try clojure.contrib.classpath/classpath

Re: defn

2010-01-25 Thread Mike DeLaurentis
Yes, that's basically right. I don't know if common lisp has a similar syntax for defining functions with multiple parameter lists, but you'll definitely see it a lot in Clojure code. On Mon, Jan 25, 2010 at 10:22 AM, Glen Rubin rubing...@gmail.com wrote: wow! So if it is called with 1

Re: Jython interop

2010-01-25 Thread rob
Thank you for these good ideas! I'm going to try it. My goal is to use the Natural Language Toolkit in Clojure. I also posted the same question here: http://stackoverflow.com/questions/2129253/clojure-jython-interop Rob On Jan 24, 7:08 pm, Eric Lavigne lavigne.e...@gmail.com wrote: I was

Re: defn

2010-01-25 Thread Laurent PETIT
Glen, learning by example is good, but you should consider backing it with also taking a look at the main documentation pages from clojure.org ! Concerning the topic at hand, you need to get : * the syntax for defn : http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defn

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Laurent PETIT
Not a precise subject, but something along the lines : here is how one would do stuff X in a classical mainstream OO language, and now here is how one would do same thing in lisp could help e.g. java devs cross the bridge. There's been a recent question on the ml regarding the management of big

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Rock
Yeah, Quasiquotation in Lisp https://eprints.kfupm.edu.sa/ 60346/1/60346.pdf, that's the one. I've already posted some material regarding syntax-quote in the Learning Clojure Wiki. As for Bawden's and Graham's tips, it basically all boils down to this (adapted from ACL by Graham): Syntax-quote

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Sean Devlin
Laurent, Which thread are you referring to? Sean On Jan 25, 11:45 am, Laurent PETIT laurent.pe...@gmail.com wrote: Not a precise subject, but something along the lines : here is how one would do stuff X in a classical mainstream OO language, and now here is how one would do same thing in lisp

Re: Clojure Conference Poll

2010-01-25 Thread caljunior
Amit Rathore amitrath...@gmail.com wrote: ok folks, we need some more real opinions... :) we're thinking it will be in the Bay Area, some time during early fall. weekend seems logical from the responses so far... I've only counted two votes for the Bay Area as a first choice so far in this

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Rock
For anyone interested, I have just added the above material to the Learning Clojure Wiki. I hope you find it useful. Here's the link: http://en.wikibooks.org/w/index.php?title=Learning_Clojurestable=0shownotice=1#Nested_Syntax-quotes -- You received this message because you are subscribed to

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Laurent PETIT
2010/1/25 Sean Devlin francoisdev...@gmail.com: Laurent, Which thread are you referring to? Found it !, here : http://groups.google.com/group/clojure/browse_thread/thread/2cfb3335f3e5f940# Sean On Jan 25, 11:45 am, Laurent PETIT laurent.pe...@gmail.com wrote: Not a precise subject, but

Re: newbie question about ns and :require

2010-01-25 Thread Manfred Lotz
On Sun, 24 Jan 2010 12:28:16 -0800 (PST) Justin Kramer jkkra...@gmail.com wrote: You may find this ns cheatsheet helpful: http://gist.github.com/284277 Justin A good pointer. -- Thanks, Manfred -- You received this message because you are subscribed to the Google Groups Clojure

Final releases for clojure-contrib 1.0.0 and 1.1.0

2010-01-25 Thread Stuart Sierra
Hello all, We are finally ready to release clojure-contrib 1.0.0 and 1.1.0! Major/minor version numbers of contrib match major/minor version numbers of Clojure. So if you're using Clojure 1.0, use contrib 1.0.0; if you're using Clojure 1.1, use contrib 1.1.0. Get pre-built ZIP distributions

Re: Jython interop

2010-01-25 Thread rob
Thanks again Marc, I made a note of it on the StackOverflow thread. On Jan 25, 2:41 pm, Marc Downie m...@openendedgroup.com wrote: On Mon, Jan 25, 2010 at 5:34 PM, rob r.p.l...@gmail.com wrote: Thank you for these good ideas!  I'm going to try it.  My goal is to use the Natural Language

tweaking stm parameters?

2010-01-25 Thread Raoul Duke
hi, are there plans for the stm to expose parameters sorta like how jvm gc's do, so people can if need be tweak the stm to better fit their personal application? thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Why is this code so slow?

2010-01-25 Thread ataggart
Changing (concat primes [k]) to (conj primes k) gave me an order of magnitude performance increase. On Jan 24, 1:19 pm, Nebojsa Stricevic nebojsa.strice...@gmail.com wrote: Greetings, I'm new to Clojure and working my way through Project Euler problems for learning. I stuck with problem 7,

Re: Why is this code so slow?

2010-01-25 Thread ataggart
Small things (read: I didn't notice any performance change in my tests)... You can also pull the (. Math sqrt number) into the let binding so it's not calculated every time the anonymous function is called. Also the reduce call in no-dividers? doesn't short-circuit when it hits a false. I'd

Re: Full Disclojure - I Need Topics!

2010-01-25 Thread Jeff Rose
Thanks a lot for the videos you've done so far. I watch them all. Here are some ideas for shows, from more Clojure centric to just interesting: * defprotocol, deftype, reify, ... * data-flow programming * pattern matching * monads * performance tuning (unboxed numbers, type hints, ...?) * making

Re: defprotocol and ns best practice?

2010-01-25 Thread ataggart
I think of defprotocol/deftype as a dispatching mechanism to the functions named in the protocol. As such, it doesn't make sense (within the scope of a single namespace) to declare the same function name in two protocols any more than it would make sense to call defn twice with the same name. In

Re: defprotocol and ns best practice?

2010-01-25 Thread Raoul Duke
On Mon, Jan 25, 2010 at 4:29 PM, ataggart alex.tagg...@gmail.com wrote: In the example you present, I'd say you have one protocol with toString, and say two other protocols, each declaring their own relevant functions, and a deftype can implement what protocols it wishes. thanks, that sounds

Re: newbie question about ns and :require

2010-01-25 Thread Steven E. Harris
Justin Kramer jkkra...@gmail.com writes: You may find this ns cheatsheet helpful: http://gist.github.com/284277 That is most helpful. What's not helpful is the weird mix of lists and vectors used by these forms. When I finally made it to :rename accepting a map, I had to take a break. --

Re: newbie question about ns and :require

2010-01-25 Thread Raoul Duke
What's not helpful is the weird mix of lists and vectors used by these forms. When I finally made it to :rename accepting a map, I had to take a break. so, like, this means i /not/ the only one who finds the whole (whatever you want to call it) include/import syntax kinda crazy? phew. -- You

Re: Domain Modelling

2010-01-25 Thread Barry Dahlberg
Thanks for the thoughts everyone, I'm having a read through that paper now. I'm still looking for some code to read because while what you are saying makes, I've done so much OOP my brain is having a hard time making the jump. Also added it as an suggestion in this thread if anyone else is

Inconsistent behavior in 1.2.0-master w.r.t. previous versions

2010-01-25 Thread Zach Tellman
At the REPL, in 1.2.0-master (meta (second '(a #^b c))) nil In 1.1.0-new (and I believe all previous versions) (meta (second '(a #^b c))) {:tag b} Is this intentional, or a bug? Is the new type hint syntax being introduced in 1.2? -- You received this message because you are subscribed to

Re: Inconsistent behavior in 1.2.0-master w.r.t. previous versions

2010-01-25 Thread wlr
Works for me. user [*clojure-version* (meta (second '(a #^b c)))] [{:interim true, :major 1, :minor 2, :incremental 0, :qualifier master} {:tag b}] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Inconsistent behavior in 1.2.0-master w.r.t. previous versions

2010-01-25 Thread Zach Tellman
I've double-checked I have the latest from github, cleaned and recompiled, and I'm still getting the same results. user= [*clojure-version* (meta (second '(a #^b c)))] [{:interim true, :major 1, :minor 2, :incremental 0, :qualifier master} nil] Does anyone have an idea what's going on here? On

Re: Inconsistent behavior in 1.2.0-master w.r.t. previous versions

2010-01-25 Thread Chouser
On Mon, Jan 25, 2010 at 10:52 PM, Zach Tellman ztell...@gmail.com wrote: At the REPL, in 1.2.0-master (meta (second '(a #^b c))) nil In 1.1.0-new (and I believe all previous versions) (meta (second '(a #^b c))) {:tag b} Is this intentional, or a bug?  Is the new type hint syntax being

help with serializing/deserializing structs

2010-01-25 Thread jleehurt
Hi all, I am writing a distributed program using Clojure. I am trying to write some code to pass structs around to different nodes on the network by serializing and deserializing strings. I do not fully understand how to use *print-dup* and read to do this. The last line of the following gives

Re: Announcement: Vijual Graph Layout Library for Clojure Version 0.1

2010-01-25 Thread Travis
Any plans to add SVG support? Seems it would, if anything, be easier than formatting ascii. You could then open it up and color/move stuff. Any ideas about compatibility with graphviz(.org)? Maybe a .dot file export? I've considered making a .dot builder myself. -- You received this message

Re: C interop lib (JNA wrapper)

2010-01-25 Thread mac
This looks pretty nice - one question though: is there an API provided that would let me build callbacks and structs programmatically - as opposed to the declarative style of defclib? Not currently but it's definetly doable. I already use clojure.asm to generate classes on the fly. I have

Re: Domain Modelling

2010-01-25 Thread pmf
On Jan 25, 7:20 pm, Roman Roelofsen roman.roelof...@googlemail.com wrote: After playing around with clojureql I noticed how well the relational data model maps to a functional language. Processing lists (result sets), joining, filter, group by, etc. are ideas I found in both worlds. I am