lein2 - lein version fails due to org.apache.http.impl.client.DefaultRequestDirector

2014-03-31 Thread Andrew Xue
my lein started not working mysteriously. i can't even get lein version to 
work w/o a weird error:

lein version
Mar 31, 2014 3:11:38 PM org.apache.http.impl.client.DefaultRequestDirector 
tryConnect
INFO: I/O exception (java.net.NoRouteToHostException) caught when 
connecting to the target host: No route to host
Mar 31, 2014 3:11:38 PM org.apache.http.impl.client.DefaultRequestDirector 
tryConnect
INFO: Retrying connect

anyone else seen anything like this? my network/internet seems to be 
totally fine 

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


a join function that can be used in a reduce

2013-01-14 Thread Andrew Xue
Hi --

Building some generic joining functionality on top of cascalog, the clojure 
package for big data. 

I have a join function that is defined like this:

(defn join [lhs rhs join-ons] ..implementation ...)

lhs and rhs are subqueries. the join returns then another query that is a 
join of the two.

join-ons in this case would look something like this [{lhs: user_id_lhs 
:rhs user_id_rhs :as user_id}]

each map in the vector corresponds to a join condition (in sql, the above 
would be like lhs join rhs on lhs.user_id_lhs=rhs.user_id_rhs) .. the :as 
keyword renames the join variable in the result of the join. join-ons is a 
vector of these join conditions. 

this works ok and its basically modeled after joins in sql.

however it would be nice to able to do something maybe like this

(reduce join [query1 query2 query3 ... queryN])

i am having trouble picturing how the join-ons would work in this case 
though ...

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

error in classloading because not converting hyphen to underscore

2012-05-04 Thread Andrew Xue
hi all -- i am running a clojure based library (cascalog) on top of
hadoop. i started getting errors on loading a class with the follow
stack trace:

Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.ClassNotFoundException: views.visit-facts, compiling:(views/
visit_facts.clj:1)
at cascalog.Util.tryRequire(Util.java:61)
at cascalog.Util.bootSimpleFn(Util.java:65)
at cascalog.Util.bootFn(Util.java:72)
at cascalog.ClojureCascadingBase.prepare(ClojureCascadingBase.java:
52)
...
Caused by: java.lang.RuntimeException:
java.lang.ClassNotFoundException: views.visit-facts, compiling:(views/
visit_facts.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:6235)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3503)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6411)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5572)
at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:2091)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5572)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5008)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3629)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6407)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6397)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3452)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6411)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5572)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5008)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3629)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6407)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.eval(Compiler.java:6462)
at clojure.lang.Compiler.eval(Compiler.java:6455)
at clojure.lang.Compiler.load(Compiler.java:6902)
at clojure.lang.RT.loadResourceScript(RT.java:357)
at clojure.lang.RT.loadResourceScript(RT.java:348)
at clojure.lang.RT.load(RT.java:427)
at clojure.lang.RT.load(RT.java:398)
at clojure.core$load$fn__4791.invoke(core.clj:5386)
at clojure.core$load.doInvoke(core.clj:5385)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5200)
at clojure.core$load_lib.doInvoke(core.clj:5237)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$load_libs.doInvoke(core.clj:5271)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$require.doInvoke(core.clj:5352)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:401)
at cascalog.Util.tryRequire(Util.java:51)
... 50 more
Caused by: java.lang.RuntimeException:
java.lang.ClassNotFoundException: views.visit-facts
at clojure.lang.Util.runtimeException(Util.java:165)
at clojure.lang.RT.classForName(RT.java:2017)
at clojure.lang.Compiler.resolveIn(Compiler.java:6701)
at clojure.lang.Compiler.resolve(Compiler.java:6664)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6625)
at clojure.lang.Compiler.analyze(Compiler.java:6198)
... 98 more
Caused by: java.lang.ClassNotFoundException: views.visit-facts
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:
61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.classForName(RT.java:2013)

the ns statement of this class looks like

(ns views.visit-facts
  (:use {some classes})
  (:require {some classes}])
  (:gen-class))

this class is AOT compiled into an uberjar, everything is turned into
underscores


Re: is there some way to extract the parameter list from a function

2012-01-14 Thread Andrew Xue
that is exactly what i was looking for ! thanks!

On Jan 14, 1:33 am, Baishampayan Ghose b.gh...@gmail.com wrote:
 Something like (:arglists (meta #'my-func)) ?

 Regards,
 BG









 On Sat, Jan 14, 2012 at 12:01 PM, Andrew Xue and...@lumoslabs.com wrote:
  given something like

  (defn my-func [a b c] (str a b c))

  is there something like (extract-parameters my-func) which returns (a
  b c)?

  thanks,
  andy

  --
  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 from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 Baishampayan Ghose
 b.ghose at gmail.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


destructing a map with a vector of keys?

2012-01-13 Thread Andrew Xue
trying do something like this

(def my-keys [a b c])

(defn my-func [m] (let [{:keys my-keys} m] (prn a b c)))

(my-func {:a 1 :b 2 :c 3})


tried '[a b c], ['a 'b 'c], and [a b c] for my-keys but they all
give a Don't know how to create ISeq from: clojure.lang.Symbol error

thanks
andy

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


is there some way to extract the parameter list from a function

2012-01-13 Thread Andrew Xue
given something like

(defn my-func [a b c] (str a b c))

is there something like (extract-parameters my-func) which returns (a
b c)?

thanks,
andy

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


java interop question: how to access Class object statically

2011-09-15 Thread Andrew Xue
Hi all --

Trying to basically do something like Integer.class -- but ...

user= (Integer/class)
user= java.lang.NoSuchFieldException: class (NO_SOURCE_FILE:2)

user= (Integer/getClass)
java.lang.NoSuchFieldException: getClass (NO_SOURCE_FILE:4)


Some (not so pretty) workarounds are

(.getClass (Integer. 0))
(class 0)

but there must be a better more idiomatic way to do this? Thanks

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


is there some gotchas with the contains? function and strings?

2011-08-24 Thread Andrew Xue
the below seems odd

user= (contains? [1 2] 1)
true
user= (contains? [a b] a)
false

am i missing something?

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


why is it necessary to use identity to check for nils in an if statement

2011-08-23 Thread Andrew Xue
this doesn't work:

user= (defn if-a [a b] (if (a) (str a) (str b)))
#'user/if-a
user= (if-a nil b)
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user= (if-a a nil)
user= java.lang.ClassCastException: java.lang.String cannot be cast
to clojure.lang.IFn (NO_SOURCE_FILE:0)

this does work:

user= (defn if-a [a b] (if (identity a) (str a) (str b)))
#'user/if-a
user= (if-a nil b)
b
user= (if-a a nil)
a


why is the identity function is needed? thanks

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en