Re: clojure.contrib.seq vs. clojure.contrib.seq-utils

2010-12-04 Thread Ken Wesson
On Sun, Dec 5, 2010 at 12:04 AM, Sunil S Nandihalli wrote: > Hello everybody, >  Both of clojure.contrib.seq and clojure.contrib.seq-utils seem to give the > same functionality.. any idea as to which one we r supposed to be using.. Not a clue. I get the feeling the situation with contrib and core

Re: clojure.contrib.seq vs. clojure.contrib.seq-utils

2010-12-04 Thread Robert McIntyre
clojure.core.seq is preferred --- from clojure.core.seq_utils.clj ;;; seq_utils.clj -- Sequence utilities for Clojure ;; by Stuart Sierra, http://stuartsierra.com/ ;; last updated March 2, 2009 ;; Copyright (c) Stuart Sierra, 2008. All rights reserved. The use ;; and distribution terms for th

clojure.contrib.seq vs. clojure.contrib.seq-utils

2010-12-04 Thread Sunil S Nandihalli
Hello everybody, Both of clojure.contrib.seq and clojure.contrib.seq-utils seem to give the same functionality.. any idea as to which one we r supposed to be using.. Sunil. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Re: Tailing a file in Clojure

2010-12-04 Thread ax2groin
Does any familiar with this NIO Watch service know if it handles NFS issues? We have an in-house log monitoring tool at work (doesn't everyone) which is written in Java, but the two big issues are message framing (knowing when a multi-line message has ended) and getting null bytes when tailing an N

Re: Apache ws-xmlrpc

2010-12-04 Thread Rock
Yeah, thanks. I figured that one out experimenting. THE GREAT NEWS IS: I finally got Apache ws-xmlrpc working perfectly with Clojure. It wasn't so hard after all. Really cool. Works like a charm. I will be posting tomorrow the entire procedure. Too tired right now :) On Dec 5, 1:37 am, Mark Rat

Re: Temporary defs

2010-12-04 Thread Ken Wesson
On Sat, Dec 4, 2010 at 7:34 PM, Barry Dahlberg wrote: > Hi Clojurians, > > I have a macro which creates a function for me and I would like to add > some unit tests using clojure.test. How can I create a temporary scope > so that any functions defined during the test are undefined > afterwards? Her

Re: Apache ws-xmlrpc

2010-12-04 Thread Mark Rathwell
Not sure what you are trying to do. If you have an existing java class or interface that you are trying to extend, you need to specify it. If you are trying to create a new class, you probably want to look at defrecord. If extending an existing java interface or class (that is on your classpath

Temporary defs

2010-12-04 Thread Barry Dahlberg
Hi Clojurians, I have a macro which creates a function for me and I would like to add some unit tests using clojure.test. How can I create a temporary scope so that any functions defined during the test are undefined afterwards? Here is a trivial example to illustrate: (deftest my-def-macro-test

Re: ANN: Logos 0.1 - An Optimized miniKanren Logic Programming Library for Clojure

2010-12-04 Thread David Nolen
On Sat, Dec 4, 2010 at 5:58 PM, jim wrote: > Very, very nice. Excellent work. I look forward to using it. > > I was looking at porting Kanren proper to Clojure. There appear to be > some really good ideas in there that maybe could be added to Logos. > > Very well done. > > Jim I agree that ther

Re: ANN: Logos 0.1 - An Optimized miniKanren Logic Programming Library for Clojure

2010-12-04 Thread David Nolen
On Sat, Dec 4, 2010 at 6:39 PM, Jules wrote: > Interesting. Is Byrd's dissertation available online? Yes I added that and several other resource links to the bottom of the project's description on the GitHub repo. David > On Dec 4, 9:41 pm, David Nolen wrote: > > I announced it earlier this

Re: ANN: Logos 0.1 - An Optimized miniKanren Logic Programming Library for Clojure

2010-12-04 Thread Jules
Interesting. Is Byrd's dissertation available online? On Dec 4, 9:41 pm, David Nolen wrote: > I announced it earlier this week on Twitter, but it's now come far along > enough to be usable. You can write fun stuff like the following: > > (defn likes >   [x y] >   (cond-e >    ((== x 'john) (== y

Re: ANN: Logos 0.1 - An Optimized miniKanren Logic Programming Library for Clojure

2010-12-04 Thread jim
Very, very nice. Excellent work. I look forward to using it. I was looking at porting Kanren proper to Clojure. There appear to be some really good ideas in there that maybe could be added to Logos. Very well done. Jim On Dec 4, 2:41 pm, David Nolen wrote: > I announced it earlier this week on

Re: Apache ws-xmlrpc

2010-12-04 Thread Rock
NULL POINTER EXCEPTION! I was trying to create a handler for the web service above. It should be the equivalent of (Java): public class Calculator { public int add(int i1, int i2) { return i1 + i2; } public int subtract(int

Re: Fixing minmax algorithm

2010-12-04 Thread Jason Wolfe
You're looking for "apply". user2> (max 1 2 3) 3 user2> (max [1 2 3]) [1 2 3] user2> (apply max [1 2 3]) 3 -Jason On Dec 4, 3:30 am, zmyrgel wrote: > I'm trying to make a functional version of minmax algorithm as shown > in John Hughes Why functional programming matters? work > [http://www.scr

Re: Creating map from string

2010-12-04 Thread Tyler Perkins
Or, better yet, (into {} (->> (str "{" (slurp "data") "}") read-string (map (fn [[k v]] [(keyword (str k)) v] -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: Creating map from string

2010-12-04 Thread Tyler Perkins
On Dec 4, 12:21 pm, Tim Robinson wrote: > Using 'apply hash-map' doesn't handle the transformations. > Note the original post requested keywords for keys and integers for > vals in the output. I'm not the only one who overlooked that! :o) Might just as well use strings as keys. But OK, try this:

ANN: Logos 0.1 - An Optimized miniKanren Logic Programming Library for Clojure

2010-12-04 Thread David Nolen
I announced it earlier this week on Twitter, but it's now come far along enough to be usable. You can write fun stuff like the following: (defn likes [x y] (cond-e ((== x 'john) (== y 'mary)) ((== x 'mary) (== y 'john (defn musician [x] (cond-e ((== x 'john)) ((== x 'bob

Re: Apache ws-xmlrpc

2010-12-04 Thread Rock
Looks pretty good. Thank you so much. This does however worry me a little from another point of view. There's always been a lot of talk about how easy it is to interface Clojure to Java. Yet, when it comes to a lot of situations (for instance, when dealing with annotations as in the JAX-WS SOAP we

Re: Creating map from string

2010-12-04 Thread Tim Robinson
Using 'apply hash-map' doesn't handle the transformations. Note the original post requested keywords for keys and integers for vals in the output. On Dec 4, 11:49 am, Tyler Perkins wrote: > How about just > > (apply hash-map (split (slurp "data") #",")) -- You received this message because you

Re: Apache ws-xmlrpc

2010-12-04 Thread Shantanu Kumar
I guess you should look at XML-RPC2, which has a simpler usage: http://ws.apache.org/xmlrpc/xmlrpc2/server.html Regards, Shantanu On Dec 4, 10:26 pm, Rock wrote: > I'm desperately trying to implement an xml-rpc server with Clojure > (trying to convince the company I work for here in Italy to giv

Re: Creating map from string

2010-12-04 Thread Tyler Perkins
How about just (apply hash-map (split (slurp "data") #",")) -- 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 fi

Apache ws-xmlrpc

2010-12-04 Thread Rock
I'm desperately trying to implement an xml-rpc server with Clojure (trying to convince the company I work for here in Italy to give it a shot). I'm pretty well versed in Lisp, but I have yet to acquire sufficient experience with Clojure's Java interop capabilities. I've read the docs for implement

appengine-clj and appengine 1.4 SDK error

2010-12-04 Thread Miki
Greetings, My toy application stopped working after an upgrade to appengine SDK 1.4, does anyone else have the same experience? Any solutions? You can see error logs at https://github.com/r0man/appengine-clj/issues/#issue/5 (thank you r0man for helping out). The project can be found at https://bi

Re: range with decimal values

2010-12-04 Thread mch
On Dec 4, 7:42 am, Glen Rubin wrote: > (range 0.05 0.16 0.01) > > user> (0.05 0.060005 0.07 0.08 0.09 0.0 > 0.10999 0.11998 0.12998 > 0.13999 0.15) You are seeing an artifact of the fact that floating point numbers canno

Re: range with decimal values

2010-12-04 Thread Phlex
You're not playing with decimal values but rather with floating point numbers. user> (type 0.1) java.lang.Double Floating point numbers have well known rounding errors when converting to decimal. http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems you might want to use actual decim

Re: range with decimal values

2010-12-04 Thread Michael Gardner
On Dec 4, 2010, at 8:42 AM, Glen Rubin wrote: > If I use the range fn with a decimal number for step I get back > something like this: > > (range 0.05 0.16 0.01) > > user> (0.05 0.060005 0.07 0.08 0.09 0.0 > 0.10999 0.11998 0.12998

Fixing minmax algorithm

2010-12-04 Thread zmyrgel
I'm trying to make a functional version of minmax algorithm as shown in John Hughes Why functional programming matters? work [http:// www.scribd.com/doc/26902/whyfp]. I'm hitting problems when applying maximise function on my gametree. For some reason the maximise call won't return the best value

Re: Easy Way To Download Clojure Libraries From Git

2010-12-04 Thread Matjaz Gregoric
I created a leiningen plugin especially for this purpose - when you just want to play with a library/a set of libraries and creating a brand new leiningen project feels too much. It's called lein-oneoff and available here: https://github.com/mtyaka/lein-oneoff It assumes your program/script to co

binary search tree in clojure

2010-12-04 Thread Todd
As an exercise in learning clojure, I implemented a basic binary search tree in clojure: https://gist.github.com/727982 Any feedback would be appreciated. -Todd -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

range with decimal values

2010-12-04 Thread Glen Rubin
If I use the range fn with a decimal number for step I get back something like this: (range 0.05 0.16 0.01) user> (0.05 0.060005 0.07 0.08 0.09 0.0 0.10999 0.11998 0.12998 0.13999 0.15) Really I want output more like i g

Re: when to use io! macro?

2010-12-04 Thread Baishampayan Ghose
> I've recently discovered the io! macro.  Is this something to try to use all > the time.. or only in certain situations? It's useful when you are exposing some sort of an API (internal & external) and want to prohibit the use of certain functions inside transactions. Regards, BG -- Baishampay

into map with vectors versus lists (Re: Creating map from string)

2010-12-04 Thread Remco van 't Veer
I expected this to work: (into {} (partition 2 (split (slurp "data") #","))) But unfortunately, `into' doesn't seem to allow pushing lists of pairs into a map. But vectors are allowed: (into {} (map vec (partition 2 (split (slurp "data") #"," Can somebody explain why vectors are allowe