Aw: Re: Where to place Arguments

2011-06-14 Thread Meikel Brandmeyer
Hi, another one which caught me recently is nthnext. I expected (nthnext 5 some-seq), but Clojure complained about 5 being not a sequence. :] Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Aw: Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Meikel Brandmeyer
Hi, indeed. On the other hand the atom has the advantage of making the loop easily interuptible from the outside. YMMV. :) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 15, 12:41 pm, Christian Schuhegger wrote: > Ah, sorry, perhaps I misunderstand you, but if you use multimethods > (defmulti) in Clojure you do not need to "attach" methods to anything. > The defmulti will allow you "dispatch-on-type" based on the key which > is present in the map  (e.g. if

Re: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Could someone add this as a Jira ticket or similar to be reviewed? Ambrose On Wed, Jun 15, 2011 at 2:43 AM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > Inspired by "seq"/"empty?" docstrings. > > not-any? > > Returns false if (pred x) is logical true for any x in coll, > els

Re: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
On Wed, Jun 15, 2011 at 9:14 AM, CuppoJava wrote: > There is one use of any? over some which hasn't been mentioned: > checking whether a list contains a nil. > > ie. (when (any? nil? xs) (do stuff)) > vs. (when (some nil? xs) (do stuff)) > > Actually, this case works with `some`. user=> (def any?

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Albert Cardona
Hi Meikel, it surprised me that you used an atom to run the event loop. A simple loop/recur also works, at least in clojure 1.2.1: (loop [] (let [input (read-line)] (when (pos? (count input)) (println (pick phrases)) (recur Just for the record. Best, Albert -- http://

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Christian Schuhegger
Ah, sorry, perhaps I misunderstand you, but if you use multimethods (defmulti) in Clojure you do not need to "attach" methods to anything. The defmulti will allow you "dispatch-on-type" based on the key which is present in the map (e.g. if :delete is present or if :insert is present). The nice th

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 15, 11:51 am, Mark Engelberg wrote: > On Tue, Jun 14, 2011 at 7:41 PM, Matthew Phillips wrote: > > Yes. I agree that can work, and that's what I've done in some other > > situations, but it has the downside of lots of "recur" points > > sprinkled around the loop body, which I think makes i

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Mark Engelberg
On Tue, Jun 14, 2011 at 7:41 PM, Matthew Phillips wrote: > Yes. I agree that can work, and that's what I've done in some other > situations, but it has the downside of lots of "recur" points > sprinkled around the loop body, which I think makes it almost as hard > to reason about as having lots of

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 4:40 pm, Alex Osborne wrote: > Matthew Phillips writes: > > The only way I can think of to write it in Clojure is: > > > (reduce > >   (fn [items op] > >     (let [items1 (if (:delete op) (drop-index (:delete op) items) > > items)] > >       (if (:insert op) (cons (:insert op) items1)

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 12:30 pm, Mark Engelberg wrote: > On Mon, Jun 13, 2011 at 7:37 PM, Matthew Phillips wrote: > > List items = initialItems (); > > > for (Op op : operations) > > { > >  if (op.requiresDelete ()) > >    items.remove (op.indexToDelete ()); > > >  if (op.requiresAdd ()) > >    items.add (op

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Matthew Phillips
On Jun 14, 12:05 pm, gaz jones wrote: > if i was writing the java i would probably do a "tell dont ask" > refactoring so that the operations had an applyTo method: > > List items = initialItems (); > > for (Op op : operations) > { >   op.applyTo(items); > > } > > not sure what your op data structu

Re: Using clojure-csv

2011-06-14 Thread David Santiago
I think the basic problem is Clojure is not able to find the clojure-csv jar file. I'm afraid I'm not quite clear enough on your specific setup to know exactly what has gone wrong. I'm not sure where you have this jar, or what exactly the shell scripting stuff is in that command you're using to lau

Re: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 5:00 PM, Sean Corfield wrote: > On Tue, Jun 14, 2011 at 10:29 AM, Chris Redinger wrote: >> http://clojure-conj.org >> Ticket, venue and initial speaker information has been posted. Sign up >> today! > > Already bought my ticket :) > > The link to the hotel reservation syst

Re: No any? function

2011-06-14 Thread CuppoJava
There is one use of any? over some which hasn't been mentioned: checking whether a list contains a nil. ie. (when (any? nil? xs) (do stuff)) vs. (when (some nil? xs) (do stuff)) -Patrick On Jun 14, 9:00 pm, Ken Wesson wrote: > On Tue, Jun 14, 2011 at 12:29 PM, Ambrose Bonnaire-Sergeant > > w

Re: No any? function

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 12:29 PM, Ambrose Bonnaire-Sergeant wrote: > "some" is a poster boy for Clojure's well thought out truthyness system, > this is a great example of the types of general functions it allows. Notably, with a map as first argument it returns the first (truthy) mapped value for

Re: Where to place Arguments

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 8:12 PM, Sean Corfield wrote: > On Tue, Jun 14, 2011 at 1:28 PM, Nick Zbinden wrote: >> Stu said: >> Objects should be the first parameter to a function (like it would be >> in traditional OO). >> Collections sould be in the last place in th parameter list. >> >> This is b

Re: Using clojure-csv

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 3:26 PM, octopusgrabbus wrote: > This fails: > > (ns test-csv >  (:import (java.io BufferedReader))) >  (use clojure-csv.core) > > with java.lang.ClassNotFoundException: clojure-csv.core > (NO_SOURCE_FILE:6) > > What am I doing wrong? One thing that stands out is that it s

Re: Where to place Arguments

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 1:28 PM, Nick Zbinden wrote: > Stu said: > Objects should be the first parameter to a function (like it would be > in traditional OO). > Collections sould be in the last place in th parameter list. > > This is because it makes the use of the threading operater easy -> for >

Re: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Sean Corfield
On Tue, Jun 14, 2011 at 10:29 AM, Chris Redinger wrote: > http://clojure-conj.org > Ticket, venue and initial speaker information has been posted. Sign up > today! Already bought my ticket :) The link to the hotel reservation system doesn't seem to be working at the moment tho'... -- Sean A Cor

Re: Using clojure-csv

2011-06-14 Thread octopusgrabbus
In regards to the extra_classpath question, this is what Synaptic installed in /usr/bin/clojure #!/bin/sh if [ "x$CLASSPATH" = "x" ] ; then extra_classpath="" else extra_classpath=":$CLASSPATH" fi while true ; do case "$1" in -cp | -classpath)

Re: Using clojure-csv

2011-06-14 Thread octopusgrabbus
Thanks. You've answered my question. I've got to set up a real projects directory and build the jar file. I appreciate everyone's patience during this "cockpit error" phase of my learning Clojure. On Jun 14, 4:04 pm, Chas Emerick wrote: > clojure-csv is not a part of clojure-contrib.  What is at

Re: Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Anthony Grimes
Awesome! Looking forward to it. :) -- 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 f

Where to place Arguments

2011-06-14 Thread Nick Zbinden
Hallo all, I just watched the talk Radical Simplicity (bit.ly/lsub9h) by Stuart Halloway. Very Intressting but one little thing he says I wanted to threw in the groupe because its kind of a half know thing and it should really move into the Clojure Coding Standard. Stu said: Objects should be th

Re: bug in partition?

2011-06-14 Thread Razvan Rotaru
Thanks for the hint. And don't worry about the meaning of this function. :) Name parameter has no use. And the regex stuff's for the url. Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Using clojure-csv

2011-06-14 Thread Chas Emerick
clojure-csv is not a part of clojure-contrib. What is at $extra_classpath? For this to work, it would need to include the jar for clojure-csv. - Chas P.S. Mostly off-topic: the sooner you can get away from whatever re-packaging your distro has put together for Clojure, the better off you'll b

Re: hammock driven development...

2011-06-14 Thread Devin Walters
It might get people to quit looking at their infernal phones and laptops for 5 minutes. ;) -- Devin Walters On Tuesday, June 14, 2011 at 2:50 PM, Laurent PETIT wrote: > Would be very funny if for the upcoming clojure conj, attendants as > well as speakers were all lying in hammocks ! > That c

Re: hammock driven development...

2011-06-14 Thread Laurent PETIT
Would be very funny if for the upcoming clojure conj, attendants as well as speakers were all lying in hammocks ! That certainly would make the Buzz ! :-D 2011/6/12 Nick Brown : > Going for walks also helps me.  Having some form a mild physical > activity that I don't have to concentrate on seems

Re: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Razvan Rotaru
You may also want to have a look at slimv. http://www.vim.org/scripts/script.php?script_id=2531 It performs quite nice (can't compare it with vimclojure though, 'cause I don't know vimclojure). Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Using clojure-csv

2011-06-14 Thread octopusgrabbus
I am trying to use clojure-csv, but am having a lot of cockpit error. Here is my current configuration: Running Clojure 1.2.1. Modified a shell script installed by Synaptic to include clojure- contrib.jar: exec java -cp /usr/share/java/clojure.jar:/usr/share/java/clojure- contrib.jar"$extra_class

Re: No any? function

2011-06-14 Thread Kevin Baribeau
Looks good to me. I wasn't familiar with the docs around (seq x) vs (not (empty? x)). That seems like a good place to draw the language from. -kb On Tue, Jun 14, 2011 at 1:43 PM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > Inspired by "seq"/"empty?" docstrings. > > not-any

Re: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Inspired by "seq"/"empty?" docstrings. not-any? Returns false if (pred x) is logical true for any x in coll, else true - same as (not (some pred coll)). some Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this

Re: No any? function

2011-06-14 Thread Kevin Baribeau
I actually had the same thought as the OP when reading through docs not too long ago. +1 for adding a pointer to "some" in the docstring of "not-any?" -kb On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > Hi David, > > any? would be redundant an

Re: Simple Empty Vector Question

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Yes that is correct. These forms are equivalent: (defn login-page [] ...) (def login-page (fn [] )) Thanks, Ambrose On Wed, Jun 15, 2011 at 1:51 AM, octopusgrabbus wrote: > In the following code (from Brian Carper's cow-blog) > > (defn login-page > "Page to let an admin log in." > [] >

Simple Empty Vector Question

2011-06-14 Thread octopusgrabbus
In the following code (from Brian Carper's cow-blog) (defn login-page "Page to let an admin log in." [] {:title "Login" :body [:div [:h3 "Log in"] (form-to [:post "/login"] (form-row "Username" "username" text-field) (form-row "Password" "pa

Early Registration has opened for Clojure Conj 2011!

2011-06-14 Thread Chris Redinger
http://clojure-conj.org Ticket, venue and initial speaker information has been posted. Sign up today! -- Christopher Redinger Clojure/core http://clojure.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: No any? function

2011-06-14 Thread Ambrose Bonnaire-Sergeant
Hi David, any? would be redundant and less general than some, if I am not mistaken. Compare the docstrings for the hypothetical "any?". (some p coll) Returns the *first logical true value* of (pred x) for any x in coll, else *nil*. (any? p coll) Returns *true* if (pred x) is logical true for a

RE: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Bhinderwala, Shoeb
Thanks Meikel. This did exactly what I wanted. Thanks for your efforts. From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of Meikel Brandmeyer Sent: Tuesday, June 14, 2011 7:25 AM To: clojure@googlegroups.com Subject: Aw: Vim Nailgun se

Re: Svar: transients are not designed to be bashed in-place

2011-06-14 Thread David Nolen
On Tue, Jun 14, 2011 at 1:56 AM, alsor wrote: > Just out of curiosity, are these some implementation's peculiarities or > it's intentional design? Intentional design. David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: Svar: Ideas from Fortress

2011-06-14 Thread Denis Labaye
>From my emacs start up file: ;; prevent slime to crash when encountering non ascii char (set-language-environment "UTF-8") (setq slime-net-coding-system 'utf-8-unix) Le 14 juin 2011 06:16, "jlk" a écrit : > Hello > > Is there a trick to making this work in emacs/slime? > > If I enter pi in the *

Re: Aw: Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Yes, you're right - if I'm going to use transients, then I have to be sure that .search is single-threaded. Because I can't have both - transient's mutable properties and STM's properties of atom. So, in my case I can use combination of atom and transients - because I know exact Searcher's impl

No any? function

2011-06-14 Thread de1976
Hello everyone. In looking through the API documentation, I've noticed that there is a "not-any?" function available, but there is no corresponding inverse "any?" function that I can find. There are, however, "every?" and "not-every?" functions available. The closest I could find was "some", but wo

Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Oh no, now the swap! might be a problem... from its doc: "Note that f may be called multiple times, and thus should be free of side effects", and I think it's no more side-effect free when we are using transients. So close! :-) -- You received this message because you are subscribed to the Go

Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Wow, that's really good idea! Returned value of conj! is not ignored, and overall function should not produce unnecessary garbage on the heap. Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Svar: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Just out of curiosity, are these some implementation's peculiarities or it's intentional design? -- 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 modera

Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
The thing is, this .search method will invoke MyCustomCollector.collect method many times, for each matching document. -- 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

Re: transients are not designed to be bashed in-place

2011-06-14 Thread alsor
Thanks for the interesting point about possible parallel implementation of search method. I think I will stay with atom implementation, because in this particular case I don't need to squeeze out maximum performance from this function. But I wonder, what if in some similar case the performance

Re: SQL queries on csv-files

2011-06-14 Thread Mark
Although it may be overkill for you, take a look at Teiid: http://teiid.org On Jun 14, 5:30 am, finbeu wrote: > Hello, > > I have a couple of csv files that are actually dumped data from SQL > tables. These tables have proper relationships with key, foreign keys > so they can be easily joined u

SQL queries on csv-files

2011-06-14 Thread finbeu
Hello, I have a couple of csv files that are actually dumped data from SQL tables. These tables have proper relationships with key, foreign keys so they can be easily joined using SQL. I would like to load them into memory and then appy SQL queries on that data. So in fact, I'm looking for a cloj

Re: lein and emacs

2011-06-14 Thread Matjaz Gregoric
If you need extra libraries in your classpath, you can give lein-oneoff plugin a try: https://github.com/mtyaka/lein-oneoff Using lein-oneoff, you should first define your dependencies in a clojure file (mydeps.clj) and then issuing the following command: lein oneoff --swank mydeps.clj This will

Re: lein and emacs

2011-06-14 Thread Rasmus Svensson
2011/6/14 Vincent : > > Dear all , > I am using emacs with lein > I want to try out repl in emacs , but without creating a new project using > lien > Presently , following steps i have to do to start repl > 1. lein new project1   ( dummy project   as i have only run repl ) > 2. cd project1 > 3

Aw: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Meikel Brandmeyer
Hi, do it the other way around. First start the repl. Then do a "(require 'vimclojure.nails) (vimclojure.nails/start-server-thread)". This will setup the vim backend in the background while you can still work with the repl. Hope that helps. Sincerely Meikel -- You received this message becau

Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Shoeb Bhinderwala
I setup Vim to use nailgun server. I start the nailgun server using "lein vimclojure" plugin and use the VimClojure vim plugin to connect to it. Everything works great and I can start a REPL inside Vim using the command :ClojureRepl. All of this is on Windows 7. However, I want to start a REPL on

Re: lein and emacs

2011-06-14 Thread Tassilo Horn
Vincent writes: Hi! > I am using emacs with lein Depending on you clojure-mode version (I think you need 1.9.1), it's possible that M-x clojure-jack-in RET does everything needed to fire up a SLIME REPL in emacs. Have a look at the thread "Radically simplified Emacs and SLIME setup" start

lein and emacs

2011-06-14 Thread Vincent
Dear all , I am using emacs with lein I want to try out repl in emacs , but without creating a new project using lien Presently , following steps i have to do to start repl 1. lein new project1 ( dummy project as i have only run repl ) 2. cd project1 3. modifying project.clj to set

Re: rand-nth throwing an exception

2011-06-14 Thread Jarek Siembida
I don't think either is worse or better, the lack of consistency is imho worse than either of the approaches. One has to remember that in the corner case function A behaves this way but function B behaves the other way. jarek -- In theory, there is no difference between theory and practice. But

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Alex Osborne
Matthew Phillips writes: > The only way I can think of to write it in Clojure is: > > (reduce > (fn [items op] > (let [items1 (if (:delete op) (drop-index (:delete op) items) > items)] > (if (:insert op) (cons (:insert op) items1) items1))) > items ops) > > i.e. I'm using a cascade

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Stuart Campbell
On 14 June 2011 12:37, Matthew Phillips wrote: > The only way I can think of to write it in Clojure is: > > (reduce > (fn [items op] >(let [items1 (if (:delete op) (drop-index (:delete op) items) > items)] > (if (:insert op) (cons (:insert op) items1) items1))) > items ops) > > i.e. I'

Aw: Re: Aw: Re: transients are not designed to be bashed in-place

2011-06-14 Thread Meikel Brandmeyer
Hi again, ok. This is not entirely correct. It depends on how your searcher works. If it works on several threads in parallel, there would be an issue, but the transient would barf in that case anyway. So you would get an exception and hence be safe. Sincerely Meikel -- You received this mes