On 18 August 2010 04:44, Justin Kramer wrote:
> On Aug 17, 4:42 pm, Alan wrote:
>> Devious! The OP wanted to handle underflow of the subs collection
>> though, so you need a tweak:
>> (apply assoc v (interleave (positions nil? v)
>> (concat subs (repeat nil
>
> inte
On Tue, Aug 17, 2010 at 07:59, HB wrote:
> Hey,
> How to install Clojure on Mac OS X?
>
I wrote this pre 1.2:
https://docs.google.com/Doc?docid=0AW2Ojyy-IGoHZGR0c256dmZfNTRjenBoYnBjaA&hl=en
There are likely a few changes needed but a cursory glance and it mostly
looks right. In summary - use em
It's always bothered me that when inspecting a class in Slime the
method names are highlighted in the same color as public static int
etc. I think it makes it hard to see what methods are available.
I wrote this elisp that highlights the method names in a different color:
(add-hook 'slime-inspect
On Aug 17, 4:42 pm, Alan wrote:
> Devious! The OP wanted to handle underflow of the subs collection
> though, so you need a tweak:
> (apply assoc v (interleave (positions nil? v)
> (concat subs (repeat nil
interleave stops once either collection is exhausted. In you
I usually do:
1) lein new your-project-name
2) cd your-project-name, add :dev-dependencies [[swank-clojure "1.3.0-
SNAPSHOT"]] to your project.clj, and run lein deps
3) run lein swank
4) Connect from emacs with M-x slime-connect and accept the default
options it gives you.
I haven't had any tro
If solving a more general problem first counts as elegant, then here
is a solution:
(defn map-replace
"Return coll but replace every element for which pred returns true
with
(f element replacement-element) as long as there are replacement
elements in
replacements"
[pred f coll replacements]
Devious! The OP wanted to handle underflow of the subs collection
though, so you need a tweak:
(apply assoc v (interleave (positions nil? v)
(concat subs (repeat nil
On Aug 17, 1:10 pm, Justin Kramer wrote:
> With the precondition that the first collection is a vect
Sorry my message got truncated. Let's try again:
Fuzzy completion (ac-source-slime-fuzzy) isn't working for me. It complains
that the function slime-fuzzy-completions is not defined. I'm using
slime.el version 2010404, which does not define that function, although it
does define slime-simple-co
This is great, thanks!
Fuzzy completion (ac-source-slime-fuzzy) isn't working for me. It complains
that slime-fuzzy-comp
On Sat, Aug 14, 2010 at 5:19 AM, Steve Purcell wrote:
> Hi all,
>
> A while ago I hooked Slime's completion and documentation features into the
> popular Emacs auto-completi
Oh, and, duh. Both lists are traversed at each iteration as Nicolas
stated.
On Aug 17, 3:56 pm, Rising_Phorce wrote:
> I posted because clojure *tends* to be so succinct and in this case
> the solution complexity seems disproportionate to the problem. In my
> first post I forgot to mention my s
(defn fill [coll subs]
(lazy-seq
(when-let [[x & nx :as xs] (seq coll)]
(if-let [[y & ny :as ys] (seq subs)]
(if (nil? x)
(cons y (fill nx ny))
(cons x (fill nx ys)))
xs
On Aug 17, 6:30 am, Rising_Phorce wrote:
> Hi All:
>
> First of all thanks
I think there's a lot of questions that a Clojure programmer faces
when doing web programming, not only regarding how the libraries work,
but also regarding how to design a larger-than-trivial web
applications.
A mail list would be a very good way to be able to ask for advice or
to be inspired by
Neither particularly short nor particularly clever:
(defn nil-coalesce [coll subs]
(loop [[c & cs :as coll] coll
[s & ss :as subs] subs
acc []]
(if coll
(recur cs
(if (nil? c) ss subs)
(conj acc (if (nil? c) s c)))
acc)))
On Tue, Aug 1
Another one that works with all collections. Short, but not
necessarily the most efficient:
(use '[clojure.contrib.seq-utils :only [positions]])
(defn nil-coalesce [coll subs]
(map-indexed (zipmap (positions nil? coll) subs) coll))
Justin
On Aug 17, 4:10 pm, Justin Kramer wrote:
> With the p
Hi,
Am 17.08.2010 um 21:56 schrieb Rising_Phorce:
> I posted because clojure *tends* to be so succinct and in this case
> the solution complexity seems disproportionate to the problem.
I think the plain lazy-seq version is a pretty straight-forward translation. I
don't think, that it is overly
On Tue, Aug 17, 2010 at 3:56 PM, Rising_Phorce wrote:
> I posted because clojure *tends* to be so succinct and in this case
> the solution complexity seems disproportionate to the problem. In my
> first post I forgot to mention my second attempt...
>
> (map #(if (nil? %1) %2 %1) [nil 1 2 3 nil ni
With the precondition that the first collection is a vector:
(use '[clojure.contrib.seq-utils :only [positions]])
(defn nil-coalesce [v subs]
(apply assoc v (interleave (positions nil? v) subs)))
Justin
--
You received this message because you are subscribed to the Google
Groups "Clojure" gr
I posted because clojure *tends* to be so succinct and in this case
the solution complexity seems disproportionate to the problem. In my
first post I forgot to mention my second attempt...
(map #(if (nil? %1) %2 %1) [nil 1 2 3 nil nil] [4 5])
but it got ugly because I needed to extend the replac
Er..
This version is better. Uses hasNext instead of catching the exception:
(defn lazy-read-records [file regex]
(let [scanner (java.util.Scanner. file)
get-next (fn get-next []
(if (not (.hasNext scanner))
()
(cons (.next s
I am playing a bit with shapado (open source stackoverflow clone in
ruby, I made an Esperanto QA site with it at demandoj.tk) and maybe
it's an idea to create a clojure webdev shapado thus creating a fun to
use self-documenting system and using the wikipages etc to provide
more information of all s
I'm assuming your problem is with memory, and not multithreaded reading. Given
that:
I also work with files much too big to fit into memory.
You could just use java.util.Scanner. That has a useDelimiter method, so you
can set the pattern to break on:
(defn lazy-read-records [file regex]
(let
I'm new to Clojure and fairly new to FP in general. I'm trying to write a web
app in Clojure and I would definitely like to see something like that.
Tim
From: Saul Hazledine
To: Clojure
Sent: Tue, August 17, 2010 10:15:30 AM
Subject: Clojure Web Programming
On Aug 17, 8:21 pm, Brian Carper wrote:
> On Aug 17, 7:15 am, Saul Hazledine wrote:
>
> > One idea I had though was to go one step further and start a Clojure
> > web development group so that other developers of small libraries and
> > users of them could go to one place for support and discussi
On Aug 17, 7:15 am, Saul Hazledine wrote:
> One idea I had though was to go one step further and start a Clojure
> web development group so that other developers of small libraries and
> users of them could go to one place for support and discussion. Would
> this be uncool or would it be useful?
>
On Aug 17, 6:22 pm, Michael Gardner wrote:
>
> What's wrong with MacPorts? I've used it to install Clojure (and many other
> things) on my Mac, without much trouble.
I've never used MacPorts with Clojure and don't use a Mac at all now
so things might have improved. However, I had 3 years of trou
On Tue, Aug 17, 2010 at 1:38 PM, Nicolas Oury wrote:
>>
>> Clojure golf is the most fun golf!
>>
>> (defn nil-coalesce [a b]
>> (map #(or %1 %2) a (concat b (repeat nil
>>
>> Or if you really want to treat nil and false differently:
>>
>> (defn nil-coalesce [a b]
>> (map #(if (nil? %1)
>
> Clojure golf is the most fun golf!
>
> (defn nil-coalesce [a b]
> (map #(or %1 %2) a (concat b (repeat nil
>
> Or if you really want to treat nil and false differently:
>
> (defn nil-coalesce [a b]
> (map #(if (nil? %1) %2 %1) a (concat b (repeat nil
>
I am not sure to get it.
On Tue, Aug 17, 2010 at 9:30 AM, Rising_Phorce wrote:
> Hi All:
>
> First of all thanks for the replies to my last post the clojure
> community is great!
>
> I've been trying to find a succinct way to do the following. Given
> two sequences, product a new sequence which takes items from the first
On Aug 17, 2010, at 10:17 AM, Saul Hazledine wrote:
> On Aug 17, 3:59 pm, HB wrote:
>> Hey,
>> How to install Clojure on Mac OS X?
>> I googled the web, some use MacPorts, others write some shell scripts.
>> Is there a -standard- way to install Clojure on OS X (if possible,
>> please don't refer
I'm also a relative newbie who works mostly in OS X. If you really just want
the core language support and you're going to call java from the command line
then you can do the platform-agnostic download from
http://clojure.org/downloads and that should work fine. If you want more, like
an IDE w
Here's a pass using reduce, keeping both collections in the return value,
conj-ing to one and taking from the other as necessary...
(defn nil-coalesce [coll subs]
(first (reduce (fn [[a b] x]
(if x
[(conj a x) b]
[(conj a (first b)) (
On Tue, Aug 17, 2010 at 12:17 PM, David Nolen wrote:
> On Tue, Aug 17, 2010 at 12:00 PM, HB wrote:
>
>> How cake is differ from Dejour?
>> http://github.com/russolsen/dejour
>> Thanks all for help.
>>
>
> - "instant-on" REPLs
> - Excellent tab-completion
> - Actively developed
> - My TextMate Clo
On Tue, Aug 17, 2010 at 12:00 PM, HB wrote:
> How cake is differ from Dejour?
> http://github.com/russolsen/dejour
> Thanks all for help.
>
- "instant-on" REPLs
- Excellent tab-completion
- Actively developed
- My TextMate Clojure bundle relies on it ;)
http://github.com/swannodette/textmate-clo
How cake is differ from Dejour?
http://github.com/russolsen/dejour
Thanks all for help.
On Aug 17, 6:41 pm, David Nolen wrote:
> On Tue, Aug 17, 2010 at 10:59 AM, HB wrote:
> > Hey,
> > How to install Clojure on Mac OS X?
> > I googled the web, some use MacPorts, others write some shell scripts.
Currently, I just to play around Clojure and TextMate.
Ne need for the heavy guns :)
On Aug 17, 6:39 pm, cej38 wrote:
> My first question would be how do you want to interact with clojure?
> Are you going to be using something like Netbeans, or emacs, or
> [shudder] vi? The answer really kinda d
On Tue, Aug 17, 2010 at 10:15 AM, Saul Hazledine wrote:
>
> One idea I had though was to go one step further and start a Clojure
> web development group so that other developers of small libraries and
> users of them could go to one place for support and discussion. Would
> this be uncool or would
help please
On Aug 16, 5:22 pm, cej38 wrote:
> Hello,
> I work with text files that are, at times, too large to read in all
> at one time. In searching for a way to read in only part of the file
> I came acrosshttp://meshy.org/2009/12/13/widefinder-2-with-clojure.html
>
> I am only interested
On Tue, Aug 17, 2010 at 10:59 AM, HB wrote:
> Hey,
> How to install Clojure on Mac OS X?
> I googled the web, some use MacPorts, others write some shell scripts.
> Is there a -standard- way to install Clojure on OS X (if possible,
> please don't refer me to MacPorts)?
> Thanks all for help and ti
My first question would be how do you want to interact with clojure?
Are you going to be using something like Netbeans, or emacs, or
[shudder] vi? The answer really kinda depends on that.
I really like Netbeans. The Enclojure plug-in works well. Also, all
of these problems with using Macports,
On Tue, Aug 17, 2010 at 11:18 AM, Rayne wrote:
> Rather than just say they all suck, why not speak to the authors or
> submit issues/bug reports and explain why they suck. There is actually
> a clj-apache-http library that wraps Apache HTTP.
Which I've found to be quite good and idiomatic.
Dav
Rather than just say they all suck, why not speak to the authors or
submit issues/bug reports and explain why they suck. There is actually
a clj-apache-http library that wraps Apache HTTP.
On Aug 16, 7:36 pm, zahardzhan wrote:
> I try to use 4 http clients for Clojure. They are all suck. Use
> At
On Aug 17, 3:59 pm, HB wrote:
> Hey,
> How to install Clojure on Mac OS X?
> I googled the web, some use MacPorts, others write some shell scripts.
> Is there a -standard- way to install Clojure on OS X (if possible,
> please don't refer me to MacPorts)?
> Thanks all for help and time.
I used a M
Different topic, but are you talking about fields in a record defined via
defrecord? I thought those fields were not hidden (i.e. 'public').
"Encapsulation
of information is folly" as it says here: http://clojure.org/datatypes.
I agree with your point. Maybe a wee bit of encapsulation of infor
On 08/16/2010 04:12 PM, leo wrote:
I am trying to understand how efficient it would be to use Clojure to
develop an asynchronous http client for my webapp instead of using
Java. Is there any specific way one can be better than the other?
Bradford Cross of FlightCaster just wrote an excellent ar
As someone new to web development (and clojure) in general, I'm +1 on
this. I'm using compojure with ring and hiccup, and eventually
targetting appengine. Of course there are lots of things to discuss
with this, and way too many channels to effectively monitor.
On Tue, Aug 17, 2010 at 10:15 AM, Sa
Hey,
How to install Clojure on Mac OS X?
I googled the web, some use MacPorts, others write some shell scripts.
Is there a -standard- way to install Clojure on OS X (if possible,
please don't refer me to MacPorts)?
Thanks all for help and time.
--
You received this message because you are subscri
Thanks for the clarification. I think I have everything working now.
j.
On Aug 17, 3:14 pm, Meikel Brandmeyer wrote:
> Hi,
>
> luckily use is not transitive. If you want to use congomongo from
> analysis-2 you have to do:
>
> (ns my-important-project.analysis-2
> (:use somnium.congomongo))
>
>
Hi,
On 17 Aug., 04:40, cageface wrote:
> I'm not entirely sure how to interpret this. If a function is
> expecting a certain argument structure, isn't it always better to
> document that in a destructuring argument list? I'm finding that
> destructured signatures generally help me track my dataf
Hello,
Personally I really like the way web development in Clojure is
improving. Rather than huge frameworks there are different libraries
that are coming together to form a useful toolset. Even the framework
Conjure is lightweight and using general purpose libraries under the
hood.
One drawback
Hi,
luckily use is not transitive. If you want to use congomongo from
analysis-2 you have to do:
(ns my-important-project.analysis-2
(:use somnium.congomongo))
(println (fetch-one :data))
or (nameing what you need explicitly; prefered)
(ns my-important-project.analysis-2
(:use [somnium.con
Yeah! Golf!
user=> (defn nil-coalesce
[coll replacements]
(lazy-seq
(when-let [s (seq coll)]
(let [fst (first s)]
(if (nil? fst)
(cons (first replacements)
(nil-coalesce (rest s) (rest replacements)))
defprotocol is a new feature of Clojure 1.2.
A fantastic RC3 of this fantastic software is available.
A good way to get it is to use the amazing Leiningen.
On Tue, Aug 17, 2010 at 7:17 AM, Henrik Mohr wrote:
> Hi there!
>
> I'm a completely new newbie in the clojure sphere - old dog in Java
> a
Hi All:
First of all thanks for the replies to my last post the clojure
community is great!
I've been trying to find a succinct way to do the following. Given
two sequences, product a new sequence which takes items from the first
sequence unless null in which case it will take an item from the
s
On Aug 12, 10:51 pm, Stuart Halloway
wrote:
> The other thing that you should consider is that protocols are the
> contract for implementers, not the contract for callers. If you
> change a contract for implementers, then the implementers *must*
> change.
>
> Take your example of a function that h
Hi there!
I'm a completely new newbie in the clojure sphere - old dog in Java
and a handful of other languages.
But Clojure is my first (new) functional language, and I'm very
excited about it - complements on your word Rich et. al.! :-)
To learn clojure I've started with the (beta) book "Seven L
I'm a few months into learning Clojure, and thought I'd put this
function out for comment.
I need to take a message digest of files on disk. I'm using a class in
java.security to do this. The class uses an update method which
accepts an array of bytes, and updates the hash. This calls for the
comm
I feel a blog-post coming when I figured this out :-)
On Aug 17, 2:26 pm, jandot wrote:
> Thanks Rasmus, Meikel,
>
> This does help a lot already.
>
> There still seems to be an issue with using some of the things,
> though. When I do
>
> (require '(my-important-project core analysis-2))
>
> I
The standards doc on the wiki here:
http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
Makes this recommendation:
"Idiomatic code uses destructuring a lot. However, you should only
destructure in the arg list if you want to communicate the
substructure as part of the caller
I try to use 4 http clients for Clojure. They are all suck. Use
Atpache Commons HTTP Client - it is best choice.
On Aug 17, 8:12 am, leo wrote:
> I am trying to understand how efficient it would be to use Clojure to
> develop an asynchronous http client for my webapp instead of using
> Java. Is
Double-posting myself, here, just to join the fun. You can generalize
if you don't always want the same behavior:
user> (defn apply-by [glue]
(fn [f keys]
(glue keys (map f keys
#'user/apply-by
user> ((apply-by zipmap) inc (range 5))
{4 5, 3 4, 2 3, 1 2, 0 1}
user> ((appl
If you say so. I mean, I see that your example produces output
different than I might expect, but that's a function of clojure's
basic API - memoize will do the same thing:
user> (def q (atom 1))
#'user/q
user> (defn myinc [ignored] (swap! q inc))
#'user/myinc
user> (def m (memoize myinc))
#'user/
Thanks Rasmus, Meikel,
This does help a lot already.
There still seems to be an issue with using some of the things,
though. When I do
(require '(my-important-project core analysis-2))
I would logically do (in-ns 'my-important-project.analysis-2) because
that's where all the functions are tha
On 17 Aug 2010, at 13:00, Steve Purcell wrote:
> That seems to be a slime/swank problem, related to accessing the
> documentation for a symbol corresponding to a namespace. In a clojure-mode
> buffer, use M-: to execute the following expression:
>
> (slime-eval '(swank:documentation-symbol "cl
Hi,
On 17 Aug., 13:39, Rasmus Svensson wrote:
> (in-ns 'my-important-project.analysis-2)
>
> or simply use the ns macro:
>
> (ns my-important-project.analysis-2)
Please note, that these two are *not* equivalent!
With ns:
Clojure 1.1.0
user=> (ns foo.bar (:refer-clojure :exclude (map)))
nil
fo
On 17 Aug 2010, at 09:38, Stefan Kamphausen wrote:
> Hi,
>
> just yesterday I took a first look at auto-complete together with your
> slime auto completion sources.
>
> I'm encountering some Exceptions, though,
>
> If I'm in a .clj-buffer and start typing
>
> (clojure.
>
> and then wait for
Hi,
ns is not used to switch to a namespace. First require your namespace,
then use in-ns to switch to it.
(require 'my-important-project.analysis-2)
(in-ns 'my-important-project.analysis-2)
Hope this helps.
Sincerely
Meikel
--
You received this message because you are subscribed to the Googl
2010/8/17 jandot :
> Hi all,
>
> I'm trying to write a library to perform some statistical and data
> mining analyses. Clojure has proven a great help here, especially with
> the incanter library. Writing the code has been kind of an "organic"
> process (read: no planning), and I ended up with diff
Hi all,
I'm trying to write a library to perform some statistical and data
mining analyses. Clojure has proven a great help here, especially with
the incanter library. Writing the code has been kind of an "organic"
process (read: no planning), and I ended up with different conceptual
groups of fun
Hi,
just yesterday I took a first look at auto-complete together with your
slime auto completion sources.
I'm encountering some Exceptions, though,
If I'm in a .clj-buffer and start typing
(clojure.
and then wait for the auto completion to popup I see a list of
possible completions like, e.g
69 matches
Mail list logo