Re: Simple socket programming problem

2013-05-31 Thread atkaaz
What happens if you send a newline after that Hello? ie. Hello\n since
you're using read-line



On Sat, Jun 1, 2013 at 3:44 AM, Andrew Spano werdnaon...@gmail.com wrote:

 Hello,

 I'm trying to create a very simple interaction between a client and server
 program using the server-socket library which used to be part of
 clojure-contrib and is now maintained by technomancy
 https://github.com/technomancy/server-socket/blob/master/src/server/socket.clj


 I created a simple echo server, which works fine when accessed by telnet
 but can't seem to accept messages from the python client.


 This is the code for the client and the server:

 client.py:

 import socket

 s = socket.socket()
 host = socket.gethostname()
 port = 9001

 s.connect((host,port))

 while 1:
 s.send(Hello)
 print s.recv(1024)
 s.close()


 And this is the code for the server--I tried to capture all of the input
 into a vector, but the vector never seems to change:


 (ns bot-backend.core)
 (use 'server.socket)
 (import '(java.io BufferedReader InputStreamReader PrintWriter))


 (def server
   (create-server
9001
(fn [in out]
  (binding
  [*in* (BufferedReader. (InputStreamReader. in))
   *out* (PrintWriter. out)]
(loop [input []]
  (println input)
  (recur (conj input (read-line


 The only output the client displays is a single empty vector after which
 it waits to receive more data.  Since this works correctly when I access
 the port over telnet I can't figure out what the problem is.  As a novice
 to both clojure and socket programming my best guess is that it has
 something to do with multiple threading--I know that both python and
 clojure create a new thread for each distinct socket.

 It's probably an incorrect guess. That's why I've decided to consult the
 community :D.  Any help is appreciated in advance!

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: cyclic dependencies out of nowhere?

2013-05-30 Thread atkaaz
looks like you found it:
https://github.com/jimpil/Clondie24/commit/16f92fccc0c65d3c250b7a880649b940f792ea92



On Thu, May 30, 2013 at 11:25 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 Hi everyone,

 I've re-arranged some code in a project of mine and it seems I've
 introduced cyclic dependencies...It doesn't make sense though! I get the
 following message:

 = (load-file src/Clondie24/games/chess.**clj)
 Exception Cyclic load dependency: [ /Clondie24/lib/core
 ]-/Clondie24/games/chess-[ /Clondie24/lib/core ]
 clojure.core/check-cyclic-**dependency (core.clj:5430)

 presumably, that means that it tried to load chess.clj which depends on
 core.clj but while loading core.clj it detected a dependency back to chess!
 However, look at my ns declarations:

 (ns Clondie24.lib.core ;;as you can see core.clj depends on no game but
 all games depend on core.clj
(:require [Clondie24.lib.util :as ut]
  [clojure.core.reducers :as r]
  [enclog.training :as evo]
  [enclog.normalization :refer [prepare input output]])
(:import  [encog_java.customGA CustomNeuralGeneticAlgorithm Referee]
   [org.encog.neural.networks BasicNetwork]))


 (ns Clondie24.games.chess
 (:require [Clondie24.lib.util :as ut]
   [Clondie24.lib.core :as core]
   [Clondie24.lib.search :as s]
   [Clondie24.lib.rules :as rul]
   [Clondie24.lib.gui :as gui]
   [enclog.nnets :as ai]
   [enclog.training :as evol]
   [enclog.normalization :as norm])
 (:import  #_[encog_java.customGA CustomNeuralGeneticAlgorithm
CustomGeneticScoreAdapter Referee]
   [Clondie24.lib.core Player]))

 Suddenly the same happens with all my games!!! If I try to load into
 core.clj directly everything goes fine...
 I should point out that there is some Java glue code which loads some
 functions from core.clj as well...In fact, that is the major change that I
 did today...I wanted the ability to genetically train all my games and thus
 the relevant functions should be in the core ns - not in chess.clj. So I
 moved them into core and now this...weird stuff!!!

 also, util.clj obviously doesn't depend on chess.clj...

 any ideas guys? I've had this error before but it was pretty obvious where
 the cycle was...Here, I'm very confused! core.clj and util.clj are the
 lowest level code and thus depend on nothing from the same project!

 thanks in advance for your time,

 Jim




 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
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/groups/opt_out.




Re: cyclic dependencies out of nowhere?

2013-05-30 Thread atkaaz
 I posted to make sure others reading it  know not to start looking for a
solution, since it was found - so saving their time. Also, I was sure you
were going to post it as soon as you had the time (for the same reason, at
least). I didn't mean to call you out or anything; I see making
mistakesfailing a requirement to programming: if you don't constantly fail
then you're doing it wrong ;)   (I'm still struggling to accept this though
xD)
 I only superficially looked at that commit and it seemed to me to be the
fix, now that I look again it makes some sense: in core clj you imported
Referee java class whose static init. block did a require of chess clj, but
the commit changed this require to be core. I guess this class remained
there in its old format and then interfered, as you said.

Peace out,


On Fri, May 31, 2013 at 1:43 AM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  hehe :)

 yep, I found it...some stupid class files had been left along with the
 java source files and they were interfering with the proper class files
 (under target/classes) since they were both under the classpath!!! I felt
 very stupid for having done this and that's why I didn't post back with the
 solution...but of course  nothing is secret, as you demonstrated :)

 btw, the commit you're showing is not exactly what fixed it...that was
 before my post I think...

 Jim


 On 30/05/13 22:58, atkaaz wrote:

 looks like you found it:
 https://github.com/jimpil/Clondie24/commit/16f92fccc0c65d3c250b7a880649b940f792ea92



 On Thu, May 30, 2013 at 11:25 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 Hi everyone,

 I've re-arranged some code in a project of mine and it seems I've
 introduced cyclic dependencies...It doesn't make sense though! I get the
 following message:

 = (load-file src/Clondie24/games/chess.clj)
 Exception Cyclic load dependency: [ /Clondie24/lib/core
 ]-/Clondie24/games/chess-[ /Clondie24/lib/core ]
 clojure.core/check-cyclic-dependency (core.clj:5430)

 presumably, that means that it tried to load chess.clj which depends on
 core.clj but while loading core.clj it detected a dependency back to chess!
 However, look at my ns declarations:

 (ns Clondie24.lib.core ;;as you can see core.clj depends on no game but
 all games depend on core.clj
(:require [Clondie24.lib.util :as ut]
  [clojure.core.reducers :as r]
  [enclog.training :as evo]
  [enclog.normalization :refer [prepare input output]])
(:import  [encog_java.customGA CustomNeuralGeneticAlgorithm Referee]
   [org.encog.neural.networks BasicNetwork]))


 (ns Clondie24.games.chess
 (:require [Clondie24.lib.util :as ut]
   [Clondie24.lib.core :as core]
   [Clondie24.lib.search :as s]
   [Clondie24.lib.rules :as rul]
   [Clondie24.lib.gui :as gui]
   [enclog.nnets :as ai]
   [enclog.training :as evol]
   [enclog.normalization :as norm])
 (:import  #_[encog_java.customGA CustomNeuralGeneticAlgorithm
CustomGeneticScoreAdapter Referee]
   [Clondie24.lib.core Player]))

 Suddenly the same happens with all my games!!! If I try to load into
 core.clj directly everything goes fine...
 I should point out that there is some Java glue code which loads some
 functions from core.clj as well...In fact, that is the major change that I
 did today...I wanted the ability to genetically train all my games and thus
 the relevant functions should be in the core ns - not in chess.clj. So I
 moved them into core and now this...weird stuff!!!

 also, util.clj obviously doesn't depend on chess.clj...

 any ideas guys? I've had this error before but it was pretty obvious
 where the cycle was...Here, I'm very confused! core.clj and util.clj are
 the lowest level code and thus depend on nothing from the same project!

 thanks in advance for your time,

 Jim




 --
 --
 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/groups/opt_out.



  --
 --
 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

Re: java.lang.Exception: Unsupported option(s) supplied: :exclude

2013-05-28 Thread atkaaz
Jim, that is in project.clj  right?
OP can use :refer and :exclude  but can't pass two namespaces to :refer,
just one

some examples from clojure code:
(ns foo.bar
(:refer-clojure :exclude [ancestors printf])
(:require (clojure.contrib sql combinatorics))
(:use (my.lib this that))
(:import (java.util Date Timer Random)
 (java.sql Connection Statement)))

or maybe you wanted this:
(ns clojure.test-clojure.data-structures
  (:use clojure.test
[clojure.test.generative *:exclude* (is)])
  (:require [clojure.test-clojure.generators :as cgen]))


On Tue, May 28, 2013 at 1:02 PM, Jim jimpil1...@gmail.com wrote:

  I think it is :exclusions not :exclude...

 example:

  [uk.ac.gate/gate-core 7.1 :exclusions [[org.springframework/spring-beans]]]

 Jim




 On 28/05/13 10:42, ru wrote:

 Dear clojure-users,

  Loading a file with such content:

  (ns ru.rules
 (:use
   protege.core
   rete.core :exclude [rutime])
  ...

  I get this error message:

  java.lang.Exception: Unsupported option(s) supplied: :exclude
  at clojure.core$load_libs.doInvoke(core.clj:5408)
  at clojure.lang.RestFn.applyTo(RestFn.java:137)
  at clojure.core$apply.invoke(core.clj:621)
  at clojure.core$use.doInvoke(core.clj:5507)
  at clojure.lang.RestFn.invoke(RestFn.java:457)
  at ru.rules$eval8$loading__4910__auto9.invoke(rules.clj:1)
  at ru.rules$eval8.invoke(rules.clj:1)
  at clojure.lang.Compiler.eval(Compiler.java:6619)
  

  This contradict to official API documentation on Clojure v1.5. Am I
 right?
 Any help would be greatly appreciated.

  Sincerely,
   Ru


  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: wouldn't this be an interesting clojure code editor?

2013-05-27 Thread atkaaz
I kinda found the haskell equivalent of the editor I mentioned above(well,
at least conceptually) and it's a work in progress but looks great so far,
it's written in haskell  it's in 3D

https://github.com/Peaker/lamdu




On Mon, May 20, 2013 at 8:17 PM, atkaaz atk...@gmail.com wrote:

 Hi guys. I just stumbled upon something [1] and the editor is quite
 similar to what I was hoping/focusing on having(these days) for
 editing/writing (not just) clojure code.
  What are your thoughts on this? (just don't think too much of it in that
 is for java and ignore the 3D thing)

 To see what I mean, please see the second video on that [1] page (it's 12
 minutes), or if you don't have flash and can get the .wmv file from [2]

 [1] http://www.alice.org/index.php?page=what_is_alice/what_is_alice
 [2] http://www.alice.org/what_is_alice/AliceDemonstrationVideo.wmv

 to note the different colors for forms within a form (ie. at minute 8:57
 in the video)
 I especially wanted something very similar in ccw so it would be obvious
 where each form begins (which is currently being done with colored parens i
 think)


-- 
-- 
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/groups/opt_out.




Re: wouldn't this be an interesting clojure code editor?

2013-05-27 Thread atkaaz
or maybe this (Subtext2):
http://www.subtextual.org/subtext2.html

or this (Conception):
https://www.youtube.com/watch?v=DNJ7HqlV55k

maybe someone could get some ideas and adapt them to clojure or something



On Mon, May 27, 2013 at 10:42 AM, atkaaz atk...@gmail.com wrote:

 I kinda found the haskell equivalent of the editor I mentioned above(well,
 at least conceptually) and it's a work in progress but looks great so far,
 it's written in haskell  it's in 3D

 https://github.com/Peaker/lamdu




 On Mon, May 20, 2013 at 8:17 PM, atkaaz atk...@gmail.com wrote:

 Hi guys. I just stumbled upon something [1] and the editor is quite
 similar to what I was hoping/focusing on having(these days) for
 editing/writing (not just) clojure code.
  What are your thoughts on this? (just don't think too much of it in that
 is for java and ignore the 3D thing)

 To see what I mean, please see the second video on that [1] page (it's 12
 minutes), or if you don't have flash and can get the .wmv file from [2]

 [1] http://www.alice.org/index.php?page=what_is_alice/what_is_alice
 [2] http://www.alice.org/what_is_alice/AliceDemonstrationVideo.wmv

 to note the different colors for forms within a form (ie. at minute 8:57
 in the video)
 I especially wanted something very similar in ccw so it would be obvious
 where each form begins (which is currently being done with colored parens i
 think)




-- 
-- 
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/groups/opt_out.




Re: Loop run until a Clojure Agent send-off is complete

2013-05-27 Thread atkaaz
I find this might be helpful in this situation:
Google I/O 2009 - The Myth of the Genius Programmer
https://www.youtube.com/watch?v=0SARbwvhupQ


On Tue, May 28, 2013 at 4:02 AM, Kelker Ryan theinter...@yandex.com wrote:

 I wrote it for fun and deleted after no one took interest. There was no
 real purpose other than to see if it could be done.

 28.05.2013, 08:33, Plínio Balduino pbaldu...@gmail.com:

 404?
 On May 10, 2013 8:04 AM, Kelker Ryan theinter...@yandex.com wrote:

 I would like to share a library that allows for bodies of code to loop run
 until a Clojure Agent send-off is complete.
 https://github.com/runexec/hollywood#how



 --
 --
 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/groups/opt_out.




 --
 --
 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/groups/opt_out.



  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
quick note: the foo-one in local_mvn_repo (inside foo_two) is just v 0.1.0
without SNAPSHOT
the foo-one project however is 0.1.0-SNAPSHOT



On Sat, May 25, 2013 at 10:00 AM, David Williams
mobiusinvers...@gmail.comwrote:

 This is really important, and I am totally stumped and on a deadline.
  Help is greatly appreciated.

 I have a Clojure project called red-black, which in particular contains a
 file called interval_tree.clj

 I have been compiling this project with lein uberjar and then using the
 resulting jar in other projects by installing it in a local maven
 repository.

 mvn install:install-file  \
 -Dfile=../red-black/target/red-black-0.1.0.jar  \
 -DgroupId=self   \
 -DartifactId=red-black  \
 -Dversion=0.1.0  \
 -Dpackaging=jar  \
 -DgeneratePom=true  \
 -DcreateChecksum=true  \
 -DlocalRepositoryPath=local_mvn_repo

 The crazy thing is, I added a new function, compiled my jar and
 reinstalled it in the local maven repository of another project, and now
 java cant find my new function

 user= (red-black.interval-tree/tree-to-flat-list )
 CompilerException java.lang.RuntimeException: No such var:
 red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)

 However this function is in red-black.interval-tree.clj!  I even went into
 my local_mvn_repo, unzipped the jar, and looked at the interval_tree.clj
 source.  The function is in there!

 Whats even more strange is that the other function from that library are
 accessible.  For example, in my second project with the local mvn repo:

 user= (use 'red-black.interval-tree)
 nil

 Now a little tab tab magic:

 user= (red-black.interval-tree/
 red-black.interval-tree/add-to-result
  red-black.interval-tree/black
  red-black.interval-tree/check-max-interval
 red-black.interval-tree/get-color
  red-black.interval-tree/get-hash
 red-black.interval-tree/get-interval
 red-black.interval-tree/get-key
  red-black.interval-tree/get-left
 red-black.interval-tree/get-max
 red-black.interval-tree/get-parent
 red-black.interval-tree/get-right
  red-black.interval-tree/get-root
 red-black.interval-tree/get-sentinel
 red-black.interval-tree/get-valuered-black.interval-tree/has?
 red-black.interval-tree/health-check
 red-black.interval-tree/high red-black.interval-tree/insert
 red-black.interval-tree/insert-fixup
 red-black.interval-tree/left-rotate  red-black.interval-tree/low
 red-black.interval-tree/max-of-three
 red-black.interval-tree/new  red-black.interval-tree/node
 red-black.interval-tree/point-lookup
 red-black.interval-tree/pretty-print
 red-black.interval-tree/recursive-max
 red-black.interval-tree/red
  red-black.interval-tree/right-rotate
 red-black.interval-tree/set-color
 red-black.interval-tree/set-interval
 red-black.interval-tree/set-key
  red-black.interval-tree/set-left
 red-black.interval-tree/set-max
  red-black.interval-tree/set-parent
 red-black.interval-tree/set-right
 red-black.interval-tree/set-root
 red-black.interval-tree/set-value
  red-black.interval-tree/update-max
 user= (red-black.interval-tree/

 But as you can see the funstion tree-to-flat-list is missing.  When I go
 back into my red-black project and launch the repl, I can invoke the
 project just find.  Help!  As of 5 hours ago I was creating new methods in
 my red-black project, compiling my uberjar and installing it in my other
 project via local maven install, and new methods were being picked up just
 fine.  Something appears to be very wrong, please advise!

 Update:

 A self contained example of this issue is in this tarball:

 http://gorillamatrix.com/files/foo.tar.gz

 Go into foo-two and lein repl.  Try to load foo-two.core, you should see
 this:

 user= (use 'foo-two.core)
 CompilerException java.lang.RuntimeException: No such var:
 foo-one.core/bar, compiling:(foo_two/core.clj:6:2)

 However foo-one.core/bar is certainly defined!

 --
 --
 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/groups/opt_out.




-- 
-- 
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 

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
ok nevermind I guess it works anyway:
user= (use 'foo-two.core)
nil
user= foo-one.core/bar
#core$bar foo_one.core$bar@61526a45

I notice that lein copied that self/foo-one-0.1.0.jar into my .m2 folder
I wonder if  somehow lein didn't do that for you and you're still using the
old one check your ~/.m2/self/ folder



On Sat, May 25, 2013 at 10:54 AM, atkaaz atk...@gmail.com wrote:

 quick note: the foo-one in local_mvn_repo (inside foo_two) is just v 0.1.0
 without SNAPSHOT
 the foo-one project however is 0.1.0-SNAPSHOT



 On Sat, May 25, 2013 at 10:00 AM, David Williams 
 mobiusinvers...@gmail.com wrote:

 This is really important, and I am totally stumped and on a deadline.
  Help is greatly appreciated.

 I have a Clojure project called red-black, which in particular contains a
 file called interval_tree.clj

 I have been compiling this project with lein uberjar and then using the
 resulting jar in other projects by installing it in a local maven
 repository.

 mvn install:install-file  \
 -Dfile=../red-black/target/red-black-0.1.0.jar  \
 -DgroupId=self   \
 -DartifactId=red-black  \
 -Dversion=0.1.0  \
 -Dpackaging=jar  \
 -DgeneratePom=true  \
 -DcreateChecksum=true  \
 -DlocalRepositoryPath=local_mvn_repo

 The crazy thing is, I added a new function, compiled my jar and
 reinstalled it in the local maven repository of another project, and now
 java cant find my new function

 user= (red-black.interval-tree/tree-to-flat-list )
 CompilerException java.lang.RuntimeException: No such var:
 red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)

 However this function is in red-black.interval-tree.clj!  I even went
 into my local_mvn_repo, unzipped the jar, and looked at the
 interval_tree.clj source.  The function is in there!

 Whats even more strange is that the other function from that library are
 accessible.  For example, in my second project with the local mvn repo:

 user= (use 'red-black.interval-tree)
 nil

 Now a little tab tab magic:

 user= (red-black.interval-tree/
 red-black.interval-tree/add-to-result
  red-black.interval-tree/black
  red-black.interval-tree/check-max-interval
 red-black.interval-tree/get-color
  red-black.interval-tree/get-hash
 red-black.interval-tree/get-interval
 red-black.interval-tree/get-key
  red-black.interval-tree/get-left
 red-black.interval-tree/get-max
 red-black.interval-tree/get-parent
 red-black.interval-tree/get-right
  red-black.interval-tree/get-root
 red-black.interval-tree/get-sentinel
 red-black.interval-tree/get-valuered-black.interval-tree/has?
 red-black.interval-tree/health-check
 red-black.interval-tree/high red-black.interval-tree/insert
 red-black.interval-tree/insert-fixup
 red-black.interval-tree/left-rotate  red-black.interval-tree/low
 red-black.interval-tree/max-of-three
 red-black.interval-tree/new  red-black.interval-tree/node
 red-black.interval-tree/point-lookup
 red-black.interval-tree/pretty-print
 red-black.interval-tree/recursive-max
 red-black.interval-tree/red
  red-black.interval-tree/right-rotate
 red-black.interval-tree/set-color
 red-black.interval-tree/set-interval
 red-black.interval-tree/set-key
  red-black.interval-tree/set-left
 red-black.interval-tree/set-max
  red-black.interval-tree/set-parent
 red-black.interval-tree/set-right
 red-black.interval-tree/set-root
 red-black.interval-tree/set-value
  red-black.interval-tree/update-max
 user= (red-black.interval-tree/

 But as you can see the funstion tree-to-flat-list is missing.  When I go
 back into my red-black project and launch the repl, I can invoke the
 project just find.  Help!  As of 5 hours ago I was creating new methods in
 my red-black project, compiling my uberjar and installing it in my other
 project via local maven install, and new methods were being picked up just
 fine.  Something appears to be very wrong, please advise!

 Update:

 A self contained example of this issue is in this tarball:

 http://gorillamatrix.com/files/foo.tar.gz

 Go into foo-two and lein repl.  Try to load foo-two.core, you should see
 this:

 user= (use 'foo-two.core)
 CompilerException java.lang.RuntimeException: No such var:
 foo-one.core/bar, compiling:(foo_two/core.clj:6:2)

 However foo-one.core/bar is certainly defined!

 --
 --
 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

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
or let me put it this way, if I touch all the files in local_mvn_repo  and
then run lein repl (or lein deps then lein repl) the newer foo-one from
local_mvn_repo is not copied to .m2 folder, ergo I'll still be using the
existing one (I assume you already have an existing one where you didn't
define the bar fn) so check if you have the red black function in
.m2\repository\self\foo-one\0.1.0  (replace with your red black project
here)


On Sat, May 25, 2013 at 11:06 AM, atkaaz atk...@gmail.com wrote:

 ok nevermind I guess it works anyway:
 user= (use 'foo-two.core)
 nil
 user= foo-one.core/bar
 #core$bar foo_one.core$bar@61526a45

 I notice that lein copied that self/foo-one-0.1.0.jar into my .m2 folder
 I wonder if  somehow lein didn't do that for you and you're still using
 the old one check your ~/.m2/self/ folder



 On Sat, May 25, 2013 at 10:54 AM, atkaaz atk...@gmail.com wrote:

 quick note: the foo-one in local_mvn_repo (inside foo_two) is just v
 0.1.0 without SNAPSHOT
 the foo-one project however is 0.1.0-SNAPSHOT



 On Sat, May 25, 2013 at 10:00 AM, David Williams 
 mobiusinvers...@gmail.com wrote:

 This is really important, and I am totally stumped and on a deadline.
  Help is greatly appreciated.

 I have a Clojure project called red-black, which in particular contains
 a file called interval_tree.clj

 I have been compiling this project with lein uberjar and then using the
 resulting jar in other projects by installing it in a local maven
 repository.

 mvn install:install-file  \
 -Dfile=../red-black/target/red-black-0.1.0.jar  \
 -DgroupId=self   \
 -DartifactId=red-black  \
 -Dversion=0.1.0  \
 -Dpackaging=jar  \
 -DgeneratePom=true  \
 -DcreateChecksum=true  \
 -DlocalRepositoryPath=local_mvn_repo

 The crazy thing is, I added a new function, compiled my jar and
 reinstalled it in the local maven repository of another project, and now
 java cant find my new function

 user= (red-black.interval-tree/tree-to-flat-list )
 CompilerException java.lang.RuntimeException: No such var:
 red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)

 However this function is in red-black.interval-tree.clj!  I even went
 into my local_mvn_repo, unzipped the jar, and looked at the
 interval_tree.clj source.  The function is in there!

 Whats even more strange is that the other function from that library are
 accessible.  For example, in my second project with the local mvn repo:

 user= (use 'red-black.interval-tree)
 nil

 Now a little tab tab magic:

 user= (red-black.interval-tree/
 red-black.interval-tree/add-to-result
  red-black.interval-tree/black
  red-black.interval-tree/check-max-interval
 red-black.interval-tree/get-color
  red-black.interval-tree/get-hash
 red-black.interval-tree/get-interval
 red-black.interval-tree/get-key
  red-black.interval-tree/get-left
 red-black.interval-tree/get-max
 red-black.interval-tree/get-parent
 red-black.interval-tree/get-right
  red-black.interval-tree/get-root
 red-black.interval-tree/get-sentinel
 red-black.interval-tree/get-valuered-black.interval-tree/has?
 red-black.interval-tree/health-check
 red-black.interval-tree/high red-black.interval-tree/insert
 red-black.interval-tree/insert-fixup
 red-black.interval-tree/left-rotate  red-black.interval-tree/low
 red-black.interval-tree/max-of-three
 red-black.interval-tree/new  red-black.interval-tree/node
 red-black.interval-tree/point-lookup
 red-black.interval-tree/pretty-print
 red-black.interval-tree/recursive-max
 red-black.interval-tree/red
  red-black.interval-tree/right-rotate
 red-black.interval-tree/set-color
 red-black.interval-tree/set-interval
 red-black.interval-tree/set-key
  red-black.interval-tree/set-left
 red-black.interval-tree/set-max
  red-black.interval-tree/set-parent
 red-black.interval-tree/set-right
 red-black.interval-tree/set-root
 red-black.interval-tree/set-value
  red-black.interval-tree/update-max
 user= (red-black.interval-tree/

 But as you can see the funstion tree-to-flat-list is missing.  When I go
 back into my red-black project and launch the repl, I can invoke the
 project just find.  Help!  As of 5 hours ago I was creating new methods in
 my red-black project, compiling my uberjar and installing it in my other
 project via local maven install, and new methods were being picked up just
 fine.  Something appears to be very wrong, please advise!

 Update:

 A self contained example of this issue is in this tarball:

 http://gorillamatrix.com/files/foo.tar.gz

 Go into foo-two and lein repl.  Try to load foo-two.core, you should see
 this:

 user= (use 'foo-two.core)
 CompilerException java.lang.RuntimeException: No such var:
 foo-one.core/bar, compiling:(foo_two/core.clj:6:2)

 However foo-one.core/bar is certainly defined!

 --
 --
 You received

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
I could be wrong if it's checking the .md5 (which probably does) I should
try to update foo-one and install it in local repo, but I don't really know
the command :)


On Sat, May 25, 2013 at 11:11 AM, atkaaz atk...@gmail.com wrote:

 or let me put it this way, if I touch all the files in local_mvn_repo  and
 then run lein repl (or lein deps then lein repl) the newer foo-one from
 local_mvn_repo is not copied to .m2 folder, ergo I'll still be using the
 existing one (I assume you already have an existing one where you didn't
 define the bar fn) so check if you have the red black function in
 .m2\repository\self\foo-one\0.1.0  (replace with your red black project
 here)


 On Sat, May 25, 2013 at 11:06 AM, atkaaz atk...@gmail.com wrote:

 ok nevermind I guess it works anyway:
 user= (use 'foo-two.core)
 nil
 user= foo-one.core/bar
 #core$bar foo_one.core$bar@61526a45

 I notice that lein copied that self/foo-one-0.1.0.jar into my .m2 folder
 I wonder if  somehow lein didn't do that for you and you're still using
 the old one check your ~/.m2/self/ folder



 On Sat, May 25, 2013 at 10:54 AM, atkaaz atk...@gmail.com wrote:

 quick note: the foo-one in local_mvn_repo (inside foo_two) is just v
 0.1.0 without SNAPSHOT
 the foo-one project however is 0.1.0-SNAPSHOT



 On Sat, May 25, 2013 at 10:00 AM, David Williams 
 mobiusinvers...@gmail.com wrote:

 This is really important, and I am totally stumped and on a deadline.
  Help is greatly appreciated.

 I have a Clojure project called red-black, which in particular contains
 a file called interval_tree.clj

 I have been compiling this project with lein uberjar and then using the
 resulting jar in other projects by installing it in a local maven
 repository.

 mvn install:install-file  \
 -Dfile=../red-black/target/red-black-0.1.0.jar  \
 -DgroupId=self   \
 -DartifactId=red-black  \
 -Dversion=0.1.0  \
 -Dpackaging=jar  \
 -DgeneratePom=true  \
 -DcreateChecksum=true  \
 -DlocalRepositoryPath=local_mvn_repo

 The crazy thing is, I added a new function, compiled my jar and
 reinstalled it in the local maven repository of another project, and now
 java cant find my new function

 user= (red-black.interval-tree/tree-to-flat-list )
 CompilerException java.lang.RuntimeException: No such var:
 red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)

 However this function is in red-black.interval-tree.clj!  I even went
 into my local_mvn_repo, unzipped the jar, and looked at the
 interval_tree.clj source.  The function is in there!

 Whats even more strange is that the other function from that library
 are accessible.  For example, in my second project with the local mvn repo:

 user= (use 'red-black.interval-tree)
 nil

 Now a little tab tab magic:

 user= (red-black.interval-tree/
 red-black.interval-tree/add-to-result
  red-black.interval-tree/black
  red-black.interval-tree/check-max-interval
 red-black.interval-tree/get-color
  red-black.interval-tree/get-hash
 red-black.interval-tree/get-interval
 red-black.interval-tree/get-key
  red-black.interval-tree/get-left
 red-black.interval-tree/get-max
 red-black.interval-tree/get-parent
 red-black.interval-tree/get-right
  red-black.interval-tree/get-root
 red-black.interval-tree/get-sentinel
 red-black.interval-tree/get-valuered-black.interval-tree/has?
 red-black.interval-tree/health-check
 red-black.interval-tree/high red-black.interval-tree/insert
 red-black.interval-tree/insert-fixup
 red-black.interval-tree/left-rotate  red-black.interval-tree/low
 red-black.interval-tree/max-of-three
 red-black.interval-tree/new  red-black.interval-tree/node
 red-black.interval-tree/point-lookup
 red-black.interval-tree/pretty-print
 red-black.interval-tree/recursive-max
 red-black.interval-tree/red
  red-black.interval-tree/right-rotate
 red-black.interval-tree/set-color
 red-black.interval-tree/set-interval
 red-black.interval-tree/set-key
  red-black.interval-tree/set-left
 red-black.interval-tree/set-max
  red-black.interval-tree/set-parent
 red-black.interval-tree/set-right
 red-black.interval-tree/set-root
 red-black.interval-tree/set-value
  red-black.interval-tree/update-max
 user= (red-black.interval-tree/

 But as you can see the funstion tree-to-flat-list is missing.  When I
 go back into my red-black project and launch the repl, I can invoke the
 project just find.  Help!  As of 5 hours ago I was creating new methods in
 my red-black project, compiling my uberjar and installing it in my other
 project via local maven install, and new methods were being picked up just
 fine.  Something appears to be very wrong, please advise!

 Update:

 A self contained example of this issue is in this tarball:

 http://gorillamatrix.com/files/foo.tar.gz

 Go into foo-two and lein repl.  Try to load foo-two.core, you

Re: Having a major problem with Maven import in Clojure and Lein Uberjar

2013-05-25 Thread atkaaz
ok I got the command (run inside foo-two project):
mvn install:install-file
-Dfile=../foo-one/target/uberjar+provided/foo-one-0.1.0-SNAPSHOT.jar
-DgroupId=self   -DartifactId=foo-one-Dversion=0.1.0
-Dpackaging=jar  -DgeneratePom=true
-DcreateChecksum=true  -DlocalRepositoryPath=local_mvn_repo

I actually renamed bar to bar2 and it still worked, so it definitely didn't
update the foo-one from .m2 folder (and now that I checked I am sure)

doing a lein deps in foo-two didn't fix it still... I guess simplest u can
do is delete it from .m2 and run lein repl in foo-two ? If anyone else has
any other ideas? (except incrementing verison numbers of foo-one and not
forgetting to change foo-two's project.clj to match)

In other words, lein is using the self/foo-one from .m2 not from your local
repo (but it did install it from local repo to .m2 once) though I would've
expected to recheck even though it's the same version, but perhaps it
doesn't support updating the same versions




On Sat, May 25, 2013 at 11:12 AM, atkaaz atk...@gmail.com wrote:

 I could be wrong if it's checking the .md5 (which probably does) I should
 try to update foo-one and install it in local repo, but I don't really know
 the command :)


 On Sat, May 25, 2013 at 11:11 AM, atkaaz atk...@gmail.com wrote:

 or let me put it this way, if I touch all the files in local_mvn_repo
 and then run lein repl (or lein deps then lein repl) the newer foo-one from
 local_mvn_repo is not copied to .m2 folder, ergo I'll still be using the
 existing one (I assume you already have an existing one where you didn't
 define the bar fn) so check if you have the red black function in
 .m2\repository\self\foo-one\0.1.0  (replace with your red black project
 here)


 On Sat, May 25, 2013 at 11:06 AM, atkaaz atk...@gmail.com wrote:

 ok nevermind I guess it works anyway:
 user= (use 'foo-two.core)
 nil
 user= foo-one.core/bar
 #core$bar foo_one.core$bar@61526a45

 I notice that lein copied that self/foo-one-0.1.0.jar into my .m2 folder
 I wonder if  somehow lein didn't do that for you and you're still using
 the old one check your ~/.m2/self/ folder



 On Sat, May 25, 2013 at 10:54 AM, atkaaz atk...@gmail.com wrote:

 quick note: the foo-one in local_mvn_repo (inside foo_two) is just v
 0.1.0 without SNAPSHOT
 the foo-one project however is 0.1.0-SNAPSHOT



 On Sat, May 25, 2013 at 10:00 AM, David Williams 
 mobiusinvers...@gmail.com wrote:

 This is really important, and I am totally stumped and on a deadline.
  Help is greatly appreciated.

 I have a Clojure project called red-black, which in particular
 contains a file called interval_tree.clj

 I have been compiling this project with lein uberjar and then using
 the resulting jar in other projects by installing it in a local maven
 repository.

 mvn install:install-file  \
 -Dfile=../red-black/target/red-black-0.1.0.jar  \
 -DgroupId=self   \
 -DartifactId=red-black  \
 -Dversion=0.1.0  \
 -Dpackaging=jar  \
 -DgeneratePom=true  \
 -DcreateChecksum=true  \
 -DlocalRepositoryPath=local_mvn_repo

 The crazy thing is, I added a new function, compiled my jar and
 reinstalled it in the local maven repository of another project, and now
 java cant find my new function

 user= (red-black.interval-tree/tree-to-flat-list )
 CompilerException java.lang.RuntimeException: No such var:
 red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)

 However this function is in red-black.interval-tree.clj!  I even went
 into my local_mvn_repo, unzipped the jar, and looked at the
 interval_tree.clj source.  The function is in there!

 Whats even more strange is that the other function from that library
 are accessible.  For example, in my second project with the local mvn 
 repo:

 user= (use 'red-black.interval-tree)
 nil

 Now a little tab tab magic:

 user= (red-black.interval-tree/
 red-black.interval-tree/add-to-result
  red-black.interval-tree/black
  red-black.interval-tree/check-max-interval
 red-black.interval-tree/get-color
  red-black.interval-tree/get-hash
 red-black.interval-tree/get-interval
 red-black.interval-tree/get-key
  red-black.interval-tree/get-left
 red-black.interval-tree/get-max
 red-black.interval-tree/get-parent
 red-black.interval-tree/get-right
  red-black.interval-tree/get-root
 red-black.interval-tree/get-sentinel
 red-black.interval-tree/get-valuered-black.interval-tree/has?
 red-black.interval-tree/health-check
 red-black.interval-tree/high 
 red-black.interval-tree/insert
 red-black.interval-tree/insert-fixup
 red-black.interval-tree/left-rotate  red-black.interval-tree/low
 red-black.interval-tree/max-of-three
 red-black.interval-tree/new  red-black.interval-tree/node
 red-black.interval-tree/point-lookup
 red-black.interval-tree/pretty-print
 red-black.interval-tree/recursive-max

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
without giving this much thought is the % actualy a vector like [:dh-uuid
abc-def-ghi-klm] ?


On Sat, May 25, 2013 at 2:21 PM, Mond Ray mondraym...@gmail.com wrote:

 I am missing something obvious... I get a list of maps back from a
 function and I want to find the elements with nil

 (({:a2p-id 1, :dh-uuid abc-def-ghi-klm} {:a2p-id 2, :dh-uuid
 def-ghi-klm-opq} {:a2p-id 3, :dh-uuid nil}) ({:a2p-id 1, :dh-uuid
 abc-def-ghi-klm} {:a2p-id 2, :dh-uuid def-ghi-klm-opq} {:a2p-id 3,
 :dh-uuid nil}))

 I try the select function but it has no effect ... same list

 (set/select #(not (:dh-uuid %)) (map find-records query-parts))

 also tried the previously working example... same list

 (filter #(not (:dh-uuid %)) (map find-records query-parts))

 I am assuming that I am not indexing into each of the maps but I cannot
 remember or find out how to do this ... all examples only show one map

 Thanks

 Ray

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
can you tell what this returns?
(map find-records query-parts)


On Sat, May 25, 2013 at 2:21 PM, Mond Ray mondraym...@gmail.com wrote:

 I am missing something obvious... I get a list of maps back from a
 function and I want to find the elements with nil

 (({:a2p-id 1, :dh-uuid abc-def-ghi-klm} {:a2p-id 2, :dh-uuid
 def-ghi-klm-opq} {:a2p-id 3, :dh-uuid nil}) ({:a2p-id 1, :dh-uuid
 abc-def-ghi-klm} {:a2p-id 2, :dh-uuid def-ghi-klm-opq} {:a2p-id 3,
 :dh-uuid nil}))

 I try the select function but it has no effect ... same list

 (set/select #(not (:dh-uuid %)) (map find-records query-parts))

 also tried the previously working example... same list

 (filter #(not (:dh-uuid %)) (map find-records query-parts))

 I am assuming that I am not indexing into each of the maps but I cannot
 remember or find out how to do this ... all examples only show one map

 Thanks

 Ray

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
may I see the macro for the latter, if you decide to go that way ? thx


On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.com wrote:

 There are two patterns I find in my code that I'm still unhappy with but I
 don't know how to clean up.

 The first is: (if (:attr obj) obj (assoc obj :attr something))

 I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless if
 I had to add it or not.

 This version is ugly because it repeats obj three times. I could write my
 own macro to de-duplicate it, but I avoid doing that when I can because
 there's usually a better built-in solution that I just don't know about yet.

 The second is like it: (if (some-test obj) obj (some-transformation obj))

 In this one, I just want to return the object, but maybe transform it
 first. But the reference to obj happens three times! Still feels like it
 could be cleaned up.

 Any thoughts on how to clean these up?

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
didn't know about definline, thanks Jim!


On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with but
 I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could write
 my own macro to de-duplicate it, but I avoid doing that when I can because
 there's usually a better built-in solution that I just don't know about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform it
 first. But the reference to obj happens three times! Still feels like it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
just wondering if obj is a form does it get evaluated twice?


On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with but
 I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could write
 my own macro to de-duplicate it, but I avoid doing that when I can because
 there's usually a better built-in solution that I just don't know about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform it
 first. But the reference to obj happens three times! Still feels like it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
Shouldn't it be like:
(definline pred-transform [obj pred tf]
   `(if (~pred ~obj) ~obj
   (~tf ~obj)))
= (pred-transform 1 #(not (nil? %)) println)
1
= (pred-transform 1 nil? println)
1
nil




On Sat, May 25, 2013 at 2:55 PM, atkaaz atk...@gmail.com wrote:

 just wondering if obj is a form does it get evaluated twice?


 On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with but
 I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could write
 my own macro to de-duplicate it, but I avoid doing that when I can because
 there's usually a better built-in solution that I just don't know about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform it
 first. But the reference to obj happens three times! Still feels like it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.






-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
in which case it does get evaluated twice if form:
= (pred-transform (println 1) #(not (nil? %)) #(println % .))
1
1
nil .
nil

= (pred-transform (println 1) nil? #(println % .))
1
1
nil

so maybe a let + gensym would be in order?



On Sat, May 25, 2013 at 3:04 PM, atkaaz atk...@gmail.com wrote:

 Shouldn't it be like:

 (definline pred-transform [obj pred tf]
`(if (~pred ~obj) ~obj
(~tf ~obj)))
 = (pred-transform 1 #(not (nil? %)) println)
 1
 = (pred-transform 1 nil? println)
 1
 nil




 On Sat, May 25, 2013 at 2:55 PM, atkaaz atk...@gmail.com wrote:

 just wondering if obj is a form does it get evaluated twice?


 On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with
 but I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could
 write my own macro to de-duplicate it, but I avoid doing that when I can
 because there's usually a better built-in solution that I just don't know
 about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform it
 first. But the reference to obj happens three times! Still feels like it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.







-- 
-- 
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/groups/opt_out.




Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
like:
= (definline pred-transform [obj pred tf]
   `(let [o# ~obj]
  (if (~pred o#) o#
   (~tf o#
#'cgws.notcore/pred-transform
= (pred-transform (println 1) nil? #(println % .))
1
nil
= (pred-transform (println 1) #(not (nil? %)) #(println % .))
1
nil .
nil


On Sat, May 25, 2013 at 3:07 PM, atkaaz atk...@gmail.com wrote:

 in which case it does get evaluated twice if form:
 = (pred-transform (println 1) #(not (nil? %)) #(println % .))
 1
 1
 nil .
 nil

 = (pred-transform (println 1) nil? #(println % .))
 1
 1
 nil

 so maybe a let + gensym would be in order?



 On Sat, May 25, 2013 at 3:04 PM, atkaaz atk...@gmail.com wrote:

 Shouldn't it be like:

 (definline pred-transform [obj pred tf]
`(if (~pred ~obj) ~obj
(~tf ~obj)))
 = (pred-transform 1 #(not (nil? %)) println)
 1
 = (pred-transform 1 nil? println)
 1
 nil




 On Sat, May 25, 2013 at 2:55 PM, atkaaz atk...@gmail.com wrote:

 just wondering if obj is a form does it get evaluated twice?


  On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); 
 jimpil1...@gmail.comwrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with
 but I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless 
 if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could
 write my own macro to de-duplicate it, but I avoid doing that when I can
 because there's usually a better built-in solution that I just don't know
 about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform
 it first. But the reference to obj happens three times! Still feels like 
 it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.








-- 
-- 
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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
I wonder why the definline didn't act like a function?
= (defn pred-transform [obj pred tf]
 (if (pred obj) obj
   (tf obj)))
#'cgws.notcore/pred-transform
= (pred-transform (println 1) #(not (nil? %)) #(println % .))
1
nil .
nil
= (pred-transform (println 1) nil? #(println % .))
1
nil

= (fn? pred-transform)
true
= (definline pred-transform [obj pred tf]
   `(let [o# ~obj]
  (if (~pred o#) o#
   (~tf o#
#'cgws.notcore/pred-transform
= (fn? pred-transform)
true



On Sat, May 25, 2013 at 3:08 PM, atkaaz atk...@gmail.com wrote:

 like:
 = (definline pred-transform [obj pred tf]
`(let [o# ~obj]
   (if (~pred o#) o#
(~tf o#
 #'cgws.notcore/pred-transform

 = (pred-transform (println 1) nil? #(println % .))
 1
 nil
 = (pred-transform (println 1) #(not (nil? %)) #(println % .))
 1
 nil .
 nil


 On Sat, May 25, 2013 at 3:07 PM, atkaaz atk...@gmail.com wrote:

 in which case it does get evaluated twice if form:
 = (pred-transform (println 1) #(not (nil? %)) #(println % .))
 1
 1
 nil .
 nil

 = (pred-transform (println 1) nil? #(println % .))
 1
 1
 nil

 so maybe a let + gensym would be in order?



 On Sat, May 25, 2013 at 3:04 PM, atkaaz atk...@gmail.com wrote:

 Shouldn't it be like:

 (definline pred-transform [obj pred tf]
`(if (~pred ~obj) ~obj
(~tf ~obj)))
 = (pred-transform 1 #(not (nil? %)) println)
 1
 = (pred-transform 1 nil? println)
 1
 nil




 On Sat, May 25, 2013 at 2:55 PM, atkaaz atk...@gmail.com wrote:

 just wondering if obj is a form does it get evaluated twice?


  On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); jimpil1...@gmail.com
  wrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ? thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis 
 sbdegu...@gmail.comwrote:

 There are two patterns I find in my code that I'm still unhappy with
 but I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it doesn't
 already have it. And just return the thing with an attribute, regardless 
 if
 I had to add it or not.

  This version is ugly because it repeats obj three times. I could
 write my own macro to de-duplicate it, but I avoid doing that when I can
 because there's usually a better built-in solution that I just don't know
 about yet.

  The second is like it: (if (some-test obj) obj (some-transformation
 obj))

  In this one, I just want to return the object, but maybe transform
 it first. But the reference to obj happens three times! Still feels like 
 it
 could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
On Sat, May 25, 2013 at 3:16 PM, Steven Degutis sbdegu...@gmail.com wrote:


 Also I just remembered, sometimes to solve the second one, I would do ((if
 condition transformer identity) obj) but that feels ugly.

but the condition has to contain obj, so obj is referred twice ? otherwise
i kinda like it



 On Sat, May 25, 2013 at 7:13 AM, Cedric Greevey cgree...@gmail.comwrote:

 Seems to me that (merge {:attr something} obj) answers the OP's question,
 mentions obj only once, and is short and pithy. OTOH it computes the
 something every time, whether it's needed or not, so in cases where
 something is expensive to compute (or has side effects that should only
 happen if it winds up in the output!) then another method needs to be used.


 On Sat, May 25, 2013 at 8:08 AM, atkaaz atk...@gmail.com wrote:

 like:
 = (definline pred-transform [obj pred tf]
`(let [o# ~obj]
   (if (~pred o#) o#
(~tf o#
 #'cgws.notcore/pred-transform

 = (pred-transform (println 1) nil? #(println % .))
 1
 nil
 = (pred-transform (println 1) #(not (nil? %)) #(println % .))
 1
 nil .
 nil


 On Sat, May 25, 2013 at 3:07 PM, atkaaz atk...@gmail.com wrote:

 in which case it does get evaluated twice if form:
 = (pred-transform (println 1) #(not (nil? %)) #(println % .))
 1
 1
 nil .
 nil

 = (pred-transform (println 1) nil? #(println % .))
 1
 1
 nil

 so maybe a let + gensym would be in order?



 On Sat, May 25, 2013 at 3:04 PM, atkaaz atk...@gmail.com wrote:

 Shouldn't it be like:

 (definline pred-transform [obj pred tf]
`(if (~pred ~obj) ~obj
(~tf ~obj)))
 = (pred-transform 1 #(not (nil? %)) println)
 1
 = (pred-transform 1 nil? println)
 1
 nil




 On Sat, May 25, 2013 at 2:55 PM, atkaaz atk...@gmail.com wrote:

 just wondering if obj is a form does it get evaluated twice?


  On Sat, May 25, 2013 at 2:51 PM, Jim - FooBar(); 
 jimpil1...@gmail.com wrote:

  no need for macros... :)

 (definline safe-assoc [m k v]
 `(if (contains? ~m ~k) ~m
   (assoc ~m ~k ~v)))

 (definline pred-transform [obj pred tf]
 `(if ~(pred obj) ~obj
 ~(tf obj)))

 Jim



 On 25/05/13 12:44, atkaaz wrote:

 may I see the macro for the latter, if you decide to go that way ?
 thx


 On Sat, May 25, 2013 at 2:24 PM, Steven Degutis sbdegu...@gmail.com
  wrote:

 There are two patterns I find in my code that I'm still unhappy
 with but I don't know how to clean up.

  The first is: (if (:attr obj) obj (assoc obj :attr something))

  I'm basically saying, give this hash-map an attribute if it
 doesn't already have it. And just return the thing with an attribute,
 regardless if I had to add it or not.

  This version is ugly because it repeats obj three times. I could
 write my own macro to de-duplicate it, but I avoid doing that when I 
 can
 because there's usually a better built-in solution that I just don't 
 know
 about yet.

  The second is like it: (if (some-test obj) obj
 (some-transformation obj))

  In this one, I just want to return the object, but maybe
 transform it first. But the reference to obj happens three times! Still
 feels like it could be cleaned up.

  Any thoughts on how to clean these up?
  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread atkaaz
yep that was interesting thanks btw; it was a function that was acting like
a macro, how odd


On Sat, May 25, 2013 at 4:26 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 so maybe a let + gensym would be in order?



 yes that is what you do to avoid double-evaluation...:) I was making a
 different point though, the fact that definline produces a first class fn
 which still expands like a macro.

 Jim



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
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/groups/opt_out.




Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
= (doall (map #(remove :dh-uuid %)
'(({:a2p-id 1, :dh-uuid abc-def-ghi-klm} {:a2p-id 2,
:dh-uuid def-ghi-klm-opq} {:a2p-id 3, :dh-uuid nil}) ({:a2p-id 1,
:dh-uuid abc-def-ghi-klm} {:a2p-id 2, :dh-uuid def-ghi-klm-opq}
{:a2p-id 3, :dh-uuid *false*}))
))
(({:a2p-id 3, :dh-uuid nil}) ({:a2p-id 3, :dh-uuid *false*}))

idiomatic clojure ftw :)


On Sat, May 25, 2013 at 9:38 PM, Mond Ray mondraym...@gmail.com wrote:

 This is my latest working invocation:

 (doall (map #(remove :dh-uuid %) (map find-records query-parts)))
 (({:a2p-id 3, :dh-uuid nil}) ({:a2p-id 3, :dh-uuid nil}))

 The list of maps is retained which might be useful later.

 Thanks

 On Saturday, 25 May 2013 20:15:19 UTC+2, sdegutis wrote:

 Wouldn't (remove :dh-uuid (apply concat (map find-records query-parts)))
 be better?


 On Sat, May 25, 2013 at 1:09 PM, Mond Ray mondr...@gmail.com wrote:

 Bingo:

 user= (filter (complement :dh-uuid) (apply concat (map find-records
 query-parts)))
 ({:a2p-id 3, :dh-uuid nil} {:a2p-id 3, :dh-uuid nil})

 Thanks everyone!


 On Saturday, 25 May 2013 19:29:55 UTC+2, Andy Fingerhut wrote:

 Woops, and here I wasn't being careful enough...  You have a list (or
 sequence) of two elements, both of which are lists (or sequences) of maps.
 You can use (apply concat (map find-records query-parts)) to return a
 single list containing nothing but maps.

 Andy


 On Sat, May 25, 2013 at 10:27 AM, Andy Fingerhut 
 andy.fi...@gmail.comwrote:

 If (map find-records query-parts) is returning this expression:


 (({:a2p-id 1, :dh-uuid abc-def-ghi-klm} {:a2p-id 2, :dh-uuid
 def-ghi-klm-opq} {:a2p-id 3, :dh-uuid nil}) ({:a2p-id 1, :dh-uuid
 abc-def-ghi-klm} {:a2p-id 2, :dh-uuid def-ghi-klm-opq} {:a2p-id 3,
 :dh-uuid nil}))

 then especially note the double parentheses.  That is a list (or
 sequence), whose first element is a list (or sequence) of maps.  You can
 use (first (map find-records query-parts)) to get the inner list.

 Andy


 On Sat, May 25, 2013 at 4:21 AM, Mond Ray mondr...@gmail.com wrote:

 I am missing something obvious... I get a list of maps back from a
 function and I want to find the elements with nil

 (({:a2p-id 1, :dh-uuid abc-def-ghi-klm} {:a2p-id 2, :dh-uuid
 def-ghi-klm-opq} {:a2p-id 3, :dh-uuid nil}) ({:a2p-id 1, :dh-uuid
 abc-def-ghi-klm} {:a2p-id 2, :dh-uuid def-ghi-klm-opq} {:a2p-id 
 3,
 :dh-uuid nil}))

 I try the select function but it has no effect ... same list

 (set/select #(not (:dh-uuid %)) (map find-records query-parts))

 also tried the previously working example... same list

 (filter #(not (:dh-uuid %)) (map find-records query-parts))

 I am assuming that I am not indexing into each of the maps but I
 cannot remember or find out how to do this ... all examples only show one
 map

 Thanks

 Ray

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group**/clojure?hl=enhttp://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+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .





  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/clojure/0TfUVMsfcD8/**unsubscribe?hl=enhttps://groups.google.com/d/topic/clojure/0TfUVMsfcD8/unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




  --
 --
 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
 

Re: asm-based clojure yet?

2013-05-24 Thread atkaaz
making a note that (on my system, win7 64bit btw) clojureclr startup time
is about (at least)10 seconds.
tested both Clojure.Main.exe and Clojure.Compile.exe  from package
clojure-clr-1.4.1-Debug-4.0.zip

I might be looking into Haskell which seems to have like 2 sec(max) startup
time, and the hello world .exe file is 1,132,640 bytes (big but depends
only on kerner32/user32/msvcrt/wsock32  .dll files)




On Fri, May 17, 2013 at 2:10 PM, atkaaz atk...@gmail.com wrote:

 Ok, weird question: is there some clojure port on assembler yet? Even
 if(/especially if) it doesn't have jvm/java/javalibs support

 Or should I just check https://github.com/clojure/clojure-clr ?

 I'm mainly interested in low memory footprint and fast startup times (does
 clojure-clr have that?)


-- 
-- 
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/groups/opt_out.




Re: asm-based clojure yet?

2013-05-24 Thread atkaaz
for comparison an uberjar run [1] of a hello world program takes 2 seconds
(2.2 sec) on clojure 1.5.1 and Leiningen 2.2.0-SNAPSHOT on Java 1.7.0_17
Java HotSpot(TM) 64-Bit Server VM


[1] java -jar newproj1-0.1.0-SNAPSHOT-standalone.jar


On Fri, May 24, 2013 at 1:29 PM, atkaaz atk...@gmail.com wrote:

 making a note that (on my system, win7 64bit btw) clojureclr startup time
 is about (at least)10 seconds.
 tested both Clojure.Main.exe and Clojure.Compile.exe  from package
 clojure-clr-1.4.1-Debug-4.0.zip

 I might be looking into Haskell which seems to have like 2 sec(max)
 startup time, and the hello world .exe file is 1,132,640 bytes (big but
 depends only on kerner32/user32/msvcrt/wsock32  .dll files)




 On Fri, May 17, 2013 at 2:10 PM, atkaaz atk...@gmail.com wrote:

 Ok, weird question: is there some clojure port on assembler yet? Even
 if(/especially if) it doesn't have jvm/java/javalibs support

 Or should I just check https://github.com/clojure/clojure-clr ?

 I'm mainly interested in low memory footprint and fast startup times
 (does clojure-clr have that?)




-- 
-- 
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/groups/opt_out.




Re: How to: reduce boolean operations?

2013-05-24 Thread atkaaz
Thank you, I see it now. Based on your comment I actually took at look at
the source code for every? (haven't checked it before, oddly enough)

= (source every?)
(defn every?
  Returns true if (pred x) is logical true for every x in coll, else
  false.
  {:tag Boolean
   :added 1.0
   :static true}
  [pred coll]
  (cond
   (nil? (seq coll)) true
   (pred (first coll)) (recur pred (next coll))
   :else false))
nil

I thought that by coll in the doc they meant coll? returns true on the
input...
But now I see that first does a seq on that coll which does what you said
and thus returning a vector

So these mean nothing:
= (seq? {:a :b :c :d})
false
= (coll? {:a :b :c :d})
true
= (seq? [:a :b :c :d])
false
= (coll? [:a :b :c :d])
true

= (first [:a :b :c :d])
:a
= (first {:a :b :c :d})
[:a :b]
= (first {})
nil
= (first [])
nil ;if this were me I'd probably choose to throw here
 ;or return all values in a vector to differentiate from the following:
= (first [nil])
nil


It kinda makes sense except I wouldn't have expected that on the map it
would return a vector (but then how else could it return both key and value
right? )  so everyone expects the input to the pred would be a vector
when passed in a map.

oops stumbled upon another one:
= (get [1 2 3] 0)
1
= (get [1 2 3] -)
nil
= -
#core$_ clojure.core$_@2b0dfb46
Yep definitely better than throwing  *sarcasm*

ok check this:
= (every? nil? nil)
true
= (every? nil? [nil])
true
= (every? nil? [])
true

= (every? true? [])
true
= (every? true? nil)
true
= (every? true? [nil])
false

= (first nil)
nil
= (first [nil])
nil
= (first [])
nil


makes me think of C or something


(ok i'll stop if nobody brings it up, but really thanks to everyone that
replies - and sorry for hijacking the thread)




On Fri, May 24, 2013 at 8:21 PM, Alan Thompson thompson2...@gmail.comwrote:

 Usage:  (every? pred coll)

 (see http://clojuredocs.org/clojure_core/clojure.core/every_q )

 Function *every?* expects a predicate and a collection.  Converting the
 map {:a 1} into a collection returns a sequence of 2-element vectors:

 user= (seq  {:a 1})
 ([:a 1])

 Calling the function :a on a vector returns nil, since keyword lookup only
 works for maps.  every? then converts the nil into fase:

 user= (every?  :a  [ nil ] )
 false

 Alan


 On Thu, May 23, 2013 at 7:22 PM, atkaaz atk...@gmail.com wrote:

 Firstly let me just say that I really enjoy this conversation, ergo I
 thank you!


 On Thu, May 23, 2013 at 9:00 PM, Michał Marczyk michal.marc...@gmail.com
  wrote:

 On 23 May 2013 18:30, atkaaz atk...@gmail.com wrote:
  when you say the word false I'm assuming you're referring to
 false? the
  function (not false the boolean value), otherwise I don't understand

 I mean false-the-Boolean-value.

 To rephrase the point I was making previously, (false x) is a truthy
 value for any x in [] is a true sentence, indeed trivially so because
 [] is empty. Thus (every? false []) returning true totally makes
 sense.

 Alright, I see what you mean and you are right. But let's just state
 some assumptions(which I see as conventions):
 - the system that you're using (be it logic or mathematics or whatever it
 is) to evaluate that that proposition is truthy  is assuming(without
 checking) that the components are correct (such as false being a pred)
 - when the collection is empty - returns true   (this is a convention
 imho)
   I see this system as being incomplete/incoherent/inconsistent(or insert
 the right word here) because of those.
 (false x) is a truthy value for any x in []
 so that is a true sentence as you say, in this system(can I call it
 logic? or whatever you call it really) of evaluation which you can collapse
 to the implementation of every? as it is now in clojure. You may even say
 that the implementation of every? was based on that(doesn't matter). But
 I say that system is wrong xD so to speak, wrong as in
 incomplete/inconsistent and may work somewhere else (in non-programming
 environments ie. on paper) where assuming that the input is valid is the
 norm /the only thing happening.
  In a programming environment, for me it doesn't make sense to can call
 or evaluate something that has (at least one) inconsistent components
 (inconsistent based on its own definition).
 = (every? 1 [])
 true

  So it is truthy as you say, but that doesn't mean anything other than it
 is so(by convention/definion of) in this or that specific system(logic? or
 the impl. of every? in clojure)
  That may be acceptable to clojure community or to ppl who want to get
 work done, but not to (some) people who want/care for a consistent(ly
 defined) system. Ok, sure, I'm free to implement any constrains on top of
 that but if they were already implemented I couldn't get rid of them: I'll
 grant you that reasoning for keeping it the way it is now. But it's little
 things(inconsistencies I'll call them) like this which will make way for
 bugs which can be hard to track down. There's no guarantee

Re: How to: reduce boolean operations?

2013-05-24 Thread atkaaz
typo, I meant: thanks to everyone that replieD


On Fri, May 24, 2013 at 9:25 PM, atkaaz atk...@gmail.com wrote:

 Thank you, I see it now. Based on your comment I actually took at look at
 the source code for every? (haven't checked it before, oddly enough)

 = (source every?)
 (defn every?
   Returns true if (pred x) is logical true for every x in coll, else
   false.
   {:tag Boolean
:added 1.0
:static true}
   [pred coll]
   (cond
(nil? (seq coll)) true
(pred (first coll)) (recur pred (next coll))
:else false))
 nil

 I thought that by coll in the doc they meant coll? returns true on the
 input...
 But now I see that first does a seq on that coll which does what you said
 and thus returning a vector

 So these mean nothing:
 = (seq? {:a :b :c :d})
 false
 = (coll? {:a :b :c :d})
 true
 = (seq? [:a :b :c :d])
 false
 = (coll? [:a :b :c :d])
 true

 = (first [:a :b :c :d])
 :a
 = (first {:a :b :c :d})
 [:a :b]
 = (first {})
 nil
 = (first [])
 nil ;if this were me I'd probably choose to throw here
  ;or return all values in a vector to differentiate from the following:
 = (first [nil])
 nil


 It kinda makes sense except I wouldn't have expected that on the map it
 would return a vector (but then how else could it return both key and value
 right? )  so everyone expects the input to the pred would be a vector
 when passed in a map.

 oops stumbled upon another one:
 = (get [1 2 3] 0)
 1
 = (get [1 2 3] -)
 nil
 = -
 #core$_ clojure.core$_@2b0dfb46
 Yep definitely better than throwing  *sarcasm*

 ok check this:
 = (every? nil? nil)
 true
 = (every? nil? [nil])
 true
 = (every? nil? [])
 true

 = (every? true? [])
 true
 = (every? true? nil)
 true
 = (every? true? [nil])
 false

 = (first nil)
 nil
 = (first [nil])
 nil
 = (first [])
 nil


 makes me think of C or something


 (ok i'll stop if nobody brings it up, but really thanks to everyone that
 replies - and sorry for hijacking the thread)




 On Fri, May 24, 2013 at 8:21 PM, Alan Thompson thompson2...@gmail.comwrote:

 Usage:  (every? pred coll)

 (see http://clojuredocs.org/clojure_core/clojure.core/every_q )

 Function *every?* expects a predicate and a collection.  Converting the
 map {:a 1} into a collection returns a sequence of 2-element vectors:

 user= (seq  {:a 1})
 ([:a 1])

 Calling the function :a on a vector returns nil, since keyword lookup
 only works for maps.  every? then converts the nil into fase:

 user= (every?  :a  [ nil ] )
 false

 Alan


 On Thu, May 23, 2013 at 7:22 PM, atkaaz atk...@gmail.com wrote:

 Firstly let me just say that I really enjoy this conversation, ergo I
 thank you!


 On Thu, May 23, 2013 at 9:00 PM, Michał Marczyk 
 michal.marc...@gmail.com wrote:

 On 23 May 2013 18:30, atkaaz atk...@gmail.com wrote:
  when you say the word false I'm assuming you're referring to
 false? the
  function (not false the boolean value), otherwise I don't understand

 I mean false-the-Boolean-value.

 To rephrase the point I was making previously, (false x) is a truthy
 value for any x in [] is a true sentence, indeed trivially so because
 [] is empty. Thus (every? false []) returning true totally makes
 sense.

 Alright, I see what you mean and you are right. But let's just state
 some assumptions(which I see as conventions):
 - the system that you're using (be it logic or mathematics or whatever
 it is) to evaluate that that proposition is truthy  is assuming(without
 checking) that the components are correct (such as false being a pred)
 - when the collection is empty - returns true   (this is a convention
 imho)
   I see this system as being incomplete/incoherent/inconsistent(or
 insert the right word here) because of those.
 (false x) is a truthy value for any x in []
 so that is a true sentence as you say, in this system(can I call it
 logic? or whatever you call it really) of evaluation which you can collapse
 to the implementation of every? as it is now in clojure. You may even say
 that the implementation of every? was based on that(doesn't matter). But
 I say that system is wrong xD so to speak, wrong as in
 incomplete/inconsistent and may work somewhere else (in non-programming
 environments ie. on paper) where assuming that the input is valid is the
 norm /the only thing happening.
  In a programming environment, for me it doesn't make sense to can call
 or evaluate something that has (at least one) inconsistent components
 (inconsistent based on its own definition).
 = (every? 1 [])
 true

  So it is truthy as you say, but that doesn't mean anything other than
 it is so(by convention/definion of) in this or that specific system(logic?
 or the impl. of every? in clojure)
  That may be acceptable to clojure community or to ppl who want to get
 work done, but not to (some) people who want/care for a consistent(ly
 defined) system. Ok, sure, I'm free to implement any constrains on top of
 that but if they were already implemented I couldn't get rid of them: I'll
 grant you that reasoning

Re: How to: reduce boolean operations?

2013-05-23 Thread atkaaz
when you say the word false I'm assuming you're referring to false? the
function (not false the boolean value), otherwise I don't understand

so like: What matters is that *false?* returns truthy values when called
with any members of []
makes sense to me.

So all I was saying above is that it should throw when [] is empty just as
it does when [] is not empty, but it doesn't throw when empty because it's
never called (by it i mean false not false?)

= (type false)
java.lang.Boolean
= (type false?)
clojure.core$false_QMARK_
= (fn? false)
false
= (fn? false?)
true

But really, if you were not talking about false? then I don't get it (??)


On Thu, May 23, 2013 at 4:48 PM, Michał Marczyk michal.marc...@gmail.comwrote:

 Whether (false 1) or (false true) is truthy is irrelevant. What
 matters is that false returns truthy values when called with any
 members of [], which is of course the case, as [] has no members. (For
 it not to be the case, there would have to exist an x in [] for which
 (false x) were not truthy -- clearly there is no such x.)

 This is the same story as with quantification restricted to the empty set:

   \forall x \in \emptyset . \phi(x)

 is true regardless of what \phi is, and intimately related to how
 implication works in classical logic (since the above is shorthand for
 a formula involving implication):

   x - y

 is true when x is false, regardless of what value y takes. (It's also
 true when y is true, regardless of what value x takes; this, however,
 is not relevant here.)

 Cheers,
 M.


 On 23 May 2013 06:31, atkaaz atk...@gmail.com wrote:
  Well, seems to me more like this:
  if [] is empty then return true
  otherwise check (pred everyx in coll)
  however this allows for any pred especially(in this case) invalid preds:
  `false` is not a function/pred
  = (false 1)
  ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
  cgws.notcore/eval2542 (NO_SOURCE_FILE:1)
  = (false true)
  ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
  cgws.notcore/eval2564 (NO_SOURCE_FILE:1)
 
  doesn't seem truthy to me
 
  Thanks.
 
 
  On Thu, May 23, 2013 at 3:08 AM, Michał Marczyk 
 michal.marc...@gmail.com
  wrote:
 
  On 22 May 2013 18:34, atkaaz atk...@gmail.com wrote:
   I think the exception is thrown because you basically called (every?
   false
   coll) however on my clojure version I cannot reproduce it  oh wait
 there
   we
   go, some bug here with empty collection (maybe someone can pick it
 up):
   = (every? false [1 2 3])
   ClassCastException java.lang.Boolean cannot be cast to
 clojure.lang.IFn
   clojure.core/every? (core.clj:2423)
   = (every? false [])
   true
  
   = *clojure-version*
   {:interim true, :major 1, :minor 6, :incremental 0, :qualifier
 master}
 
  (every? false []) should return true if and only if (false x) is
  truthy for every x in [], which is certainly the case.
 
  Cheers,
  Michał
 
 
  
  
  
  
  
   On Wed, May 22, 2013 at 7:17 PM, Peter Mancini 
 peter.manc...@gmail.com
   wrote:
  
   So I did some coding and came up with this but it is broken;
  
   (= java.lang.Boolean (type false))  ;;evaluates to true
  
   (defn all-true?
 [coll]
 (every? (cond (= java.lang.Boolean (type identity)) identity :else
   false) coll)) ;;compiles
  
   (all-true? '(true true true))  ;; throws
 java.lang.ClassCastException:
   java.lang.Boolean cannot be cast to clojure.lang.IFn
   (all-true? '(true true false))
   (all-true? '(true true 3))
  
   --
   --
   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/groups/opt_out.
  
  
  
  
   --
   --
   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

Re: How to: reduce boolean operations?

2013-05-23 Thread atkaaz
Firstly let me just say that I really enjoy this conversation, ergo I thank
you!


On Thu, May 23, 2013 at 9:00 PM, Michał Marczyk michal.marc...@gmail.comwrote:

 On 23 May 2013 18:30, atkaaz atk...@gmail.com wrote:
  when you say the word false I'm assuming you're referring to false?
 the
  function (not false the boolean value), otherwise I don't understand

 I mean false-the-Boolean-value.

 To rephrase the point I was making previously, (false x) is a truthy
 value for any x in [] is a true sentence, indeed trivially so because
 [] is empty. Thus (every? false []) returning true totally makes
 sense.

 Alright, I see what you mean and you are right. But let's just state some
assumptions(which I see as conventions):
- the system that you're using (be it logic or mathematics or whatever it
is) to evaluate that that proposition is truthy  is assuming(without
checking) that the components are correct (such as false being a pred)
- when the collection is empty - returns true   (this is a convention imho)
  I see this system as being incomplete/incoherent/inconsistent(or insert
the right word here) because of those.
(false x) is a truthy value for any x in []
so that is a true sentence as you say, in this system(can I call it logic?
or whatever you call it really) of evaluation which you can collapse to the
implementation of every? as it is now in clojure. You may even say that
the implementation of every? was based on that(doesn't matter). But I say
that system is wrong xD so to speak, wrong as in
incomplete/inconsistent and may work somewhere else (in non-programming
environments ie. on paper) where assuming that the input is valid is the
norm /the only thing happening.
 In a programming environment, for me it doesn't make sense to can call or
evaluate something that has (at least one) inconsistent components
(inconsistent based on its own definition).
= (every? 1 [])
true

 So it is truthy as you say, but that doesn't mean anything other than it
is so(by convention/definion of) in this or that specific system(logic? or
the impl. of every? in clojure)
 That may be acceptable to clojure community or to ppl who want to get work
done, but not to (some) people who want/care for a consistent(ly defined)
system. Ok, sure, I'm free to implement any constrains on top of that but
if they were already implemented I couldn't get rid of them: I'll grant you
that reasoning for keeping it the way it is now. But it's little
things(inconsistencies I'll call them) like this which will make way for
bugs which can be hard to track down. There's no guarantee that someone
sometime will pass the wrong param either being aware of it or not and
depending on the case it may go unnoticed and/or throw in a different place
which seems quite unrelated to where the bug actually is.
  Anyway, I'm lingering, simply put: you're right   using your system of
evaluation, but not when using mine; mine says: make sure everything is
consistent within its own definition (so 1 above must be checked if it
really fits the pred pattern (ie. is that a pred; is the entire
proposition(or call) syntacticallysemantically valid), if it doesn't the
the entire call is invalid and should/will throw) and I will add to that:
 that if the collection is empty then also throw, for it doesn't make
sense(to me) to check an empty collection (which you sort of assume is non
empty by the name every?) for a predicate, and therefore you are kind of
forced to use a convention(aka if empty return true) if you want to not
throw in this case. (yep I would really throw on empty collection, for if
you got to where you accidentally called every? on an empty collection
you're way past the point in the caller where you should've checked for an
empty collection anyway - that is, if you care about handling all(or most?)
cases for the purpose of your program being consistent)


So, assuming non-empty collections are the norm, we get an exception
 either way -- would having the exception come from every? rather than
 the attempt to call the not-really-a-predicate object be of much help
 in debugging?

I find it would be more consistent to throw from every? as if it makes the
check that all its inputs are correct (so making sure pred is a pred ie. a
fn  and not a value - that can't be used as a pred at least like a :keyword
could)
And also, as I said above, I'd throw when empty collection too (but that's
never gonna happen in clojure, I understand that especially because of what
John D. Hume said in an above post - makes sense(if you want to get things
done especially), but that is not my way(hence why I got nothing done so
far - so the joke's on me :) ))

wait, shouldn't this work?
= (:a {:a 1})
1
= *(every? :a {:a 1})*
false
= (coll? {:a 1})
true


;well at least this one works:
= (every? {:a 1} [:a])
true
= ({:a 1} :a)
1
;so I'm probably missing something


 Cheers,
 M.

 Cheers  thank you for this great interaction!


 
  so like: What matters is that false? returns truthy

Re: Design/structure for a game loop in clojure

2013-05-22 Thread atkaaz
concurrency-wise, you might find useful Rich Hickey's ants simulation

https://github.com/juliangamble/clojure-ants-simulation/
the relevant video where he explains it:
https://www.youtube.com/watch?v=dGVqrGmwOAw
(if you want the slides too, see in the comments: someone suggested google
for Must watch: Clojure concurrency)



On Mon, May 20, 2013 at 4:02 AM, Daniel P. Wright d...@dpwright.com wrote:

 Hello,

 I am trying to structure the game loop for a simple game in clojure,
 trying to keep things pure as far as possible to get a feel for how this
 would work in a functional environment.  Currently, I am working with
 a message-based system, whereby various events create messages which I
 then act on to change state.  For example:

   1. Read keypresses, generate a message for each keypress and add to
  the queue.
   2. Read from the network; add any incoming messages to the queue.
   3. Add an update message to the queue which can be used for generic
  update processing: AI, physics, whatever
   4. Go through the entities in my world delivering these messages as
  appropriate.  Keypress and update messages will be processed by any
  entity that implements a handler for them; network messages may be
  directed so that they only get sent to a specific entity.
 (The return value of the functions processing these messages is
  itself a vector of messages, such as update-state to replace the
  current state of an entity (position, etc) with a new state, or
  perhaps a message to send information over the network.)
   5. Send any outgoing network messages, perform any state updates, etc.
   6. Draw the screen, return to 1 and begin the next game loop.

 The issue I'm having is that this system results in rather a lot of
 looping through every entity in the world.  There are two full loops,
 delivering the messages in step 4 and updating the state in step 5.
 Originally I had the message handlers in step 4 return a new state
 rather than new messages, so I just updated the entities in-place during
 the first loop, but I found sometimes I wanted to do other things than
 just update state -- for example send messages over the network, or to
 another entity in the world.  So it seemed more flexible to return
 messages, even if some of those messages are directed toward the entity
 sending it.

 My other issue is that with messages intended to be processed by a
 particular entity, I can either check that while looping through the
 whole list of entities (which means for every entity it's not intended
 for I'm running a wasteful check on the id of a message), or I can put
 the entities in a map instead of a vector and look them up by some id
 instead (in which case I'm doing a search for every directed message, on
 top of the loop I'm already doing through all the entities).

 I've come from a mostly C++ background, so my sense of when I'm doing
 something really bad isn't very well-tuned in functional languages at
 the moment.  I write something that feels nice and looks pretty, and
 then I step back and think about what it's actually *doing* and I can't
 help but think in C++ this would be unforgivably vile.

 It seems the more I try to push function purity the more I have to loop
 through some monolithic data structure holding all of my state, since I
 can't just pass references around and modify them in-place.  Writing the
 code for the entities themselves is going quite well -- I am keeping
 their functions pure, not referring to anything outside of the
 parameters they're passed in, and thus always returning the same result
 given the same input, and limiting their input to the information they
 need without giving them access to the entire state of everything -- all
 of which is great for testing, parallelisation, and all the rest.  It's
 at the higher level of managing the collection of these entities and
 their relationships that I wonder whether I am working along the right
 lines or whether I am in some sense doing it wrong.

 As an aside, right now I am avoiding storing entity state as atoms and
 having the update functions modify those atoms because although clojure
 helps update their values safely it still means the function has side
 effects, and I'm trying to keep functions as pure as possible at least
 until I can understand the limitations of doing that and see the
 necessity for using global constructs.

 I have a feeling this is only going to get more complex as I start
 wanting to make smaller sub-lists that refer to the same entities.  For
 example my entities may be stored in some tree format in the world
 state, but I might want to have a list of all enemies within a certain
 radius or whatever just as a convenience for quick access to those
 entities I'm interested in.  Right now if I updated an entity in this
 list it would remain not updated in the global state tree... I'm
 guessing there's no way around holding an atom or similar in both lists
 and 

Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote:

  I noticed that '(nil nil true) will cause and to produce false, so I am
 aware of that edge case. Anything else I should be aware of?

 What about the other edge?
user=  (reduce #(and %1 %2) '(1 true 2))
2
user= (eval (conj '(1 true 3) 'and))
3

user= (doc and)
-
clojure.core/and
([] [x] [x  next])
Macro
  Evaluates exprs one at a time, from left to right. If a form
  returns logical false (nil or false), and returns that value and
  doesn't evaluate any of the other expressions, otherwise it returns
  the value of the last expr. (and) returns true.
nil


 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
 ---
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
I find the wording of this confusing otherwise it returns the value
of the last
expr. (and) returns true.
I mean, I know it returns the last true value, but that's because I've
tested it not because the doc is trying(failing) to tell me so with that
phrase.



On Wed, May 22, 2013 at 1:28 PM, atkaaz atk...@gmail.com wrote:




 On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote:

  I noticed that '(nil nil true) will cause and to produce false, so I
 am aware of that edge case. Anything else I should be aware of?

 What about the other edge?
 user=  (reduce #(and %1 %2) '(1 true 2))
 2
 user= (eval (conj '(1 true 3) 'and))
 3

 user= (doc and)
 -
 clojure.core/and
 ([] [x] [x  next])
 Macro
   Evaluates exprs one at a time, from left to right. If a form
   returns logical false (nil or false), and returns that value and
   doesn't evaluate any of the other expressions, otherwise it returns
   the value of the last expr. (and) returns true.
 nil


 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
 ---
 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/groups/opt_out.






-- 
-- 
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/groups/opt_out.




Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
Oh i see now, thank you!

so it's like this:
otherwise it returns the value of the last expression.
 (and) returns true.

i though expr. is the short for of the word expression which requires a
dot, but the dot was in fact an end of sentence.


On Wed, May 22, 2013 at 2:40 PM, John D. Hume duelin.mark...@gmail.comwrote:


 On May 22, 2013 5:35 AM, atkaaz atk...@gmail.com wrote:
 
  I find the wording of this confusing otherwise it returns the value of
 the last expr. (and) returns true.
  I mean, I know it returns the last true value, but that's because I've
 tested it not because the doc is trying(failing) to tell me so with that
 phrase.

 The next-to-last sentence describes the behavior you're talking about. The
 last sentence is addressing the no-args case. Starting a sentence with a
 parenthesized form makes it hard to read.

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] tawny-owl 0.11

2013-05-22 Thread atkaaz
For those who don't know the concepts (aka me) can we get a working example
of what can be done ? I'm having a strange feeling that ontologies(although
I've never heard the word/idea before except from you) might be something
similar to what I am searching for...

Possibly an example that showcases everything that can be done ? though
that might be too much to ask, or perhaps suggest a link url to something
that might help (me) understand ?

Thanks.


On Wed, May 22, 2013 at 2:41 PM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:


 I'm pleased to announce the release of tawny-owl 0.11.

 What is it?
 ==

 This package allows users to construct OWL ontologies in a fully
 programmatic
 environment, namely Clojure. This means the user can take advantage of
 programmatic language to automate and abstract the ontology over the
 development process; also, rather than requiring the creation of ontology
 specific development environments, a normal programming IDE can be used;
 finally, a human readable text format means that we can integrate with the
 standard tooling for versioning and distributed development.

 Changes
 ===

 # 0.11

 ## New features

 - facts on individual are now supported
 - documentation has been greatly extended
 - OWL API 3.4.4


 A new paper on the motivation and use cases for tawny-owl is also
 available at http://www.russet.org.uk/blog/2366

 https://github.com/phillord/tawny-owl

 Feedback welcome!

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: asm-based clojure yet?

2013-05-22 Thread atkaaz
thank you very much, my search has lead me to seeking a lisp that could
compile to machine code (mainly because i cannot accept the 20-22 sec `lein
repl` startup time and eclipse/ccw memory consumptions - so I was hoping
for something fast even though the cost is portability and all else)


On Wed, May 22, 2013 at 3:10 PM, Julian juliangam...@gmail.com wrote:

 One more thought on the broader ideas of LISPy languages and ASM. One of
 the versions of Crash Bandicoot was developed in Game Oriented Assembly
 LISP (GOAL) - which was a common LISP DSL that generated assembler.

 I recalled this today because Michael Fogus tweeted about it:
 https://twitter.com/fogus/status/336865798628966400

 If you're a hobbyist dabbling in this space then you might find reading
 about it interesting and inspiring:
 http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

 http://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9/

 JG


 On Sunday, 19 May 2013 01:49:43 UTC+10, Gary Trakhman wrote:

 It's hard to really appreciate java and clojure until you actually write
 some C/C++ or ASM.. I have some minor experience with that stuff, and it
 still haunts me from time to time.

 Sometimes we make tradeoffs without knowing we did.  By choosing a
 language, or having the choice made for us, we accept a set of abstractions
 as our bottom level of thinking for a problem-space.  Only old-timers and
 people that make a point to care about low-level stuff will notice the
 implications of what they're doing along the abstraction stack.  People
 with ingrained habits just won't find it easy to think functionally, but
 I'm young and irreverent, so it doesn't bother me :-).

 C++ is fun because of all the bolted-on kludges that 'mitigate' these
 problems.  You can use operator-overloading on pointer operations to
 perform automatic reference counting, deallocating objects when things that
 point to them go out of scope, but I think implementing a PersistentHashMap
 this way would be very difficult.  Also, pretty sure it can't handle cycles.

 I guess the point is, I appreciate any effort to understand such issues,
 it's been a useful thing for me to know in the 0.05% of time that knowledge
 is needed.

 But, people who don't know just won't be able to get past those problems.
  And, you generally can't easily find a _really_ full-stack guy to glance
 at it for you when it would be useful to have one.

 On Sat, May 18, 2013 at 11:24 AM, atkaaz atk...@gmail.com wrote:

 your comment caused me to be reading this http://prog21.dadgum.com/134.*
 *html http://prog21.dadgum.com/134.html
   (at least)


 On Sat, May 18, 2013 at 6:17 PM, Gary Trakhman gary.t...@gmail.comwrote:

 Immutability, persistence, closures without a serious garbage collector
 sounds hard.


 On Sat, May 18, 2013 at 1:09 AM, atkaaz atk...@gmail.com wrote:

 Thanks very much everyone! I'm looking into all of those, but
 currently planning to read Julian's pdf. I didn't want to say anything
 until I had something definite, but just letting y'all know that I'm
 considering each recommendation.


 On Sat, May 18, 2013 at 7:12 AM, Julian julian...@gmail.com wrote:

 If you had a hobbyist interest in representing S-expressions in
 assembler - then you could take a look at the tutorial written by 
 Abdulaziz
 Ghuloum called Compilers: Backend to Frontend and Back to Front Again. 
 It
 used to be available here: http://www.cs.indiana.**
 edu/~aghuloum/compilers-**tutorial-2006-09-16.pdfhttp://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-09-16.pdf

 I don't know if it available anywhere else on the internet - but I
 grabbed another copy and put it here: https://sites.google.**
 com/site/juliangamble/Home/**Compilers%20Tutorial%202006-**
 09-16.pdf?attredirects=0d=1https://sites.google.com/site/juliangamble/Home/Compilers%20Tutorial%202006-09-16.pdf?attredirects=0d=1

 For a more serious representation of Clojure's persistent data
 structures, I don't recommend trying to implement them in ASM.

 Cheers
 Julian


 On Friday, 17 May 2013 22:06:45 UTC+10, Alan D. Salewski wrote:

 On Fri, May 17, 2013 at 02:10:02PM +0300, atkaaz spake thus:
  Ok, weird question: is there some clojure port on assembler yet?
 Even
  if(/especially if) it doesn't have jvm/java/javalibs support
 
  Or should I just check 
  https://github.com/clojure/**clo**jure-clrhttps://github.com/clojure/clojure-clr?
 
  I'm mainly interested in low memory footprint and fast startup
 times (does
  clojure-clr have that?)

 You may want to check out ClojureScript, too. ClojureScript programs
 leveraging nodejs for host interop have fast startup times:

 
 https://github.com/clojure/**clo**jurescript/wikihttps://github.com/clojure/clojurescript/wiki

 --
 -----

 a l a n   d.   s a l e w s k i   sale...@att.net
 1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588

Re: [ANN] tawny-owl 0.11

2013-05-22 Thread atkaaz
Thank you very much for this! I find it very interesting, I shall keep
reading


On Wed, May 22, 2013 at 4:24 PM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:



 It's a good question; the library is more intended for people who know
 ontologies and don't care, or have never heard about, clojure. So the
 documentation is biased in that way.

 In this setting, an ontology is essentially a set of facts, that you can
 test with a computational reasoner; so, it's something like logic
 programming. I don't implement the reasoner -- someone else has done
 that (in fact there are several). These reasoners can scale up to
 100'000s of terms.

 My example Pizza ontology shows it in use.

 https://github.com/phillord/tawny-pizza

 So, you can make statements like

 (defclass CheesyPizza
   :equivalent
   (owland Pizza
(owlsome hasTopping CheeseTopping)))

 and

 (defclass MozzarellaTopping
:subclass CheeseTopping)

 and finally,

 (defclass MargheritaPizza
:subclass
  (someonly hasTopping CheeseTopping TomatoTopping))

 and the reasoner will work out that MargheritaPizza is a CheesyPizza.

 In itself, this is simple, but you can build up more complex classes
 like so.

 (defclass VegetarianPizza
   :equivalent
   (owland Pizza
   (owlnot
(owlsome hasTopping MeatTopping))
   (owlnot
(owlsome hasTopping FishTopping

 (defclass NonVegetarianPizza
   :equivalent
   (owland Pizza (owlnot VegetarianPizza)))

 Of course, really takes flight when you have large ontologies. FMA which
 models human anatomy, has I think, about 100,000 terms. SNOMED (ways you
 can get ill) has millions.

 Now there are lots of tools for building these; the novelty with tawny
 is that the raw syntax is relatively simple (most of tawny-pizza does
 not look like a programming language), but it is entirely programmatic;
 so, it is possible to automate, build patterns, and integrate with
 external infrastructure all in one place. I think that this is going to
 be very useful, but we shall see!

 While I am interested in biomedical and scientific ontologies, there are
 lots of other applications. Probably the most famous one at the moment
 is Siri (the iphone thingy) which is ontological powered underneath.

 There are quite a few articles, varying in scope on ontologies on
 ontogenesis http://ontogenesis.knowledgeblog.org.

 It is a very valid point, though. I should write some documentation on
 ontologies for programmers. I shall work on it!

 Phil


 atkaaz atk...@gmail.com writes:

  For those who don't know the concepts (aka me) can we get a working
 example
  of what can be done ? I'm having a strange feeling that
 ontologies(although
  I've never heard the word/idea before except from you) might be something
  similar to what I am searching for...
 
  Possibly an example that showcases everything that can be done ? though
  that might be too much to ask, or perhaps suggest a link url to something
  that might help (me) understand ?
 
  Thanks.
 
 
  On Wed, May 22, 2013 at 2:41 PM, Phillip Lord
  phillip.l...@newcastle.ac.ukwrote:
 
 
  I'm pleased to announce the release of tawny-owl 0.11.
 
  What is it?
  ==
 
  This package allows users to construct OWL ontologies in a fully
  programmatic
  environment, namely Clojure. This means the user can take advantage of
  programmatic language to automate and abstract the ontology over the
  development process; also, rather than requiring the creation of
 ontology
  specific development environments, a normal programming IDE can be used;
  finally, a human readable text format means that we can integrate with
 the
  standard tooling for versioning and distributed development.
 
  Changes
  ===
 
  # 0.11
 
  ## New features
 
  - facts on individual are now supported
  - documentation has been greatly extended
  - OWL API 3.4.4
 
 
  A new paper on the motivation and use cases for tawny-owl is also
  available at http://www.russet.org.uk/blog/2366
 
  https://github.com/phillord/tawny-owl
 
  Feedback welcome!
 
  --
  --
  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/groups/opt_out.
 
 
 
 
  --

 --
 Phillip Lord,   Phone: +44 (0) 191 222 7827
 Lecturer in Bioinformatics, Email:
 phillip.l...@newcastle.ac.uk
 School of Computing

Re: [ANN] tawny-owl 0.11

2013-05-22 Thread atkaaz
Would you say that ontologies can be modeled on top of graphs? so in a way
they can be seen as a specific use case for graphs? (maybe directed acyclic
graphs), that's what I am getting the sense of so far



On Wed, May 22, 2013 at 4:47 PM, atkaaz atk...@gmail.com wrote:

 Thank you very much for this! I find it very interesting, I shall keep
 reading


 On Wed, May 22, 2013 at 4:24 PM, Phillip Lord 
 phillip.l...@newcastle.ac.uk wrote:



 It's a good question; the library is more intended for people who know
 ontologies and don't care, or have never heard about, clojure. So the
 documentation is biased in that way.

 In this setting, an ontology is essentially a set of facts, that you can
 test with a computational reasoner; so, it's something like logic
 programming. I don't implement the reasoner -- someone else has done
 that (in fact there are several). These reasoners can scale up to
 100'000s of terms.

 My example Pizza ontology shows it in use.

 https://github.com/phillord/tawny-pizza

 So, you can make statements like

 (defclass CheesyPizza
   :equivalent
   (owland Pizza
(owlsome hasTopping CheeseTopping)))

 and

 (defclass MozzarellaTopping
:subclass CheeseTopping)

 and finally,

 (defclass MargheritaPizza
:subclass
  (someonly hasTopping CheeseTopping TomatoTopping))

 and the reasoner will work out that MargheritaPizza is a CheesyPizza.

 In itself, this is simple, but you can build up more complex classes
 like so.

 (defclass VegetarianPizza
   :equivalent
   (owland Pizza
   (owlnot
(owlsome hasTopping MeatTopping))
   (owlnot
(owlsome hasTopping FishTopping

 (defclass NonVegetarianPizza
   :equivalent
   (owland Pizza (owlnot VegetarianPizza)))

 Of course, really takes flight when you have large ontologies. FMA which
 models human anatomy, has I think, about 100,000 terms. SNOMED (ways you
 can get ill) has millions.

 Now there are lots of tools for building these; the novelty with tawny
 is that the raw syntax is relatively simple (most of tawny-pizza does
 not look like a programming language), but it is entirely programmatic;
 so, it is possible to automate, build patterns, and integrate with
 external infrastructure all in one place. I think that this is going to
 be very useful, but we shall see!

 While I am interested in biomedical and scientific ontologies, there are
 lots of other applications. Probably the most famous one at the moment
 is Siri (the iphone thingy) which is ontological powered underneath.

 There are quite a few articles, varying in scope on ontologies on
 ontogenesis http://ontogenesis.knowledgeblog.org.

 It is a very valid point, though. I should write some documentation on
 ontologies for programmers. I shall work on it!

 Phil


 atkaaz atk...@gmail.com writes:

  For those who don't know the concepts (aka me) can we get a working
 example
  of what can be done ? I'm having a strange feeling that
 ontologies(although
  I've never heard the word/idea before except from you) might be
 something
  similar to what I am searching for...
 
  Possibly an example that showcases everything that can be done ? though
  that might be too much to ask, or perhaps suggest a link url to
 something
  that might help (me) understand ?
 
  Thanks.
 
 
  On Wed, May 22, 2013 at 2:41 PM, Phillip Lord
  phillip.l...@newcastle.ac.ukwrote:
 
 
  I'm pleased to announce the release of tawny-owl 0.11.
 
  What is it?
  ==
 
  This package allows users to construct OWL ontologies in a fully
  programmatic
  environment, namely Clojure. This means the user can take advantage of
  programmatic language to automate and abstract the ontology over the
  development process; also, rather than requiring the creation of
 ontology
  specific development environments, a normal programming IDE can be
 used;
  finally, a human readable text format means that we can integrate with
 the
  standard tooling for versioning and distributed development.
 
  Changes
  ===
 
  # 0.11
 
  ## New features
 
  - facts on individual are now supported
  - documentation has been greatly extended
  - OWL API 3.4.4
 
 
  A new paper on the motivation and use cases for tawny-owl is also
  available at http://www.russet.org.uk/blog/2366
 
  https://github.com/phillord/tawny-owl
 
  Feedback welcome!
 
  --
  --
  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

Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
= (type identity)
clojure.core$identity



On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.comwrote:

 So I did some coding and came up with this but it is broken;

 (= java.lang.Boolean (type false))  ;;evaluates to true

 (defn all-true?
   [coll]
   (every? (cond (= java.lang.Boolean (type identity)) identity :else
 false) coll)) ;;compiles

 (all-true? '(true true true))  ;; throws java.lang.ClassCastException:
 java.lang.Boolean cannot be cast to clojure.lang.IFn
 (all-true? '(true true false))
 (all-true? '(true true 3))

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
I think the exception is thrown because you basically called (every? false
coll) however on my clojure version I cannot reproduce it  oh wait there we
go, some bug here with empty collection (maybe someone can pick it up):
= (every? false [1 2 3])
ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
clojure.core/every? (core.clj:2423)
= (every? false [])
true

= *clojure-version*
{:interim true, :major 1, :minor 6, :incremental 0, :qualifier master}





On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.comwrote:

 So I did some coding and came up with this but it is broken;

 (= java.lang.Boolean (type false))  ;;evaluates to true

 (defn all-true?
   [coll]
   (every? (cond (= java.lang.Boolean (type identity)) identity :else
 false) coll)) ;;compiles

 (all-true? '(true true true))  ;; throws java.lang.ClassCastException:
 java.lang.Boolean cannot be cast to clojure.lang.IFn
 (all-true? '(true true false))
 (all-true? '(true true 3))

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
there's another edge case when using and/or :
 getting passed an unbound var  where for example `nil?` and `str` applied
to it don't throw, and of course also `or` and `and`, ie.:

= (def a)
#'cgws.notcore/a
= a
#Unbound Unbound: #'cgws.notcore/a
= (nil? a)
false
= (str a)
Unbound: #'cgws.notcore/a
= (or a)
#Unbound Unbound: #'cgws.notcore/a
= (or 1 2 a)
1
= (or a 1 2)
#Unbound Unbound: #'cgws.notcore/a
= (and 1 2 3 a)
#Unbound Unbound: #'cgws.notcore/a
= (and a 1 2 3)
3

= (type a)
clojure.lang.Var$Unbound

= (cond a 2)
2
= (when a 3)
3
= (if a 4 5)
4

= (bound? #'a)
false
= (bound? a)   ; in case anyone was wondering
ClassCastException clojure.lang.Var$Unbound cannot be cast to
clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

= (defn test1 [input]
 (cond (and (not (nil? input)))
   (println received nice input=` input `)
   :else
   (throw (RuntimeException. (str bad input: input)
#'cgws.notcore/test1
= (test1 1)
received nice input=` 1 `
nil
= (test1 nil)
RuntimeException bad input:  cgws.notcore/test1 (NO_SOURCE_FILE:5)
= (test1 a)
received nice input=` #Unbound Unbound: #'cgws.notcore/a `
nil

but I guess I should've put this in its proper thread aka here:
https://groups.google.com/forum/#!msg/clojure/LmpcTRPUAY0/8ieaRmM7pIUJ



On Wed, May 22, 2013 at 1:28 PM, atkaaz atk...@gmail.com wrote:




 On Wed, May 22, 2013 at 3:06 AM, Peter Mancini pe...@cicayda.com wrote:

  I noticed that '(nil nil true) will cause and to produce false, so I
 am aware of that edge case. Anything else I should be aware of?

 What about the other edge?
 user=  (reduce #(and %1 %2) '(1 true 2))
 2
 user= (eval (conj '(1 true 3) 'and))
 3

 user= (doc and)
 -
 clojure.core/and
 ([] [x] [x  next])
 Macro
   Evaluates exprs one at a time, from left to right. If a form
   returns logical false (nil or false), and returns that value and
   doesn't evaluate any of the other expressions, otherwise it returns
   the value of the last expr. (and) returns true.
 nil


 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
 ---
 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/groups/opt_out.






-- 
-- 
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/groups/opt_out.




Re: asm-based clojure yet?

2013-05-22 Thread atkaaz
Looks like I forgot to enable the paging file (windows virtual memory was
disabled) and that is why my eclipse/firefox would crash when running out
of memory  and also had much eclipse.ini memory allocated -Xms228m -Xmx712m
; and because of all these I was unable to start repl most of the time in
ccw due to not enough memory(it said), so due to your comment (thank you),
I've fixed those and set -Xms128m -Xmx512m but will probably go back to 712
(it's ok now since I've the paging file); but the memory total is like
3.5gig since 512 is eaten by video card memory.

So now at least I can run them without running out of memory all the time
:) but they still use quite a lot and I found myself having to run lein
commands (like lein test) and restarting repls enough times for it to make
me want something else - but I am an odd ball, so it's not something
everyone else will do.

Honestly I really want a system where things are more accessible,
unfortunately I can't explain this (i'll try if u really want me to) for
example I really enjoyed the F3 in eclipse on java source code which would
do Go to Definition/Declaration (of this identifier), and also the find all
calls to this method in this project and the refactoring... this kind of
connectivity I'd expect to be in the system (from what I've read some Lisp
machines(?) or the lisp lang on some machines really have that was it
Genera ? and some read about Dynamic Windows  but I also remember something
vaguely about ruby - haven't used it though). In a more broader way, I want
to be able to explore/deduce the system without having to jump through
hoops like googling for information about it, when in fact I already have
it running on my system, why not just explore its construction live while
it's running, visualize all its connections (like in a graph)

I like this clojure lang because it gets me closer to the way I want things
to be, but it feels all so disconnected like I can't feel that when writing
some code I can just easily F3 on a symbol and see where else it was used
or even defined(sometimes this works in ccw btw ie. for clojure core code)


So far, I'm thinking maybe code something from assembler level up (maybe
even not requiring garbage collector but still not using explicit mem
allocations like malloc) so it will eventually become a replacement for
whatever I use for text editor, and if it does the way I think it will, I
can then store all kinds of information and advance it even to the next
level... but there's all these barrier with transactions and locks but this
functional programming idea might be pretty good to apply(even though I
envisioned a system where everything would be global(ly accessible)
restrictions can still apply in dependency style like A depends on B and C
depends on B, so if I want to change B then the way A and C depend on B
have to be satisfied before the change can occur or that change will have
to include changes to A and/or C also).


Sorry for the rant, it's just that i feel lost so far(and not very
knowledgeable). I just imagine how awesome it would be to can explore a
system (PC+OS+java+clojure+some window+some text+some word on it) of which
say you know nothing of, from a point (any point you choose) and be able to
understand it and see how everything interconnects to everything else (no
data/level/layer stripped just like the .exe is without the sourcecode for
example), because everything you need is there, visually explorable(maybe
graph like) and even changeable, if you just need to know exactly how is
some word(or even a pixel) on the screen connected to everything else for
example you could dig in - I don't know how it would look and how to
implement that so far, but i know I want it, and apparently I'm reluctant
to accepting the status quo even though that's the only way to get there :/
It can still be fast even though all the debug info (so to speak) and
source code is tagged/connected to the binary code/offsets  I imagine.





On Wed, May 22, 2013 at 6:51 PM, Mikera mike.r.anderson...@gmail.comwrote:

 On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote:

 thank you very much, my search has lead me to seeking a lisp that could
 compile to machine code (mainly because i cannot accept the 20-22 sec `lein
 repl` startup time and eclipse/ccw memory consumptions - so I was hoping
 for something fast even though the cost is portability and all else)


 The above strikes me as a slightly odd statement. Eclipse/CCW or lein repl
 startup times should be irrelevant because you should only be incurring
 them once, when starting a development session. Sure, Eclipse eats memory
 too, but again this is only a development time issue and your dev machine
 should have plenty, right?

 In production, running the packaged .jar file should be pretty quick and
 much more lightweight. JVM startup is less than 0.1sec nowadays, so you can
 get a splash screen or basic GUI up in front of a user almost immediately.
 That only leaves

Re: asm-based clojure yet?

2013-05-22 Thread atkaaz
I don't know about the emacs stuff, but I consider the latter to be a
nice workaround/hack :)


On Wed, May 22, 2013 at 8:35 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 emacs does this navigation stuff.. M-. and M-, . For uses of a function,
 try grep -R or rgrep.


 On Wed, May 22, 2013 at 1:30 PM, atkaaz atk...@gmail.com wrote:

 Looks like I forgot to enable the paging file (windows virtual memory was
 disabled) and that is why my eclipse/firefox would crash when running out
 of memory  and also had much eclipse.ini memory allocated -Xms228m -Xmx712m
 ; and because of all these I was unable to start repl most of the time in
 ccw due to not enough memory(it said), so due to your comment (thank you),
 I've fixed those and set -Xms128m -Xmx512m but will probably go back to 712
 (it's ok now since I've the paging file); but the memory total is like
 3.5gig since 512 is eaten by video card memory.

 So now at least I can run them without running out of memory all the time
 :) but they still use quite a lot and I found myself having to run lein
 commands (like lein test) and restarting repls enough times for it to make
 me want something else - but I am an odd ball, so it's not something
 everyone else will do.

 Honestly I really want a system where things are more accessible,
 unfortunately I can't explain this (i'll try if u really want me to) for
 example I really enjoyed the F3 in eclipse on java source code which would
 do Go to Definition/Declaration (of this identifier), and also the find all
 calls to this method in this project and the refactoring... this kind of
 connectivity I'd expect to be in the system (from what I've read some Lisp
 machines(?) or the lisp lang on some machines really have that was it
 Genera ? and some read about Dynamic Windows  but I also remember something
 vaguely about ruby - haven't used it though). In a more broader way, I want
 to be able to explore/deduce the system without having to jump through
 hoops like googling for information about it, when in fact I already have
 it running on my system, why not just explore its construction live while
 it's running, visualize all its connections (like in a graph)

 I like this clojure lang because it gets me closer to the way I want
 things to be, but it feels all so disconnected like I can't feel that when
 writing some code I can just easily F3 on a symbol and see where else it
 was used or even defined(sometimes this works in ccw btw ie. for clojure
 core code)


 So far, I'm thinking maybe code something from assembler level up (maybe
 even not requiring garbage collector but still not using explicit mem
 allocations like malloc) so it will eventually become a replacement for
 whatever I use for text editor, and if it does the way I think it will, I
 can then store all kinds of information and advance it even to the next
 level... but there's all these barrier with transactions and locks but this
 functional programming idea might be pretty good to apply(even though I
 envisioned a system where everything would be global(ly accessible)
 restrictions can still apply in dependency style like A depends on B and C
 depends on B, so if I want to change B then the way A and C depend on B
 have to be satisfied before the change can occur or that change will have
 to include changes to A and/or C also).


 Sorry for the rant, it's just that i feel lost so far(and not very
 knowledgeable). I just imagine how awesome it would be to can explore a
 system (PC+OS+java+clojure+some window+some text+some word on it) of which
 say you know nothing of, from a point (any point you choose) and be able to
 understand it and see how everything interconnects to everything else (no
 data/level/layer stripped just like the .exe is without the sourcecode for
 example), because everything you need is there, visually explorable(maybe
 graph like) and even changeable, if you just need to know exactly how is
 some word(or even a pixel) on the screen connected to everything else for
 example you could dig in - I don't know how it would look and how to
 implement that so far, but i know I want it, and apparently I'm reluctant
 to accepting the status quo even though that's the only way to get there :/
 It can still be fast even though all the debug info (so to speak) and
 source code is tagged/connected to the binary code/offsets  I imagine.





 On Wed, May 22, 2013 at 6:51 PM, Mikera mike.r.anderson...@gmail.comwrote:

 On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote:

 thank you very much, my search has lead me to seeking a lisp that could
 compile to machine code (mainly because i cannot accept the 20-22 sec `lein
 repl` startup time and eclipse/ccw memory consumptions - so I was hoping
 for something fast even though the cost is portability and all else)


 The above strikes me as a slightly odd statement. Eclipse/CCW or lein
 repl startup times should be irrelevant because you should only be
 incurring them once, when starting

Re: How to: reduce boolean operations?

2013-05-22 Thread atkaaz
Well, seems to me more like this:
if [] is empty then return true
otherwise check (pred everyx in coll)
however this allows for any pred especially(in this case) invalid preds:
`false` is not a function/pred
= (false 1)
ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
cgws.notcore/eval2542 (NO_SOURCE_FILE:1)
= (false true)
ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
cgws.notcore/eval2564 (NO_SOURCE_FILE:1)

doesn't seem truthy to me

Thanks.


On Thu, May 23, 2013 at 3:08 AM, Michał Marczyk michal.marc...@gmail.comwrote:

 On 22 May 2013 18:34, atkaaz atk...@gmail.com wrote:
  I think the exception is thrown because you basically called (every?
 false
  coll) however on my clojure version I cannot reproduce it  oh wait there
 we
  go, some bug here with empty collection (maybe someone can pick it up):
  = (every? false [1 2 3])
  ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn
  clojure.core/every? (core.clj:2423)
  = (every? false [])
  true
 
  = *clojure-version*
  {:interim true, :major 1, :minor 6, :incremental 0, :qualifier master}

 (every? false []) should return true if and only if (false x) is
 truthy for every x in [], which is certainly the case.

 Cheers,
 Michał


 
 
 
 
 
  On Wed, May 22, 2013 at 7:17 PM, Peter Mancini peter.manc...@gmail.com
  wrote:
 
  So I did some coding and came up with this but it is broken;
 
  (= java.lang.Boolean (type false))  ;;evaluates to true
 
  (defn all-true?
[coll]
(every? (cond (= java.lang.Boolean (type identity)) identity :else
  false) coll)) ;;compiles
 
  (all-true? '(true true true))  ;; throws java.lang.ClassCastException:
  java.lang.Boolean cannot be cast to clojure.lang.IFn
  (all-true? '(true true false))
  (all-true? '(true true 3))
 
  --
  --
  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/groups/opt_out.
 
 
 
 
  --
  --
  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/groups/opt_out.
 
 

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: confused on set!

2013-05-21 Thread atkaaz
The following idea came to me in the shower, sort of out of the blue, and I
don't know why I didn't think of it before(I'm disappointed with myself)
so, why not use the same thing as clojure does? even though it does it in
java, you can do it in clojure, the only thing is that you have to do it
once, probably where you define the var, such as(well unfortunately it
doesn't work O_o maybe someone can explain?):
(I was gonna try java interop but I notice there's *
clojure.core/push-thread-bindings*)

=* (def ^:dynamic *test4* false)*
#'cgws.notcore/*test4*
= *(push-thread-bindings {#'*test4* true})*
nil
= **test4**
*false*
= (pop-thread-bindings)
nil
= *test4*
false

= (def ^:dynamic a 1)
#'cgws.notcore/a
= (push-thread-bindings {#'a 2})
nil
= a
1
= (set! a 3)
IllegalStateException Can't change/establish root binding of: a with set
clojure.lang.Var.set (Var.java:233)

(defn *push-thread-bindings*
  WARNING: This is a low-level function. Prefer high-level macros like
  binding where ever possible.

  Takes a map of Var/value pairs. Binds each Var to the associated value for
  the current thread. Each call *MUST* be accompanied by a matching call to
  pop-thread-bindings wrapped in a try-finally!

  (push-thread-bindings bindings)
  (try
...
(finally
  (pop-thread-bindings)))
  {:added 1.1
   :static true}
  [bindings]
  (clojure.lang.Var/pushThreadBindings bindings))
nil

=* *clojure-version**
{:interim true, :major 1, :minor* 6*, :incremental 0, :qualifier master}


so if this worked as I expected then the following two statements would be
in the same place:
= (def ^:dynamic *test1*)
#'cgws.notcore/*test1*
= (push-thread-bindings {#'test1 default value here})
nil

;and the third could be anywhere (in current thread, 'cause just as
clojure's *warn-on-reflection* when on a different thread you still can't
set! it)
= (set! test1 user value)
IllegalStateException Can't change/establish root binding of: test1 with
set  clojure.lang.Var.set (Var.java:233)

*So, is **push-thread-bindings broken(unlikely) or am I missing
something(most certainly so) ?*



On Fri, May 17, 2013 at 6:49 PM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:

 Jim jimpil1...@gmail.com writes:

  On 17/05/13 11:00, Phillip Lord wrote:
  It's a nice language, I think. It inherits however the some of the
  nastiness of Java, in particular it doesn't integrate at all into the
  OS; the makes it not a good fit for little scripting, one-off jobs which
  form the basis of a lot of scientific computing.
 
 
  aaa yes indeed...the jvm is indeed very heavy-weight for such scripting
  tasks...on the other hand have you looked at clojure-py? I'm not
 up-to-date
  with its current state/features but it should be viable for little
 scripting
  jobs... :)


 Well, I an proficient in python, so it's probably easier just to use
 python. Even if the documentation sucks.


  Which gives me the dynamic scoped behaviour, but not the global
  resetting behaviour.
  I quickly wrote the following but I get an exception which I
  don't have the time to sort at the moment...maybe later this evening...
 :)


 It's okay! I have a workable solution now, even if it still seems a
 little unfair that I cannot take the same approach that clojure.core
 does under the same circumstances!

 Phil

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Why are errors in nested futures suppressed?

2013-05-21 Thread atkaaz
= (future (swap! atom inc 0))
#core$future_call$reify__6267@38db2b7e: :pending

= @(future (swap! atom inc 0))
ClassCastException clojure.core$atom cannot be cast to clojure.lang.Atom
clojure.core/swap! (core.clj:2161)


(both in ccw, but i notice that the first statement does throw in lein repl)

guessing the error is actually thrown in that thread, but nobody can see it
unless they are trying to deref it in current thread or something else
along those lines



On Tue, May 21, 2013 at 1:01 PM, Colin Yates colin.ya...@gmail.com wrote:

 Hi all,

 If the function executed in a future throws an error it is printed out in
 the repl immediately.  If that function is executed in a future which
 itself is executed in a future then it isn't.

 For example, imagine somebody wrote the following code (please, suspend
 belief and just accept people do do this when learning Clojure :)):

 [code]
 ;; some silly code
 user (swap! atom inc 0)
 ClassCastException clojure.core$atom cannot be cast to clojure.lang.Atom
  clojure.core/swap! (core.clj:2161)
 ;; silly code wrapped in a future
 user (future (swap! atom inc 0))
 ClassCastException clojure.core$atom cannot be cast to clojure.lang.Atom
  clojure.core/swap! (core.clj:2161)
 ;; silly code wrapped in a future wrapped in a future
 user (future (future (swap! atom inc 0)))
 #core$future_call$reify__6267@11e55d39: :pending
 user
 [/code]

 My understanding is that future executes its delegate in a separate
 thread, hence the (future (swa...)) code prints out the exception almost
 immediately.  I don't understand why the nested future doesn't print out
 the error though as it should surely be executed almost immediately as well?

 Of course, if you dereference the call then it prints out the stack trace.

 As to why you would want a future in a future...that is a different kettle
 of fish :).

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




wouldn't this be an interesting clojure code editor?

2013-05-20 Thread atkaaz
Hi guys. I just stumbled upon something [1] and the editor is quite similar
to what I was hoping/focusing on having(these days) for editing/writing
(not just) clojure code.
 What are your thoughts on this? (just don't think too much of it in that
is for java and ignore the 3D thing)

To see what I mean, please see the second video on that [1] page (it's 12
minutes), or if you don't have flash and can get the .wmv file from [2]

[1] http://www.alice.org/index.php?page=what_is_alice/what_is_alice
[2] http://www.alice.org/what_is_alice/AliceDemonstrationVideo.wmv

to note the different colors for forms within a form (ie. at minute 8:57 in
the video)
I especially wanted something very similar in ccw so it would be obvious
where each form begins (which is currently being done with colored parens i
think)

-- 
-- 
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/groups/opt_out.




unlicensed clojure code/jar/uberjar ?

2013-05-18 Thread atkaaz
Hi. Can I release my clojure code under unlicensed?
http://unlicense.org/

Maybe the code and the jar can be, right? But how about the uberjar which
includes clojure itself which is under EPL?(for example I cannot dist the
uberjar under GPL) Is my code being unlicensed like that work ok with
clojure's EPL? Or does EPL prevent this? so in effect then I cannot
distribute the uberjar, but can the jar or just my code
(by jar I mean *lein jar*)
(by uberjar I mean *lein uberjar*)



I'm reproducing the unlicensed text here for those who cannot(or don't
want) to visit that website:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

-- 
-- 
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/groups/opt_out.




Re: unlicensed clojure code/jar/uberjar ?

2013-05-18 Thread atkaaz
On Sat, May 18, 2013 at 4:48 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:

 2013/5/18 atkaaz atk...@gmail.com

 Hi. Can I release my clojure code under unlicensed?
 http://unlicense.org/


 You can but it's not a very good idea. Not all countries have the notion
 of public domain.


Could you elaborate on this:

 It is extremely unlikely that folks in large companies will be able to use
 code released
 under such an exotic license.




  I'd recommend Eclipse Public License or Apache Public License 2 if you
 care about
 your project adoption in circles other than hobbyists and free software
 radicals.

 Take a look at
 http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
 ,
 it has some thoughts about licensing.
 --
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: unlicensed clojure code/jar/uberjar ?

2013-05-18 Thread atkaaz
I see what you mean about public domain  here for example:
http://www.mingw.org/license
*MinGW Runtime:* All releases of the MinGW base runtime package, prior to
release 4.0, have been placed in the public domain, and are not governed by
copyright. This basically means that you can do what you like with the code.

Due to inadmissibility of the public domain concept, in certain
jurisdictions, we have now chosen to adopt a MIT style license for the
principal components of the MinGW runtime, from release 4.0 onwards; you
may view this LICENSE, as it is filed in the source code
repositoryhttps://sourceforge.net/p/mingw/mingw-org-wsl/ci/21762bb4a1bd0c88c38eead03f59e8d994349e83/tree/LICENSE
.



On Sat, May 18, 2013 at 4:48 PM, Michael Klishin 
michael.s.klis...@gmail.com wrote:

 2013/5/18 atkaaz atk...@gmail.com

 Hi. Can I release my clojure code under unlicensed?
 http://unlicense.org/


 You can but it's not a very good idea. Not all countries have the notion
 of public domain.
 It is extremely unlikely that folks in large companies will be able to use
 code released
 under such an exotic license.

  I'd recommend Eclipse Public License or Apache Public License 2 if you
 care about
 your project adoption in circles other than hobbyists and free software
 radicals.

 Take a look at
 http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
 ,
 it has some thoughts about licensing.
 --
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: asm-based clojure yet?

2013-05-18 Thread atkaaz
your comment caused me to be reading this http://prog21.dadgum.com/134.html
  (at least)


On Sat, May 18, 2013 at 6:17 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 Immutability, persistence, closures without a serious garbage collector
 sounds hard.


 On Sat, May 18, 2013 at 1:09 AM, atkaaz atk...@gmail.com wrote:

 Thanks very much everyone! I'm looking into all of those, but currently
 planning to read Julian's pdf. I didn't want to say anything until I had
 something definite, but just letting y'all know that I'm considering each
 recommendation.


 On Sat, May 18, 2013 at 7:12 AM, Julian juliangam...@gmail.com wrote:

 If you had a hobbyist interest in representing S-expressions in
 assembler - then you could take a look at the tutorial written by Abdulaziz
 Ghuloum called Compilers: Backend to Frontend and Back to Front Again. It
 used to be available here:
 http://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-09-16.pdf

 I don't know if it available anywhere else on the internet - but I
 grabbed another copy and put it here:
 https://sites.google.com/site/juliangamble/Home/Compilers%20Tutorial%202006-09-16.pdf?attredirects=0d=1

 For a more serious representation of Clojure's persistent data
 structures, I don't recommend trying to implement them in ASM.

 Cheers
 Julian


 On Friday, 17 May 2013 22:06:45 UTC+10, Alan D. Salewski wrote:

 On Fri, May 17, 2013 at 02:10:02PM +0300, atkaaz spake thus:
  Ok, weird question: is there some clojure port on assembler yet? Even
  if(/especially if) it doesn't have jvm/java/javalibs support
 
  Or should I just check 
  https://github.com/clojure/**clojure-clrhttps://github.com/clojure/clojure-clr?
 
  I'm mainly interested in low memory footprint and fast startup times
 (does
  clojure-clr have that?)

 You may want to check out ClojureScript, too. ClojureScript programs
 leveraging nodejs for host interop have fast startup times:

 
 https://github.com/clojure/**clojurescript/wikihttps://github.com/clojure/clojurescript/wiki

 --
 --**--**-
 a l a n   d.   s a l e w s k i   sale...@att.net
 1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588
 --**--**-

  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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

asm-based clojure yet?

2013-05-17 Thread atkaaz
Ok, weird question: is there some clojure port on assembler yet? Even
if(/especially if) it doesn't have jvm/java/javalibs support

Or should I just check https://github.com/clojure/clojure-clr ?

I'm mainly interested in low memory footprint and fast startup times (does
clojure-clr have that?)

-- 
-- 
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/groups/opt_out.




Re: asm-based clojure yet?

2013-05-17 Thread atkaaz
Thanks very much everyone! I'm looking into all of those, but currently
planning to read Julian's pdf. I didn't want to say anything until I had
something definite, but just letting y'all know that I'm considering each
recommendation.


On Sat, May 18, 2013 at 7:12 AM, Julian juliangam...@gmail.com wrote:

 If you had a hobbyist interest in representing S-expressions in assembler
 - then you could take a look at the tutorial written by Abdulaziz Ghuloum
 called Compilers: Backend to Frontend and Back to Front Again. It used to
 be available here:
 http://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-09-16.pdf

 I don't know if it available anywhere else on the internet - but I grabbed
 another copy and put it here:
 https://sites.google.com/site/juliangamble/Home/Compilers%20Tutorial%202006-09-16.pdf?attredirects=0d=1

 For a more serious representation of Clojure's persistent data structures,
 I don't recommend trying to implement them in ASM.

 Cheers
 Julian


 On Friday, 17 May 2013 22:06:45 UTC+10, Alan D. Salewski wrote:

 On Fri, May 17, 2013 at 02:10:02PM +0300, atkaaz spake thus:
  Ok, weird question: is there some clojure port on assembler yet? Even
  if(/especially if) it doesn't have jvm/java/javalibs support
 
  Or should I just check 
  https://github.com/clojure/**clojure-clrhttps://github.com/clojure/clojure-clr?
 
  I'm mainly interested in low memory footprint and fast startup times
 (does
  clojure-clr have that?)

 You may want to check out ClojureScript, too. ClojureScript programs
 leveraging nodejs for host interop have fast startup times:

 
 https://github.com/clojure/**clojurescript/wikihttps://github.com/clojure/clojurescript/wiki

 --
 --**--**-
 a l a n   d.   s a l e w s k i   sale...@att.net
 1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588
 --**--**-

  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Getting highlighted clojure code into a presentation

2013-05-17 Thread atkaaz
I feel silly for even suggesting but is pprint not good enough? do you need
colors? (unaware of what those do in emacs)


On Sat, May 18, 2013 at 6:42 AM, Korny Sietsma ko...@sietsma.com wrote:

 Hi folks - I had to prepare some slides for a conference, and I struggled
 to get nice looking clojure code onto a slide.  I eventually arrived at the
 following, but it's awfully clunky:

 * write code in emacs
 * turn off rainbow delimiters as html-fontify doesn't like them
 * M-x load-theme whiteboard  (for high contrast)
 * M-x htmlfontify-buffer (and save)
 * M-x browse-url-of-file (loads in Chrome)
 * load same url in Safari as for some reason cut-and-paste from Chrome to
 Powerpoint is broken
 * copy code from Chrome
 * paste-special into PowerPoint, as styled text

 Yes, I know I can just take a screenshot, but that gives you a bitmap that
 doesn't scale nicely or give you any ability to do last minute editing.
  But the above gets tedious very fast - I wonder if there's a better option
 I've missed?

 - Korny

 --
 Kornelis Sietsma  korny at my surname dot com http://korny.info
 .fnord { display: none !important; }

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Strange exception intializing clojure.core using Spring-Hadoop

2013-05-17 Thread atkaaz
I've some idea, but it may not be right; I'm thinking that clojure needs
its own classloader and if that spring thing overriden it somehow, it's not
going to work initing clojure, just like in minecraft bukkit server with
clojure-based plugins, ie. https://github.com/CmdrDats/clj-minecraft/
 I'm thinking maybe you need to do something similar with temporarily
restoring clojure's classloader when clojure inits or something like that
(I don't remember) but you may look at the code in clj-minecraft like here:
https://github.com/CmdrDats/clj-minecraft/blob/master/javasrc/cljminecraft/BasePlugin.java#L56

What clojure version were you using when the above stacktrace happened?



On Fri, May 17, 2013 at 7:38 PM, Dave Kincaid kincaid.d...@gmail.comwrote:

 A quick update on a little more progress troubleshooting this issue. We
 have gotten to the point where we are seeing this stacktrace:

 java.lang.IllegalStateException: Attempting to call unbound fn:
 #'clojure.core/refer
 at clojure.lang.Var$Unbound.throwArity(Var.java:43)
 at clojure.lang.AFn.invoke(AFn.java:39)
 at clojure.lang.Var.invoke(Var.java:415)
 at clojure.lang.RT.doInit(RT.java:460)
 at clojure.lang.RT.clinit(RT.java:329)

 does that give anyone an idea?

 On Thursday, May 16, 2013 7:53:27 PM UTC-5, Dave Kincaid wrote:

 I'm posting this here in hopes that someone might be able to steer us in
 the right direction. We have a Cascalog process that we're using
 Spring-Hadoop  Spring-Batch to send to a remote Hadoop cluster. It seems
 as though Spring-Hadoop is doing something funky with the
 classpath/classloader and we're getting the following exception when we run
 it:

 java.lang.**ExceptionInInitializerError
 at clojure.core__init.__init0(**Unknown Source)
 at clojure.core__init.clinit(**Unknown Source)
 at java.lang.Class.forName0(**Native Method)
 at java.lang.Class.forName(Class.**java:266)
 at clojure.lang.RT.**loadClassForName(RT.java:2098)
 at clojure.lang.RT.load(RT.java:**430)
 at clojure.lang.RT.load(RT.java:**411)
 at clojure.lang.RT.doInit(RT.**java:447)
 at clojure.lang.RT.clinit(RT.**java:329)
 at cascalog.Util.clinit(Util.**java:29)
 at jcascalog.Api.**setApplicationConf(Api.java:**99)
 at com.test.DataShredder.run(**DataShredder.java:113)

 in trying to trace it we think that this is happening while
 clojure.lang.RT is scanning all the classes on the classpath. It seems to
 get to one class called StepExecution.class, which is part of the Spring
 Framework, and it throws this exception. We've got this posted over on the
 Spring forums too, since it's most likely something with Spring's
 manipulation of classpath and/or classloader while it's trying to get the
 MR jobs over to Hadoop.

 If anyone has another idea, we'd love to hear it. We're kind of stuck
 right now and been working on it for a few days.

 Thanks,

 DAve

  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Strange exception intializing clojure.core using Spring-Hadoop

2013-05-17 Thread atkaaz
looks like it didn't properly load clojure.core (possibly due to that
classloader being wrong?) but I am not sure why it didn't fail sooner
than on the line with refer

static void doInit() throws ClassNotFoundException, IOException{
load(clojure/core); //this wasn't loaded ok?!

Var.pushThreadBindings(
RT.mapUniqueKeys(CURRENT_NS, CURRENT_NS.deref(),
   WARN_ON_REFLECTION, WARN_ON_REFLECTION.deref()
,RT.UNCHECKED_MATH, RT.UNCHECKED_MATH.deref()));
try {
Symbol USER = Symbol.intern(user);
Symbol CLOJURE = Symbol.intern(clojure.core);

Var in_ns = var(clojure.core, in-ns);
Var refer = var(clojure.core, refer);
in_ns.invoke(USER); //wonder why it didn't fail here
refer.invoke(CLOJURE); //fails here
maybeLoadResourceScript(user.clj);
}
finally {
Var.popThreadBindings();
}
}


On Fri, May 17, 2013 at 7:38 PM, Dave Kincaid kincaid.d...@gmail.comwrote:

 A quick update on a little more progress troubleshooting this issue. We
 have gotten to the point where we are seeing this stacktrace:

 java.lang.IllegalStateException: Attempting to call unbound fn:
 #'clojure.core/refer
 at clojure.lang.Var$Unbound.throwArity(Var.java:43)
 at clojure.lang.AFn.invoke(AFn.java:39)
 at clojure.lang.Var.invoke(Var.java:415)
 at clojure.lang.RT.doInit(RT.java:460)
 at clojure.lang.RT.clinit(RT.java:329)

 does that give anyone an idea?

 On Thursday, May 16, 2013 7:53:27 PM UTC-5, Dave Kincaid wrote:

 I'm posting this here in hopes that someone might be able to steer us in
 the right direction. We have a Cascalog process that we're using
 Spring-Hadoop  Spring-Batch to send to a remote Hadoop cluster. It seems
 as though Spring-Hadoop is doing something funky with the
 classpath/classloader and we're getting the following exception when we run
 it:

 java.lang.**ExceptionInInitializerError
 at clojure.core__init.__init0(**Unknown Source)
 at clojure.core__init.clinit(**Unknown Source)
 at java.lang.Class.forName0(**Native Method)
 at java.lang.Class.forName(Class.**java:266)
 at clojure.lang.RT.**loadClassForName(RT.java:2098)
 at clojure.lang.RT.load(RT.java:**430)
 at clojure.lang.RT.load(RT.java:**411)
 at clojure.lang.RT.doInit(RT.**java:447)
 at clojure.lang.RT.clinit(RT.**java:329)
 at cascalog.Util.clinit(Util.**java:29)
 at jcascalog.Api.**setApplicationConf(Api.java:**99)
 at com.test.DataShredder.run(**DataShredder.java:113)

 in trying to trace it we think that this is happening while
 clojure.lang.RT is scanning all the classes on the classpath. It seems to
 get to one class called StepExecution.class, which is part of the Spring
 Framework, and it throws this exception. We've got this posted over on the
 Spring forums too, since it's most likely something with Spring's
 manipulation of classpath and/or classloader while it's trying to get the
 MR jobs over to Hadoop.

 If anyone has another idea, we'd love to hear it. We're kind of stuck
 right now and been working on it for a few days.

 Thanks,

 DAve

  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: confused on set!

2013-05-16 Thread AtKaaZ
why not ref and dosync?



On Thu, May 16, 2013 at 2:45 PM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:

 Jim jimpil1...@gmail.com writes:

  On 16/05/13 11:33, Phillip Lord wrote:
  And if it is okay to use set!
  on*warn-on-reflection*, why is it not okay to allow me, as the library
  developer, to define similar properties for my library which work in a
  similar way.
 
  well, nothing stops you from providing bindings at the main entry point
 of
  your library, much in the same way that Clojure does...then consumers
 can use
  set! as you expect. That said, I wouldn't go down that road simply
 because it
  gives that 'global-state' smell...


 I don't have a main entry point. And, yes, I want global-state for
 exactly the same reason that Clojure does. I have a process that
 produces logging output, and I want the user to be able to define
 where that output goes. Basically, the same as doing:

 (set! *out* some-sensible-value)

 but different because I also want to be able to choose between a
 GUI output, and text.

 So, I guess, my two options are:


 (def
   ^{:dynamic true}
   *can-we-change-it* (atom John))

 (println @*can-we-change-it*)

 (reset! *can-we-change-it* Paul)

 (println @*can-we-change-it*)

 (binding [*can-we-change-it*
   (atom George)]
   (println @*can-we-change-it*))


 (println @*can-we-change-it*)



 (def
   ^{:dynamic true}
   *can-we-change-this-one* Mick)

 (println *can-we-change-this-one*)

 (alter-var-root #'*can-we-change-this-one*
 (fn [x] Keith))

 (println *can-we-change-this-one*)

 (binding [*can-we-change-this-one*
   Bill]
   (println *can-we-change-this-one*))

 (println *can-we-change-this-one*)



 Of which, I think, the former is the best option, although it's going to
 break my existing code which uses binding forms.

 Phil

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: confused on set!

2013-05-16 Thread AtKaaZ
you're right, I somehow didn't read what he was using it for, just looked
at the examples he gave and assumed generic var

In a way I'm in his shoes, but I always assumed that the user would use
binding even if that meant encompassing the whole program in it. Like if
you wanted to disable asserts  ok bad example since set! works for this
too, but I have something like that and I was ok with the idea that the
user would use binding around the whole code to set that.
 Maybe I should consider other alternatives... but now I can't think:)


On Thu, May 16, 2013 at 3:01 PM, Jim jimpil1...@gmail.com wrote:

 On 16/05/13 12:52, AtKaaZ wrote:

 why not ref and dosync?


 a bit heavyweight isn't it?

 A bit off topic but I remember when Clojure came out, STM was the big
 selling point! I've been programming Clojure for more than 3 years now and
 I've yet to write code that uses STM but that wasn't intentional...I just
 did not need to (slightly ironic I find)... :)

 dynamic scope is another story though...I very much intentionally stayed
 away from it!

 Jim


 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
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/groups/opt_out.




Re: [ANN] getclojure.org

2013-05-16 Thread atkaaz
Hi!
http://getclojure.org/search?q=fixturenum=0
is it supposed to show the \n inline? it's a bit uncomfy to have to read
those on one line


On Fri, May 17, 2013 at 4:12 AM, Devin Walters dev...@gmail.com wrote:

  Hey All,

 I put this ( http://getclojure.org ) together and wanted to share it with
 all of you. It's a nifty way to search for example usage of clojure. It's
 far less curated than ClojureDocs, so you may pick up some interesting
 ideas by simply browsing.

 It supports boolean queries like: comp AND juxt and will let you search
 for - (but you must quote it).

 If you're interested in contributing: https://github.com/devn/getclojure is
 the place to do it.

 Thanks,
 --
 {:∂evin :√valters}

  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] getclojure.org

2013-05-16 Thread atkaaz
Ok fair enough. I was wondering however how hard would it be to add a
button maybe? or a var to the url? (or a button which adds the var to the
url - not sure how these are called) which would switch between the
default(as it is now) and the pretty printed output (for all the results
not just one of them)


On Fri, May 17, 2013 at 4:28 AM, Devin Walters dev...@gmail.com wrote:

  At the moment, yes. The docstrings are not pretty, but in the end I
 decided that seeing the literal \n was better than pretty printing captured
 output.

 That being said, I'm not strongly opposed to changing it (patches
 welcome), but right now I think not pretty printing output is good in the
 80-90% case.

 Cheers,
 --
 {:∂evin :√valters}

 On Thursday, May 16, 2013 at 8:18 PM, atkaaz wrote:

 Hi!
 http://getclojure.org/search?q=fixturenum=0
 is it supposed to show the \n inline? it's a bit uncomfy to have to read
 those on one line


 On Fri, May 17, 2013 at 4:12 AM, Devin Walters dev...@gmail.com wrote:

  Hey All,

 I put this ( http://getclojure.org ) together and wanted to share it with
 all of you. It's a nifty way to search for example usage of clojure. It's
 far less curated than ClojureDocs, so you may pick up some interesting
 ideas by simply browsing.

 It supports boolean queries like: comp AND juxt and will let you search
 for - (but you must quote it).

 If you're interested in contributing: https://github.com/devn/getclojure is
 the place to do it.

 Thanks,
 --
 {:∂evin :√valters}

  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] getclojure.org

2013-05-16 Thread atkaaz
like http://getclojure.org/search?q=-\%3E\%3Enum=0


On Fri, May 17, 2013 at 6:36 AM, Ramesh ramesh10dul...@gmail.com wrote:

 Looks like - is not supported. I quoted it!

 http://getclojure.org/search?q=%22-%3E%22num=0

 -ramesh


 On Thu, May 16, 2013 at 6:12 PM, Devin Walters dev...@gmail.com wrote:

  Hey All,

 I put this ( http://getclojure.org ) together and wanted to share it
 with all of you. It's a nifty way to search for example usage of clojure.
 It's far less curated than ClojureDocs, so you may pick up some interesting
 ideas by simply browsing.

 It supports boolean queries like: comp AND juxt and will let you search
 for - (but you must quote it).

 If you're interested in contributing: https://github.com/devn/getclojure is
 the place to do it.

 Thanks,
 --
 {:∂evin :√valters}

  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] getclojure.org

2013-05-16 Thread atkaaz
nevermind :) it acts the same as - even when -\\
so I don't know what I was talking about :D


On Fri, May 17, 2013 at 6:37 AM, atkaaz atk...@gmail.com wrote:

 like 
 http://getclojure.org/search?q=-\%3E\%3Enum=0http://getclojure.org/search?q=-%5C%3E%5C%3Enum=0


 On Fri, May 17, 2013 at 6:36 AM, Ramesh ramesh10dul...@gmail.com wrote:

 Looks like - is not supported. I quoted it!

 http://getclojure.org/search?q=%22-%3E%22num=0

 -ramesh


 On Thu, May 16, 2013 at 6:12 PM, Devin Walters dev...@gmail.com wrote:

  Hey All,

 I put this ( http://getclojure.org ) together and wanted to share it
 with all of you. It's a nifty way to search for example usage of clojure.
 It's far less curated than ClojureDocs, so you may pick up some interesting
 ideas by simply browsing.

 It supports boolean queries like: comp AND juxt and will let you
 search for - (but you must quote it).

 If you're interested in contributing: https://github.com/devn/getclojure is
 the place to do it.

 Thanks,
 --
 {:∂evin :√valters}

  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.






-- 
-- 
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/groups/opt_out.




Re: confused on set!

2013-05-15 Thread AtKaaZ
I think the answer is in RT 's doInit
Var.pushThreadBindings(
RT.mapUniqueKeys(CURRENT_NS, CURRENT_NS.deref(),
   WARN_ON_REFLECTION, WARN_ON_REFLECTION.deref()
,RT.UNCHECKED_MATH, RT.UNCHECKED_MATH.deref()));

it basically does a
(binding [*warn-on-reflection* currentvaluehere])
where currentvaluehere is false

so it's like:
(binding [*my-test1* *my-test1*]
  (set! *my-test1* true))

basically set! works because you're not seeing the root binding, you're
inside a binding already, at least that's what I'm getting out of it.

Which leads you to the following:
user= (.start (Thread. (fn [] (do (set! *warn-on-reflection* true)
(println inthread)
Exception in thread Thread-12 java.lang.IllegalStateException: Can't
change/establish root binding
 of: *warn-on-reflection* with set
at clojure.lang.Var.set(Var.java:233)
at user$eval1176$fn__1177.invoke(NO_SOURCE_FILE:1)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:722)
nil




On Wed, May 15, 2013 at 7:23 PM, Phillip Lord
phillip.l...@newcastle.ac.ukwrote:


 I'm still a bit confused on the use of set!

 I would like to define a configuration variable that is easy to change,
 but which is not critical to my infrastructure; it's will set some
 default behaviours.

 Now, I can do things like

 (binding [*warn-on-reflection* true]
   (do-some-function))

 and it does the right thing. Similarly, I can do

 (def ^{:dynamic true} *my-test* false)
 (binding [*my-test* true]
  (do-some-function))

 and this all works.

 However, while I can do

 (set! *warn-on-reflection* true)

 I cannot do

 (set! *my-test* true)

 because I cannot change the root binding. What I confused about is how
 does this work with *warn-on-reflection*? Where is the root binding? And
 how come I am not trying to set it also? Can I get similar behaviour for
 one of my vars? Or do I need to do something like:

 (def *my-test* (atom true))
 (reset! *my-test false)

 but then I loose my dynamic binding?

 Phil

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




unusual question: how do you get morale?(or moral support)

2013-05-12 Thread AtKaaZ
Hi. I've been meaning to ask (all of)you, how do you get moral support? How
do you put yourself into that mood so that you're happy/willing to program?
What motivates you to do it? Is it the people you surround yourself with or
the financial support? Are they enough to subconsciously motivate you? What
if you had no friends/contacts but you had time?

 Unusual question for this ML, I know, so I won't expect (m)any answers.
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
--- 
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/groups/opt_out.




Re: unusual question: how do you get morale?(or moral support)

2013-05-12 Thread AtKaaZ
Hey, thanks for sharing.

 I think I am the opposite of that, I am unable to code just for myself, if
no one else is directly (and immediately) impacted by what I do then I get
bored fast (but this is probably coupled with the fact that I am unable to
code the way I want yet like some editor where everything is based on a
graph so ie. connected, explorable). If I am doing something for someone
(other than just myself) then I'm all fired up and motivated although any
kind of inconsistency/bugs/barriers or the need to compromise around them
because of the system limitations are having a negative impact on my
morale.
 This is likely still be ego related, but knowing that I am not the only
one that I program for, boosts my morale. In a way this is always true that
you program for others as much as for yourself but it's not directly
obvious, for example all the improvements that you get from
practicing/programming will help you and others in the future, it's for the
best of all(and I consciously know that), but my subconscious seems to want
something more immediate like knowing that are others (in the now) actively
waiting on me and wanting me to code the stuff (ego xD). I find this
morale boosting. But just doing it for myself, I couldn't do it, even if I
would know that sometime in the future some people would appreciate that I
did that.
 I would guess that a good programmer(not me) knows how to program his
subconscious (which is not unlike what you did Mosciatti) so that morale is
never a problem. Either make the environmental conditions match the
expected ones (ie. surround yourself with friends that appreciate what u're
doing) or reprogram your subconscious (ie. so you don't need the friends
that appreciate you, you appreciating yourself would be enough).
  Sometimes I am able to trick myself into believing that sometime in the
future some people would benefit from what I coded (either from the code
itself[less likely though xD] or from what the resulting program does) and
this works for a while but it's still based on the fact that I code for
others or in other words, my ego boosts morale when I know that I've done
something for others (as opposed to just myself).

ok writing too much text, stopping



On Sun, May 12, 2013 at 10:52 PM, Simone Mosciatti mweb@gmail.comwrote:

 I code only for myself, and honestly coding is what I like to do.

 I remember these days being in a very bad mood and all I wanted to do was
 to sit and code.

 I believe that what motivate myself is my own EGO, code for me is only
 about solving problem, and more problem I solve better my ego is.

 Anyway I am still a student and I don't have (m)any [I like that XP]
 financial issues.

 I am weird, but friends usually don't help me when I have an hard time,
 neither does my family (no that they wouldn't like to help me, they try
 most of the time but they simply don't work), time helps.
 For problems that I can not solve because they are not ups to me, I just
 don't think about, so I keep myself as busy as possible, until I don't feel
 great again.
 For problems that I can solve, well those are just other forms of coding,
 so I just fix that for my ego.

 :-)

 Someone else want to share ?


 On Sunday, May 12, 2013 9:34:22 PM UTC+2, atkaaz wrote:

 Hi. I've been meaning to ask (all of)you, how do you get moral support?
 How do you put yourself into that mood so that you're happy/willing to
 program? What motivates you to do it? Is it the people you surround
 yourself with or the financial support? Are they enough to subconsciously
 motivate you? What if you had no friends/contacts but you had time?

  Unusual question for this ML, I know, so I won't expect (m)any answers.
 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
 ---
 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/groups/opt_out.




-- 
-- 
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

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread AtKaaZ
I agree


On Sat, May 11, 2013 at 10:25 PM, Alex Baranosky 
alexander.barano...@gmail.com wrote:

 Most of the code I see and write at work at Runa uses (not (empty? foo)).
  I'll continue to defend the position that it is more obvious code, and
 therefore better (imo :) )

 Alex


 On Sat, May 11, 2013 at 12:22 PM, Karsten Schmidt i...@toxi.co.uk wrote:

   What's the idiom in (seq coll)?

 Maybe one could say that, generally, in Clojure it's more meaningful
 to work with truthy values instead of the boolean true... ?

 --
 --
 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/groups/opt_out.



  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: A JMonkeyEngine3 wrapper?

2013-05-10 Thread AtKaaZ
Robert, do you have all that in a project somewhere on github? I really
enjoy all the explanations


On Fri, May 3, 2013 at 7:19 PM, Robert Louis McIntyre r...@mit.edu wrote:

 I've written some JME3 wrapper code for my thesis project -- it's not
 ready for prime time, but it's got some nice ideas.

 The design goal is to try and make my thesis code concise instead of
 being a general purpose library, but one idea I like it to build a
 world out of clojure functions that do the updating, etc.

 relevant pages for this project (with code) include:

 http://aurellem.org/cortex/html/world.html
 http://aurellem.org/cortex/html/util.html

 and some more at http://aurellem.org

 This is for a slightly older version of JME3, but things should mostly
 still work for the latest version.

 sincerely,
 --Robert McIntyre

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: why clojure.lang.Compiler.LOADER is null in clojure 1.5.1

2013-05-09 Thread AtKaaZ
Caused by: java.lang.NullPointerException
at clojure.lang.RT.*baseLoader*(RT.java:2043)

hmm, it's almost as if:
static final public Var LOADER = Var.create().setDynamic();
had no effect as in: LOADER=null;



On Thu, May 9, 2013 at 4:51 PM, semperos daniel.l.grego...@gmail.comwrote:

 Is there a reason you don't use one of the methods exposed in
 clojure.lang.RT, e.g., makeClassLoader() or baseLoader() ?


 On Thursday, May 9, 2013 2:00:54 AM UTC-4, Stream wrote:

 Hi all

 i wanna change the classloader of Clojure RT. in 1.5.1
 so , i try to
 clojure.lang.Var.**pushThreadBindings(clojure.**lang.RT.map(
 clojure.lang.Compiler.LOADER, cl) );

 but throws exception that cojure.lang.Compiler.LOADER is null

 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.**java:2043)
 at clojure.lang.RT.load(RT.java:**417)
 at clojure.lang.RT.load(RT.java:**411)
 at clojure.lang.RT.doInit(RT.**java:447)
 at clojure.lang.RT.clinit(RT.**java:329)
 ... 9 more


 However this is work in the 1.4.0

 someone could tell me what had happened in 1.5.1
 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
 ---
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: why clojure.lang.Compiler.LOADER is null in clojure 1.5.1

2013-05-09 Thread AtKaaZ
is there any chance that we can see the full code (maybe's on github
already?)


On Thu, May 9, 2013 at 9:00 AM, stream stream1...@gmail.com wrote:

 Hi all

 i wanna change the classloader of Clojure RT. in 1.5.1
 so , i try to
 clojure.lang.Var.pushThreadBindings(clojure.lang.RT.map(
 clojure.lang.Compiler.LOADER, cl) );

 but throws exception that cojure.lang.Compiler.LOADER is null

 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.java:2043)
 at clojure.lang.RT.load(RT.java:417)
 at clojure.lang.RT.load(RT.java:411)
 at clojure.lang.RT.doInit(RT.java:447)
 at clojure.lang.RT.clinit(RT.java:329)
 ... 9 more


 However this is work in the 1.4.0

 someone could tell me what had happened in 1.5.1
 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
 ---
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: why clojure.lang.Compiler.LOADER is null in clojure 1.5.1

2013-05-09 Thread AtKaaZ
is not this one is it ?
https://github.com/CmdrDats/clj-minecraft/blob/master/javasrc/cljminecraft/BasePlugin.java#L82


On Thu, May 9, 2013 at 7:12 PM, AtKaaZ atk...@gmail.com wrote:

 is there any chance that we can see the full code (maybe's on github
 already?)


 On Thu, May 9, 2013 at 9:00 AM, stream stream1...@gmail.com wrote:

 Hi all

 i wanna change the classloader of Clojure RT. in 1.5.1
 so , i try to
 clojure.lang.Var.pushThreadBindings(clojure.lang.RT.map(
 clojure.lang.Compiler.LOADER, cl) );

 but throws exception that cojure.lang.Compiler.LOADER is null

 Caused by: java.lang.NullPointerException
 at clojure.lang.RT.baseLoader(RT.java:2043)
 at clojure.lang.RT.load(RT.java:417)
 at clojure.lang.RT.load(RT.java:411)
 at clojure.lang.RT.doInit(RT.java:447)
 at clojure.lang.RT.clinit(RT.java:329)
 ... 9 more


 However this is work in the 1.4.0

 someone could tell me what had happened in 1.5.1
 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
 ---
 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/groups/opt_out.





-- 
-- 
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/groups/opt_out.




Re: I tripped out

2013-05-07 Thread AtKaaZ
yes, thank you, that is what I was referring to + the :or and :as like:
(defn somefn
  [req1 req2 ;required params
{
  :keys [a b c d e] ;optional params
  :or {a 1 ;optional params with preset default values other than the
nil default
   ; b takes nil if not specified on call
   c 3 ; c is 3 when not specified on call
   d 0 ; d is 0 --//--
   ; e takes nil if not specified on call
   }
  :as mapOfParamsSpecifiedOnCall
  }]
  (println req1 req2 mapOfParamsSpecifiedOnCall a b c d e)
  )
;= (somefn 9 10 :b 2 :d 4)
;9 10 {:b 2, :d 4} 1 2 3 4 nil
;nil

this may be good for most people, but not for me. I've tried implementing
something for me but I have it only half way done (and I haven't looked at
in in a few months) it's here [1] but u won't like how it looks xD

meanwhile I realized what OP was saying with destructuring the arg vector.

[1]
https://github.com/DeMLinkS/demlinks/blob/7064df0491ea2b565f6edf18708a599af8b37a33/src/util/funxions.clj


On Tue, May 7, 2013 at 9:58 AM, Pierre-Yves Ritschard p...@spootnik.orgwrote:

 atkaaz, you can do this: (fn [ {:keys [arg1 arg2 arg3]}] ...)


 On Mon, May 6, 2013 at 10:03 PM, AtKaaZ atk...@gmail.com wrote:

 I agree, I'm not sure what he means xD
 If you ask me, I'd rather have each arg be identified by a keyword
 instead of by order
 like: (somefn :arg1 somestr :arg3 100 :arg2 (+ 1 2))
 or all those in a map
 I'll probably still do that for me, so that any function will take params
 like this. There's probably a way this can be done but it's not good enough
 for me, was it with :keys and :as map ?



 On Sun, May 5, 2013 at 10:52 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Tell us more about it.


 On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args
 for a function you're basically just destructuring an arg vector?  It
 trips me out.

  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: I tripped out

2013-05-06 Thread AtKaaZ
I agree, I'm not sure what he means xD
If you ask me, I'd rather have each arg be identified by a keyword instead
of by order
like: (somefn :arg1 somestr :arg3 100 :arg2 (+ 1 2))
or all those in a map
I'll probably still do that for me, so that any function will take params
like this. There's probably a way this can be done but it's not good enough
for me, was it with :keys and :as map ?



On Sun, May 5, 2013 at 10:52 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Tell us more about it.


 On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args for
 a function you're basically just destructuring an arg vector?  It trips
 me out.

  --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] bleach 0.0.11

2013-05-04 Thread AtKaaZ
could you post a sample code how it looks before and after?


On Thu, May 2, 2013 at 7:36 AM, David Lowe j.david.l...@gmail.com wrote:

 bleach: whitens unsightly code!

 When you bleach your code, it continues to work as before, only now it
 looks like:

 (use 'bleach.core) #bleach/ed 




 

 Find it here: https://github.com/dlowe/bleach

 Enjoy :)
 David Lowe

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] rhizome - simple graph and tree visualizations

2013-05-04 Thread AtKaaZ
this is awesome!


On Sat, May 4, 2013 at 1:39 AM, Zach Tellman ztell...@gmail.com wrote:

 I've had Graphviz integration in Lamina for a while [1], and have
 generally found it to be fun and useful.  To let everyone join in the fun,
 I've extracted that functionality into its own library, Rhizome [2].
  Feedback is welcome.

 Zach

 [1] https://github.com/ztellman/lamina/wiki/Channels
 [2] https://github.com/ztellman/rhizome

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: [ANN] bleach 0.0.11

2013-05-04 Thread AtKaaZ
got it, thanks Gary!


On Sat, May 4, 2013 at 9:26 PM, Gary Verhaegen gary.verhae...@gmail.comwrote:

 Without looking at more than the Readme on github, I guess it's kind
 of like a compiler to whitespace. You know, the whitespace programming
 language :
 http://en.wikipedia.org/wiki/Whitespace_(programming_language)

 like implemented as a user defined type with the #bleach/ed type.

 On 4 May 2013 19:51, AtKaaZ atk...@gmail.com wrote:
  could you post a sample code how it looks before and after?
 
 
  On Thu, May 2, 2013 at 7:36 AM, David Lowe j.david.l...@gmail.com
 wrote:
 
  bleach: whitens unsightly code!
 
  When you bleach your code, it continues to work as before, only now it
  looks like:
 
  (use 'bleach.core) #bleach/ed 
 
 
 
 
  
 
  Find it here: https://github.com/dlowe/bleach
 
  Enjoy :)
  David Lowe
 
  --
  --
  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/groups/opt_out.
 
 
 
 
  --
  --
  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/groups/opt_out.
 
 

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: testing for nil may not be enough

2013-04-30 Thread AtKaaZ
On Tue, Apr 30, 2013 at 11:00 AM, Tassilo Horn t...@gnu.org wrote:

 Gary Trakhman gary.trakh...@gmail.com writes:

  If you're passing the var itself, I don't see why you'd need a macro.
  If you want to check the namespace for a var matching an unquoted
  symbol, you could do that in a macro.

 In case you really don't have the var itself but just its value, then
 unbound is a value, too, and you could check for it using

   (instance? clojure.lang.Var$Unbound *x*)
   ;= true

 nice one, thanks!

I was thinking just in case any of these clojure.lang.Var$Unbound change
in the future, maybe I'd do something like this:

=* (def uniqsym (gensym))*
#'jme3test1.x1/uniqsym

= *uniqsym*
G__1603

=* (defmacro defus [] `(def ~uniqsym))*
#'jme3test1.x1/defus

= *(defus)*
#'jme3test1.x1/G__1603

= *(class (eval uniqsym))*
clojure.lang.Var$Unbound

= *(def unbound-class (class (eval uniqsym)))*
#'jme3test1.x1/unbound-class

=* unbound-class*
clojure.lang.Var$Unbound

= *(def ^:dynamic *x*)*
#'jme3test1.x1/*x*

=* (instance? unbound-class *x*)*
true

=* (binding [*x* 1]
 (instance? unbound-class *x*)
 )*
false

=* (def ^:dynamic *x* 2)*
#'jme3test1.x1/*x*
=* (binding [*x* 1]
 (instance? unbound-class *x*)
 )*
false


instead of

   (not (bound? #'*x*))

 Bye,
 Tassilo

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: testing for nil may not be enough

2013-04-30 Thread AtKaaZ
On Tue, Apr 30, 2013 at 10:51 AM, Tassilo Horn t...@gnu.org wrote:

 Jim - FooBar(); jimpil1...@gmail.com writes:

  funny you should mention that!!! that is exactly what I meant by 'my
  fault'...I've come to realise that dynamic scope is almost evil, thus
  I go to great lengths to avoid it completely...in the rare cases where
  I do use it I always make sure it is bound to a init/default value :)

 I do exactly the opposite when I use dynamic vars, that is, I define no
 default value.  For example, there's a function foo that uses a dynamic
 var, and that must be bound and well-defined.  Therefore, I provide a
 macro to initially set it up, so that you write

   (with-bar (foo bla))

 and with-bar takes care of the proper initialization of that dynamic var
 (which is not even visible to the user).  When foo explodes because of
 the var being Unbound, then it's obvious that the function was called
 outside a with-bar macro and thus is a user error.  A default value

the thing is, that it may not always explode if not used with with-bar,
depending on the implementation of the function, as if when used in an
(cond (nil? thevar) ... )  or (str thevar)
If you ask me, I'd allow the var to be unbound and code everywhere for
cases where the var could be unbound - which there should be many ie. any
function; so I can understand why people would want to take the
easy/workaround way and set a default value instead.

= (defn decorate [input]
 (str prefix: input :suffix)
 )
#'jme3test1.x1/decorate
= (def ^:dynamic *y*)
#'jme3test1.x1/*y*

assume I forget to use with-bar here:
= (decorate *y*)
prefix:Unbound: #'jme3test1.x1/*y*:suffix
didn't explode
or here:
= (defn do-smth-with [input]
 (when (not (nil? input))
   (str doing something with  input))
 )
#'jme3test1.x1/do-smth-with
= (do-smth-with *y*)
doing something with Unbound: #'jme3test1.x1/*y*

= (do-smth-with *x*)
doing something with 2
= (decorate *x*)
prefix:2:suffix
= (do-smth-with nil)
nil

I guess what I was trying to say all along is that it's too easy to fall
into this by mistake because maybe most don't check for unbound and it may
not explode

would shadow such an error.

 A real-world example of this design are many database query libs, where
 you frequently have code like

   (with-db-connection (make-me-a-db-connection url)
 (select :from foo :where ...))

 Bye,
 Tassilo

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
seems to be working fine for me, are you not starting the repl from the
project's folder ? tested with lein 2.2.0 from master


On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Just tried that! Very nice! Got it running with lein repl from Windows
 command prompt!!! However, when I fire up the repl from Eclipse CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James Reeves
 написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries: http://www.**jmonkeyengine.com/nightly/**
 jME3_2013-04-29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavejester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a game
 with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I take
 their latest nightie set of jars 
 (http://jmonkeyengine.com/**nightly/http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people get
 them in the lib folder and it works, or where they recommend pushing them
 to the local maven repo... but they do not tell how they do it, or they
 show it for some very simple cases. Sure, there is a lot of instructions
 like use mvn install:install-file a-lot-of-stuff-goes-here or lein
 localrepo install less-stuff-but-hey... so do I have to do it for all
 the 30 (thirty) jar files? Considering too, that I have to invent an
 artifactId for every one of them, invent a version number, type all
 that in manually. And that is not my library, I do not want to invent that.
 And even, if I do that, then, how do I specify that all them are
 interdependant (are parts of one thing) and have to be always drawn in
 together? I will have to specify the 30 dependencies in my project.clj each
 time? Well, and even if I do, then I will still have that pain with
 manually copying all that stuff on each new machine where I work, picking
 it from the local maven repo and putting it to another maven repo. And
 if I want to push it to Clojars, I have do that for each one manually too,
 typing in commands in the Windows cmd and taking care for inventing version
 numbers?... oh, and maybe I could go about specifying dependency clauses
 in a pom? pinch me am I dreaming a nightmare? :)

 I have tried to do something along these lines... spent about 15 hours
 in general and got almost nothing but headache and eyesore... and a feeling
 of being extremily stupid for not being able to plug a few jars into a jvm
 program (isn't java all just about putting jars together? :) ). I am a
 Clojure newb and maybe I am missing somewhat essential.. but in Scala, with
 or without SBT, using Scala IDE for Eclipse, I got everything up and
 running in about 15 minutes.

 Please, could anyone give me a clear explanation or better, a full
 example of plugging in the JME3 into a Clojure project? Shouldn't it be
 simple? Thank you in advance, the situation is really disappointing for me
 :(

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




  --
 --
 You received this message because you are subscribed 

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
oh nevermind I misread that. So it doesn't work for you with ccw? are you
using latest ccw beta?
When I start the core.clj file with Ctrl+Alt+L to load it in a repl it
works for me

Eclipse SDK

Version: 4.3.0
Build id: I20130430-0031
  Counterclockwise (Clojure plugin for Eclipse)0.13.0.201304242239
ccw.feature.feature.groupCounterclockwise team


On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Just tried that! Very nice! Got it running with lein repl from Windows
 command prompt!!! However, when I fire up the repl from Eclipse CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James Reeves
 написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries: http://www.**jmonkeyengine.com/nightly/**
 jME3_2013-04-29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavejester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a game
 with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I take
 their latest nightie set of jars 
 (http://jmonkeyengine.com/**nightly/http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people get
 them in the lib folder and it works, or where they recommend pushing them
 to the local maven repo... but they do not tell how they do it, or they
 show it for some very simple cases. Sure, there is a lot of instructions
 like use mvn install:install-file a-lot-of-stuff-goes-here or lein
 localrepo install less-stuff-but-hey... so do I have to do it for all
 the 30 (thirty) jar files? Considering too, that I have to invent an
 artifactId for every one of them, invent a version number, type all
 that in manually. And that is not my library, I do not want to invent that.
 And even, if I do that, then, how do I specify that all them are
 interdependant (are parts of one thing) and have to be always drawn in
 together? I will have to specify the 30 dependencies in my project.clj each
 time? Well, and even if I do, then I will still have that pain with
 manually copying all that stuff on each new machine where I work, picking
 it from the local maven repo and putting it to another maven repo. And
 if I want to push it to Clojars, I have do that for each one manually too,
 typing in commands in the Windows cmd and taking care for inventing version
 numbers?... oh, and maybe I could go about specifying dependency clauses
 in a pom? pinch me am I dreaming a nightmare? :)

 I have tried to do something along these lines... spent about 15 hours
 in general and got almost nothing but headache and eyesore... and a feeling
 of being extremily stupid for not being able to plug a few jars into a jvm
 program (isn't java all just about putting jars together? :) ). I am a
 Clojure newb and maybe I am missing somewhat essential.. but in Scala, with
 or without SBT, using Scala IDE for Eclipse, I got everything up and
 running in about 15 minutes.

 Please, could anyone give me a clear explanation or better, a full
 example of plugging in the JME3 into a Clojure project? Shouldn't it be
 simple? Thank you in advance, the situation is really disappointing for me
 :(

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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, 

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
oh yes that thing, just do Run-Run As...  on your project
and delete all the children inside Clojure
things like:
fightingsail Leiningen
where fightingsail is the name of the project

and when you try to start the REPL again, it will create a new one with the
correct Arguments


On Tue, Apr 30, 2013 at 9:35 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Right, I had the stable version, not beta, and Ctrl+Alt+L had no effect at
 all. So now I have updated to the latest beta. Now repl does not start
 at all :)

 The error in the console is:

 Could not transfer artifact ccw:ccw.server:pom:0.1.0 from/to central (
 http://repo1.maven.org/maven2/): repo1.maven.org

 This could be due to a typo in :dependencies or network issues.


 My Eclipse version is

 Eclipse IDE for Java Developers

 Version: Juno Service Release 2

 Build id: 20130225-0426


 CCW now is

   Counterclockwise (Clojure plugin for Eclipse) 0.13.0.201304242239
 ccw.feature.feature.group Counterclockwise team


 I looked up and I saw Laurent saying that there is problems of backwards
 compatibility problems in new Eclipse versions... Uhhh so sad.. do you
 have any ideas?


 вторник, 30 апреля 2013 г., 21:58:04 UTC+4 пользователь AtKaaZ написал:

 oh nevermind I misread that. So it doesn't work for you with ccw? are you
 using latest ccw beta?
 When I start the core.clj file with Ctrl+Alt+L to load it in a repl it
 works for me

 Eclipse SDK

 Version: 4.3.0
 Build id: I20130430-0031
   Counterclockwise (Clojure plugin for Eclipse)0.13.0.201304242239
 ccw.feature.feature.groupCounterclockwise team


 On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.m...@gmail.com wrote:

 Just tried that! Very nice! Got it running with lein repl from Windows
 command prompt!!! However, when I fire up the repl from Eclipse CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James Reeves
 написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries: http://www.**jmonkeyen**gine.com/nightly/**
 jME3_2013-04-**29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavej**ester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a
 game with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I
 take their latest nightie set of jars (http://jmonkeyengine.com/**nigh
 **tly/ http://jmonkeyengine.com/nightly/) and what? I can't
 make use of them in my CCW/Leiningen project no matter how hard I try. So
 ok, I have found some examples where people get them in the lib folder
 and it works, or where they recommend pushing them to the local maven
 repo... but they do not tell how they do it, or they show it for some very
 simple cases. Sure, there is a lot of instructions like use mvn
 install:install-file a-lot-of-stuff-goes-here or lein localrepo 
 install
 less-stuff-but-hey... so do I have to do it for all the 30 (thirty) jar
 files? Considering too, that I have to invent an artifactId for every 
 one
 of them, invent a version number, type all that in manually. And that is
 not my library, I do not want to invent that. And even, if I do that, 
 then,
 how do I specify that all them are interdependant (are parts of one thing)
 and have to be always drawn in together? I will have to specify the 30
 dependencies in my project.clj each time? Well, and even if I do, then I
 will still have that pain with manually copying all that stuff on each new
 machine where I work, picking it from the local maven repo and putting it
 to another maven repo. And if I want to push it to Clojars, I have do
 that for each one manually too, typing in commands in the Windows cmd and
 taking care for inventing version numbers?... oh, and maybe I could go
 about specifying dependency clauses in a pom? pinch me am I dreaming a
 nightmare? :)

 I have tried to do something along these lines... spent about 15

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
sorry I meant, Run As-Run Configurations... :)


On Tue, Apr 30, 2013 at 9:41 PM, AtKaaZ atk...@gmail.com wrote:

 oh yes that thing, just do Run-Run As...  on your project
 and delete all the children inside Clojure
 things like:
 fightingsail Leiningen
 where fightingsail is the name of the project

 and when you try to start the REPL again, it will create a new one with
 the correct Arguments


 On Tue, Apr 30, 2013 at 9:35 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Right, I had the stable version, not beta, and Ctrl+Alt+L had no effect
 at all. So now I have updated to the latest beta. Now repl does not
 start at all :)

 The error in the console is:

 Could not transfer artifact ccw:ccw.server:pom:0.1.0 from/to central (
 http://repo1.maven.org/maven2/): repo1.maven.org

 This could be due to a typo in :dependencies or network issues.


 My Eclipse version is

 Eclipse IDE for Java Developers

 Version: Juno Service Release 2

 Build id: 20130225-0426


 CCW now is

   Counterclockwise (Clojure plugin for Eclipse) 0.13.0.201304242239
 ccw.feature.feature.group Counterclockwise team


 I looked up and I saw Laurent saying that there is problems of backwards
 compatibility problems in new Eclipse versions... Uhhh so sad.. do you
 have any ideas?


 вторник, 30 апреля 2013 г., 21:58:04 UTC+4 пользователь AtKaaZ написал:

 oh nevermind I misread that. So it doesn't work for you with ccw? are
 you using latest ccw beta?
 When I start the core.clj file with Ctrl+Alt+L to load it in a repl it
 works for me

 Eclipse SDK

 Version: 4.3.0
 Build id: I20130430-0031
   Counterclockwise (Clojure plugin for Eclipse)
 0.13.0.201304242239ccw.feature.feature.groupCounterclockwise team


 On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.m...@gmail.comwrote:

 Just tried that! Very nice! Got it running with lein repl from
 Windows command prompt!!! However, when I fire up the repl from Eclipse
 CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James
 Reeves написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries: http://www.**jmonkeyen**gine.com/nightly/**
 jME3_2013-04-**29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths
 [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavej**ester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a
 game with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So
 I take their latest nightie set of jars (http://jmonkeyengine.com/**
 nigh**tly/ http://jmonkeyengine.com/nightly/) and what? I
 can't make use of them in my CCW/Leiningen project no matter how hard I
 try. So ok, I have found some examples where people get them in the lib
 folder and it works, or where they recommend pushing them to the local
 maven repo... but they do not tell how they do it, or they show it for 
 some
 very simple cases. Sure, there is a lot of instructions like use mvn
 install:install-file a-lot-of-stuff-goes-here or lein localrepo 
 install
 less-stuff-but-hey... so do I have to do it for all the 30 (thirty) 
 jar
 files? Considering too, that I have to invent an artifactId for every 
 one
 of them, invent a version number, type all that in manually. And that 
 is
 not my library, I do not want to invent that. And even, if I do that, 
 then,
 how do I specify that all them are interdependant (are parts of one 
 thing)
 and have to be always drawn in together? I will have to specify the 30
 dependencies in my project.clj each time? Well, and even if I do, then I
 will still have that pain with manually copying all that stuff on each 
 new
 machine where I work, picking it from the local maven repo and putting it
 to another maven repo. And if I want to push it to Clojars, I have do
 that for each one manually too, typing in commands in the Windows cmd and
 taking care for inventing version numbers?... oh, and maybe I could go
 about specifying

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
also I think Ctrl+Alt+S is my Ctrl+Alt+L , either that or they both do the
same thing. I forgot whether I added Ctrl+Alt+L myself but it's meant to
mean Load File In REPL


On Tue, Apr 30, 2013 at 9:35 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Right, I had the stable version, not beta, and Ctrl+Alt+L had no effect at
 all. So now I have updated to the latest beta. Now repl does not start
 at all :)

 The error in the console is:

 Could not transfer artifact ccw:ccw.server:pom:0.1.0 from/to central (
 http://repo1.maven.org/maven2/): repo1.maven.org

 This could be due to a typo in :dependencies or network issues.


 My Eclipse version is

 Eclipse IDE for Java Developers

 Version: Juno Service Release 2

 Build id: 20130225-0426


 CCW now is

   Counterclockwise (Clojure plugin for Eclipse) 0.13.0.201304242239
 ccw.feature.feature.group Counterclockwise team


 I looked up and I saw Laurent saying that there is problems of backwards
 compatibility problems in new Eclipse versions... Uhhh so sad.. do you
 have any ideas?


 вторник, 30 апреля 2013 г., 21:58:04 UTC+4 пользователь AtKaaZ написал:

 oh nevermind I misread that. So it doesn't work for you with ccw? are you
 using latest ccw beta?
 When I start the core.clj file with Ctrl+Alt+L to load it in a repl it
 works for me

 Eclipse SDK

 Version: 4.3.0
 Build id: I20130430-0031
   Counterclockwise (Clojure plugin for Eclipse)0.13.0.201304242239
 ccw.feature.feature.groupCounterclockwise team


 On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.m...@gmail.com wrote:

 Just tried that! Very nice! Got it running with lein repl from Windows
 command prompt!!! However, when I fire up the repl from Eclipse CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James Reeves
 написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries: http://www.**jmonkeyen**gine.com/nightly/**
 jME3_2013-04-**29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavej**ester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a
 game with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I
 take their latest nightie set of jars (http://jmonkeyengine.com/**nigh
 **tly/ http://jmonkeyengine.com/nightly/) and what? I can't
 make use of them in my CCW/Leiningen project no matter how hard I try. So
 ok, I have found some examples where people get them in the lib folder
 and it works, or where they recommend pushing them to the local maven
 repo... but they do not tell how they do it, or they show it for some very
 simple cases. Sure, there is a lot of instructions like use mvn
 install:install-file a-lot-of-stuff-goes-here or lein localrepo 
 install
 less-stuff-but-hey... so do I have to do it for all the 30 (thirty) jar
 files? Considering too, that I have to invent an artifactId for every 
 one
 of them, invent a version number, type all that in manually. And that is
 not my library, I do not want to invent that. And even, if I do that, 
 then,
 how do I specify that all them are interdependant (are parts of one thing)
 and have to be always drawn in together? I will have to specify the 30
 dependencies in my project.clj each time? Well, and even if I do, then I
 will still have that pain with manually copying all that stuff on each new
 machine where I work, picking it from the local maven repo and putting it
 to another maven repo. And if I want to push it to Clojars, I have do
 that for each one manually too, typing in commands in the Windows cmd and
 taking care for inventing version numbers?... oh, and maybe I could go
 about specifying dependency clauses in a pom? pinch me am I dreaming a
 nightmare? :)

 I have tried to do something along these lines... spent about 15 hours
 in general and got almost nothing but headache and eyesore... and a 
 feeling
 of being extremily

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
actually looks like I spoke too soon, what I said doesn't seem to apply to
you because the console message says  ccw.server instead of ccw-server
(dot vs dash), so it should be able to fetch that unless you're not
allowing it in firewall? I emptied my .m2 folder and it works for me, ccw
fetches all the artifacts even though I just Ctrl+Alt+L after starting
eclipse without any Update Dependencies on the project.


On Tue, Apr 30, 2013 at 9:42 PM, AtKaaZ atk...@gmail.com wrote:

 sorry I meant, Run As-Run Configurations... :)


 On Tue, Apr 30, 2013 at 9:41 PM, AtKaaZ atk...@gmail.com wrote:

 oh yes that thing, just do Run-Run As...  on your project
 and delete all the children inside Clojure
 things like:
 fightingsail Leiningen
 where fightingsail is the name of the project

 and when you try to start the REPL again, it will create a new one with
 the correct Arguments


 On Tue, Apr 30, 2013 at 9:35 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Right, I had the stable version, not beta, and Ctrl+Alt+L had no effect
 at all. So now I have updated to the latest beta. Now repl does not
 start at all :)

 The error in the console is:

 Could not transfer artifact ccw:ccw.server:pom:0.1.0 from/to central (
 http://repo1.maven.org/maven2/): repo1.maven.org

 This could be due to a typo in :dependencies or network issues.


 My Eclipse version is

 Eclipse IDE for Java Developers

 Version: Juno Service Release 2

 Build id: 20130225-0426


 CCW now is

   Counterclockwise (Clojure plugin for Eclipse) 0.13.0.201304242239
 ccw.feature.feature.group Counterclockwise team


 I looked up and I saw Laurent saying that there is problems of backwards
 compatibility problems in new Eclipse versions... Uhhh so sad.. do you
 have any ideas?


 вторник, 30 апреля 2013 г., 21:58:04 UTC+4 пользователь AtKaaZ написал:

 oh nevermind I misread that. So it doesn't work for you with ccw? are
 you using latest ccw beta?
 When I start the core.clj file with Ctrl+Alt+L to load it in a repl it
 works for me

 Eclipse SDK

 Version: 4.3.0
 Build id: I20130430-0031
   Counterclockwise (Clojure plugin for Eclipse)
 0.13.0.201304242239ccw.feature.feature.groupCounterclockwise team


 On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.m...@gmail.comwrote:

 Just tried that! Very nice! Got it running with lein repl from
 Windows command prompt!!! However, when I fire up the repl from Eclipse
 CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core file
 directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? 
 Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James
 Reeves написал:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack 
 I've
 been using:

 1. Download the binaries: http://www.**jmonkeyen**gine.com/nightly/**
 jME3_2013-04-**29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths
 [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavej**ester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a
 game with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So
 I take their latest nightie set of jars (http://jmonkeyengine.com/**
 nigh**tly/ http://jmonkeyengine.com/nightly/) and what? I
 can't make use of them in my CCW/Leiningen project no matter how hard I
 try. So ok, I have found some examples where people get them in the 
 lib
 folder and it works, or where they recommend pushing them to the local
 maven repo... but they do not tell how they do it, or they show it for 
 some
 very simple cases. Sure, there is a lot of instructions like use mvn
 install:install-file a-lot-of-stuff-goes-here or lein localrepo 
 install
 less-stuff-but-hey... so do I have to do it for all the 30 (thirty) 
 jar
 files? Considering too, that I have to invent an artifactId for every 
 one
 of them, invent a version number, type all that in manually. And that 
 is
 not my library, I do not want to invent that. And even, if I do that, 
 then,
 how do I specify that all them are interdependant (are parts of one 
 thing)
 and have to be always drawn in together? I will have

Re: Using a Java game engine in my project

2013-04-30 Thread AtKaaZ
I had the issue here:
https://code.google.com/p/counterclockwise/issues/detail?id=567
I think the fix is to use java 7 for eclipse not java 6



On Tue, Apr 30, 2013 at 10:01 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Same thing... I have no firewall or other restrictions... Have just
 deleted the ccw folder, and now it creates the folder, but does not fetch a
 jar into it. And the error is the same... reaally strange that :) Tried
 removing all the Run Configs just to be sure.. still same :)  Idk, maybe if
 I reboot, it's gonna be ok... I try to reboot now.

 вторник, 30 апреля 2013 г., 22:48:58 UTC+4 пользователь atkaaz написал:

 actually looks like I spoke too soon, what I said doesn't seem to apply
 to you because the console message says  ccw.server instead of ccw-server
 (dot vs dash), so it should be able to fetch that unless you're not
 allowing it in firewall? I emptied my .m2 folder and it works for me, ccw
 fetches all the artifacts even though I just Ctrl+Alt+L after starting
 eclipse without any Update Dependencies on the project.


 On Tue, Apr 30, 2013 at 9:42 PM, AtKaaZ atk...@gmail.com wrote:

 sorry I meant, Run As-Run Configurations... :)


 On Tue, Apr 30, 2013 at 9:41 PM, AtKaaZ atk...@gmail.com wrote:

 oh yes that thing, just do Run-Run As...  on your project
 and delete all the children inside Clojure
 things like:
 fightingsail Leiningen
 where fightingsail is the name of the project

 and when you try to start the REPL again, it will create a new one with
 the correct Arguments


 On Tue, Apr 30, 2013 at 9:35 PM, Alex Fowler alex.m...@gmail.comwrote:

 Right, I had the stable version, not beta, and Ctrl+Alt+L had no
 effect at all. So now I have updated to the latest beta. Now repl does
 not start at all :)

 The error in the console is:

 Could not transfer artifact ccw:ccw.server:pom:0.1.0 from/to central (
 http://repo1.maven.org/**maven2/ http://repo1.maven.org/maven2/):
 repo1.maven.org

 This could be due to a typo in :dependencies or network issues.


 My Eclipse version is

 Eclipse IDE for Java Developers

 Version: Juno Service Release 2

 Build id: 20130225-0426


 CCW now is

   Counterclockwise (Clojure plugin for Eclipse) 0.13.0.201304242239
 ccw.feature.feature.group Counterclockwise team


 I looked up and I saw Laurent saying that there is problems of
 backwards compatibility problems in new Eclipse versions... Uhhh so
 sad.. do you have any ideas?


 вторник, 30 апреля 2013 г., 21:58:04 UTC+4 пользователь AtKaaZ написал:

 oh nevermind I misread that. So it doesn't work for you with ccw? are
 you using latest ccw beta?
 When I start the core.clj file with Ctrl+Alt+L to load it in a repl
 it works for me

 Eclipse SDK

 Version: 4.3.0
 Build id: I20130430-0031
   Counterclockwise (Clojure plugin for Eclipse)
 0.13.0.201304242239ccw.feature.feature.groupCounterclockwise team


 On Tue, Apr 30, 2013 at 8:49 PM, Alex Fowler alex.m...@gmail.comwrote:

 Just tried that! Very nice! Got it running with lein repl from
 Windows command prompt!!! However, when I fire up the repl from Eclipse
 CCW, I get:

 ClassNotFoundException com.jme3.app.SimpleApplication
  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

 I assume, this is due to the fact that when I evaluate te core
 file directly, it skips the project.clj which specifies the necessary
 :resource-paths... Don't you know, how can I have the repl from CCW? 
 Should
 I make some explicit resources loading?



 понедельник, 29 апреля 2013 г., 23:46:25 UTC+4 пользователь James
 Reeves написал:

 I've been messing around with jME3 as well, and at some point I
 might release a library for it.

 One of the problems with jME3 is that its deployment mechanism
 hasn't quite caught up with the current century. I'm planning on 
 packaging
 it up eventually, but in the meantime here's the ugly, dirty, terrible 
 hack
 I've been using:

 1. Download the binaries: http://www.**jmonkeyen
 gine.com/nightly/**jME3_2013-04-29.ziphttp://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths
 [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/**weavejester/5484183https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.m...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a
 game with Clojure and JMonkeyEngine (http://jmonkeyengine.com/).
 So I take their latest nightie set of jars (
 http://jmonkeyengine.com/**nightly/http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people 
 get
 them in the lib folder and it works, or where

Re: Connascence (from: Explain, don't document.)

2013-04-29 Thread AtKaaZ
Thank you very much.


On Mon, Apr 29, 2013 at 10:42 AM, Rich Morin r...@cfcl.com wrote:

 A clean, if short (32 minute) version of Jim Weirich's talk on connascence
 is again online at Confreaks (Thanks,  Coby!).  See:

   The Building Blocks of Modularity, aka
   The Grand Unified Theory of Software Development

 http://confreaks.com/videos/77-mwrc2009-the-building-blocks-of-modularity

 Just as some of Glenford Myers' work in Composite/Structured Design fails
 to match some aspects of OO development, some of Meilir Page-Jones work in
 What every programmer should know about Object-Oriented Design fails to
 match some aspects of Clojure, FP, etc.

 For example, Clojure's handling of identity and value certainly speaks to
 the question of Connascence of Identity.  I'm not sure how much effect
 immutability has on connascence.  Certainly, using the data as the API
 (as Stuart Sierra recommends) differs markedly from OO best practices.

 However, the basic notion of identifying forms of coupling and thinking
 about their dangers (and benefits) is still very relevant.  If you want
 a good introduction to the topic, this is a good video to watch.

 -r

  --
 http://www.cfcl.com/rdmRich Morin
 http://www.cfcl.com/rdm/resume r...@cfcl.com
 http://www.cfcl.com/rdm/weblog +1 650-873-7841

 Software system design, development, and documentation


 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




testing for nil may not be enough

2013-04-29 Thread AtKaaZ
How do you guys handle the cases when the var is unbound? I mean
specifically in the cases where you just test if the var is nil.

= (def a)
#'clojurewerkz.titanium.graph-test/a

= a
#Unbound Unbound: #'clojurewerkz.titanium.graph-test/a

= (nil? a)
false

= (bound? a)
ClassCastException clojure.lang.Var$Unbound cannot be cast to
clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

= (bound? #'a)
false

ok imagine the following sample :))

= (defn decorate [input]
 (when (not (nil? input)) (str prefix: input :suffix)))
#'clojurewerkz.titanium.graph-test/decorate

= (decorate 1)
prefix:1:suffix

= (decorate a)
prefix:Unbound: #'clojurewerkz.titanium.graph-test/a:suffix

so... fix?
 but more importantly does anyone need to add checks for is-the-var-bound
in their code where they checked for nil ?

-- 
-- 
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/groups/opt_out.




Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
I'm thinking something like (def ^:dynamic *a*) where it would make more
sense that it's unbound at first


On Mon, Apr 29, 2013 at 7:00 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 I 've found that whenever I get a var-unbound exception it is almost
 always my fault and my fault only...why would you do (def a) anyway?

 Jim



 On 29/04/13 16:32, AtKaaZ wrote:

 How do you guys handle the cases when the var is unbound? I mean
 specifically in the cases where you just test if the var is nil.

 = (def a)
 #'clojurewerkz.titanium.graph-**test/a

 = a
 #Unbound Unbound: #'clojurewerkz.titanium.graph-**test/a

 = (nil? a)
 false

 = (bound? a)
 ClassCastException clojure.lang.Var$Unbound cannot be cast to
 clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

 = (bound? #'a)
 false

 ok imagine the following sample :))

 = (defn decorate [input]
  (when (not (nil? input)) (str prefix: input :suffix)))
 #'clojurewerkz.titanium.graph-**test/decorate

 = (decorate 1)
 prefix:1:suffix

 = (decorate a)
 prefix:Unbound: #'clojurewerkz.titanium.graph-**test/a:suffix

 so... fix?
  but more importantly does anyone need to add checks for is-the-var-bound
 in their code where they checked for nil ?

 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
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/groups/opt_out.




Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
Seems like a good idea to have the root binding be nil. How would you make
it check for bound inside the function? do we need some kind of macro?


On Mon, Apr 29, 2013 at 7:23 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 Why not make the root binding nil?  If your decorate function is supposed
 to handle all vars, then they have to deal with the unbound case as that's
 part of the contract of vars.

 If it's a generic thing, then maybe make a multimethod or protocol for it.


 On Mon, Apr 29, 2013 at 12:17 PM, AtKaaZ atk...@gmail.com wrote:

 I'm thinking something like (def ^:dynamic *a*) where it would make more
 sense that it's unbound at first


 On Mon, Apr 29, 2013 at 7:00 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 I 've found that whenever I get a var-unbound exception it is almost
 always my fault and my fault only...why would you do (def a) anyway?

 Jim



 On 29/04/13 16:32, AtKaaZ wrote:

 How do you guys handle the cases when the var is unbound? I mean
 specifically in the cases where you just test if the var is nil.

 = (def a)
 #'clojurewerkz.titanium.graph-**test/a

 = a
 #Unbound Unbound: #'clojurewerkz.titanium.graph-**test/a

 = (nil? a)
 false

 = (bound? a)
 ClassCastException clojure.lang.Var$Unbound cannot be cast to
 clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

 = (bound? #'a)
 false

 ok imagine the following sample :))

 = (defn decorate [input]
  (when (not (nil? input)) (str prefix: input :suffix)))
 #'clojurewerkz.titanium.graph-**test/decorate

 = (decorate 1)
 prefix:1:suffix

 = (decorate a)
 prefix:Unbound: #'clojurewerkz.titanium.graph-**test/a:suffix

 so... fix?
  but more importantly does anyone need to add checks for
 is-the-var-bound in their code where they checked for nil ?

 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
You

Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
I'm thinking of a hacky way of doing it...
(def a nil)
(def b)

= (defn x [in]
 (when (not (nil? in)) (.v in)))
#'clojurewerkz.titanium.graph-test/x

= (x b)
#'clojurewerkz.titanium.graph-test/b

= (x a)
nil



On Mon, Apr 29, 2013 at 7:31 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 If you're passing the var itself, I don't see why you'd need a macro.  If
 you want to check the namespace for a var matching an unquoted symbol, you
 could do that in a macro.


 On Mon, Apr 29, 2013 at 12:29 PM, AtKaaZ atk...@gmail.com wrote:

 Seems like a good idea to have the root binding be nil. How would you
 make it check for bound inside the function? do we need some kind of macro?


 On Mon, Apr 29, 2013 at 7:23 PM, Gary Trakhman 
 gary.trakh...@gmail.comwrote:

 Why not make the root binding nil?  If your decorate function is
 supposed to handle all vars, then they have to deal with the unbound case
 as that's part of the contract of vars.

 If it's a generic thing, then maybe make a multimethod or protocol for
 it.


 On Mon, Apr 29, 2013 at 12:17 PM, AtKaaZ atk...@gmail.com wrote:

 I'm thinking something like (def ^:dynamic *a*) where it would make
 more sense that it's unbound at first


 On Mon, Apr 29, 2013 at 7:00 PM, Jim - FooBar(); 
 jimpil1...@gmail.comwrote:

 I 've found that whenever I get a var-unbound exception it is almost
 always my fault and my fault only...why would you do (def a) anyway?

 Jim



 On 29/04/13 16:32, AtKaaZ wrote:

 How do you guys handle the cases when the var is unbound? I mean
 specifically in the cases where you just test if the var is nil.

 = (def a)
 #'clojurewerkz.titanium.graph-**test/a

 = a
 #Unbound Unbound: #'clojurewerkz.titanium.graph-**test/a

 = (nil? a)
 false

 = (bound? a)
 ClassCastException clojure.lang.Var$Unbound cannot be cast to
 clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

 = (bound? #'a)
 false

 ok imagine the following sample :))

 = (defn decorate [input]
  (when (not (nil? input)) (str prefix: input :suffix)))
 #'clojurewerkz.titanium.graph-**test/decorate

 = (decorate 1)
 prefix:1:suffix

 = (decorate a)
 prefix:Unbound: #'clojurewerkz.titanium.graph-**test/a:suffix

 so... fix?
  but more importantly does anyone need to add checks for
 is-the-var-bound in their code where they checked for nil ?

 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --
 --
 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/groups/opt_out.




  --
 --
 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

Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
oh right, you mean that I should pass the var like (decorate #'a), I didn't
get that when I first read it. But suppose I'm just passing the
whatever-that-is (value?) like (decorate a) do I need to use a macro inside
the decorate function to check if the passed thing is an unbound var?


On Mon, Apr 29, 2013 at 7:31 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 If you're passing the var itself, I don't see why you'd need a macro.  If
 you want to check the namespace for a var matching an unquoted symbol, you
 could do that in a macro.


 On Mon, Apr 29, 2013 at 12:29 PM, AtKaaZ atk...@gmail.com wrote:

 Seems like a good idea to have the root binding be nil. How would you
 make it check for bound inside the function? do we need some kind of macro?


 On Mon, Apr 29, 2013 at 7:23 PM, Gary Trakhman 
 gary.trakh...@gmail.comwrote:

 Why not make the root binding nil?  If your decorate function is
 supposed to handle all vars, then they have to deal with the unbound case
 as that's part of the contract of vars.

 If it's a generic thing, then maybe make a multimethod or protocol for
 it.


 On Mon, Apr 29, 2013 at 12:17 PM, AtKaaZ atk...@gmail.com wrote:

 I'm thinking something like (def ^:dynamic *a*) where it would make
 more sense that it's unbound at first


 On Mon, Apr 29, 2013 at 7:00 PM, Jim - FooBar(); 
 jimpil1...@gmail.comwrote:

 I 've found that whenever I get a var-unbound exception it is almost
 always my fault and my fault only...why would you do (def a) anyway?

 Jim



 On 29/04/13 16:32, AtKaaZ wrote:

 How do you guys handle the cases when the var is unbound? I mean
 specifically in the cases where you just test if the var is nil.

 = (def a)
 #'clojurewerkz.titanium.graph-**test/a

 = a
 #Unbound Unbound: #'clojurewerkz.titanium.graph-**test/a

 = (nil? a)
 false

 = (bound? a)
 ClassCastException clojure.lang.Var$Unbound cannot be cast to
 clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

 = (bound? #'a)
 false

 ok imagine the following sample :))

 = (defn decorate [input]
  (when (not (nil? input)) (str prefix: input :suffix)))
 #'clojurewerkz.titanium.graph-**test/decorate

 = (decorate 1)
 prefix:1:suffix

 = (decorate a)
 prefix:Unbound: #'clojurewerkz.titanium.graph-**test/a:suffix

 so... fix?
  but more importantly does anyone need to add checks for
 is-the-var-bound in their code where they checked for nil ?

 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --
 --
 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/groups/opt_out.




  --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post

Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
thank you, I'll look into protocols


On Mon, Apr 29, 2013 at 7:54 PM, Gary Trakhman gary.trakh...@gmail.comwrote:

 You would only need a macro if you want to pass in 'a' and mean #'a.
  Syntactic abstraction.  Like I said, I'd make the implementation
 polymorphic on that value via a protocol so you're not special-casing it
 within the function itself.  Protocols are open for extension so someone
 else could come along and provide an implementation for something you
 haven't thought of doing.


 On Mon, Apr 29, 2013 at 12:44 PM, AtKaaZ atk...@gmail.com wrote:

 oh right, you mean that I should pass the var like (decorate #'a), I
 didn't get that when I first read it. But suppose I'm just passing the
 whatever-that-is (value?) like (decorate a) do I need to use a macro inside
 the decorate function to check if the passed thing is an unbound var?


 On Mon, Apr 29, 2013 at 7:31 PM, Gary Trakhman 
 gary.trakh...@gmail.comwrote:

 If you're passing the var itself, I don't see why you'd need a macro.
  If you want to check the namespace for a var matching an unquoted symbol,
 you could do that in a macro.


 On Mon, Apr 29, 2013 at 12:29 PM, AtKaaZ atk...@gmail.com wrote:

 Seems like a good idea to have the root binding be nil. How would you
 make it check for bound inside the function? do we need some kind of macro?


 On Mon, Apr 29, 2013 at 7:23 PM, Gary Trakhman gary.trakh...@gmail.com
  wrote:

 Why not make the root binding nil?  If your decorate function is
 supposed to handle all vars, then they have to deal with the unbound case
 as that's part of the contract of vars.

 If it's a generic thing, then maybe make a multimethod or protocol for
 it.


 On Mon, Apr 29, 2013 at 12:17 PM, AtKaaZ atk...@gmail.com wrote:

 I'm thinking something like (def ^:dynamic *a*) where it would make
 more sense that it's unbound at first


 On Mon, Apr 29, 2013 at 7:00 PM, Jim - FooBar(); 
 jimpil1...@gmail.com wrote:

 I 've found that whenever I get a var-unbound exception it is almost
 always my fault and my fault only...why would you do (def a) anyway?

 Jim



 On 29/04/13 16:32, AtKaaZ wrote:

 How do you guys handle the cases when the var is unbound? I mean
 specifically in the cases where you just test if the var is nil.

 = (def a)
 #'clojurewerkz.titanium.graph-**test/a

 = a
 #Unbound Unbound: #'clojurewerkz.titanium.graph-**test/a

 = (nil? a)
 false

 = (bound? a)
 ClassCastException clojure.lang.Var$Unbound cannot be cast to
 clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)

 = (bound? #'a)
 false

 ok imagine the following sample :))

 = (defn decorate [input]
  (when (not (nil? input)) (str prefix: input :suffix)))
 #'clojurewerkz.titanium.graph-**test/decorate

 = (decorate 1)
 prefix:1:suffix

 = (decorate a)
 prefix:Unbound: #'clojurewerkz.titanium.graph-**test/a:suffix

 so... fix?
  but more importantly does anyone need to add checks for
 is-the-var-bound in their code where they checked for nil ?

 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



 --
 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --
 --
 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

Re: testing for nil may not be enough

2013-04-29 Thread AtKaaZ
the pain with that is that it wouldn't work inside a function where a would
be the function parameter, ok it would work in a macro but inside a
function... that would be interesting to see


On Mon, Apr 29, 2013 at 9:01 PM, Sean Corfield seancorfi...@gmail.comwrote:

 Try this:

 user= (def a)
 #'user/a
 user= (bound? (var a))
 false
 user= (def a nil)
 #'user/a
 user= (bound? (var a))
 true

 Sean

 On Mon, Apr 29, 2013 at 8:32 AM, AtKaaZ atk...@gmail.com wrote:
  How do you guys handle the cases when the var is unbound? I mean
  specifically in the cases where you just test if the var is nil.
 
  = (def a)
  #'clojurewerkz.titanium.graph-test/a
 
  = a
  #Unbound Unbound: #'clojurewerkz.titanium.graph-test/a
 
  = (nil? a)
  false
 
  = (bound? a)
  ClassCastException clojure.lang.Var$Unbound cannot be cast to
  clojure.lang.Var  clojure.core/bound?/fn--4837 (core.clj:4954)
 
  = (bound? #'a)
  false
 
  ok imagine the following sample :))
 
  = (defn decorate [input]
   (when (not (nil? input)) (str prefix: input :suffix)))
  #'clojurewerkz.titanium.graph-test/decorate
 
  = (decorate 1)
  prefix:1:suffix
 
  = (decorate a)
  prefix:Unbound: #'clojurewerkz.titanium.graph-test/a:suffix
 
  so... fix?
   but more importantly does anyone need to add checks for
 is-the-var-bound in
  their code where they checked for nil ?
 
  --
  --
  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/groups/opt_out.
 
 



 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Using a Java game engine in my project

2013-04-29 Thread AtKaaZ
Hi, I've been planning on trying the instructions/code from [1] with regard
to jme3 and clojure but I haven't got there yet. Does that help you ?

There's also this project [2] which uses jme3 in clojure. The last time I
tried it I was able to get a window and a 3D scene.

[1] http://aurellem.org/
[2] https://github.com/CmdrDats/fightingsail



On Mon, Apr 29, 2013 at 10:02 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Hello! I have a problem, I will try to explain.. I want to write a game
 with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I take
 their latest nightie set of jars (http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people get
 them in the lib folder and it works, or where they recommend pushing them
 to the local maven repo... but they do not tell how they do it, or they
 show it for some very simple cases. Sure, there is a lot of instructions
 like use mvn install:install-file a-lot-of-stuff-goes-here or lein
 localrepo install less-stuff-but-hey... so do I have to do it for all
 the 30 (thirty) jar files? Considering too, that I have to invent an
 artifactId for every one of them, invent a version number, type all
 that in manually. And that is not my library, I do not want to invent that.
 And even, if I do that, then, how do I specify that all them are
 interdependant (are parts of one thing) and have to be always drawn in
 together? I will have to specify the 30 dependencies in my project.clj each
 time? Well, and even if I do, then I will still have that pain with
 manually copying all that stuff on each new machine where I work, picking
 it from the local maven repo and putting it to another maven repo. And
 if I want to push it to Clojars, I have do that for each one manually too,
 typing in commands in the Windows cmd and taking care for inventing version
 numbers?... oh, and maybe I could go about specifying dependency clauses
 in a pom? pinch me am I dreaming a nightmare? :)

 I have tried to do something along these lines... spent about 15 hours in
 general and got almost nothing but headache and eyesore... and a feeling of
 being extremily stupid for not being able to plug a few jars into a jvm
 program (isn't java all just about putting jars together? :) ). I am a
 Clojure newb and maybe I am missing somewhat essential.. but in Scala, with
 or without SBT, using Scala IDE for Eclipse, I got everything up and
 running in about 15 minutes.

 Please, could anyone give me a clear explanation or better, a full example
 of plugging in the JME3 into a Clojure project? Shouldn't it be simple?
 Thank you in advance, the situation is really disappointing for me :(

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: Using a Java game engine in my project

2013-04-29 Thread AtKaaZ
That's awesome!  Thanks James!


On Mon, Apr 29, 2013 at 10:46 PM, James Reeves ja...@booleanknot.comwrote:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries:
 http://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.murat...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a game
 with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I take
 their latest nightie set of jars (http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people get
 them in the lib folder and it works, or where they recommend pushing them
 to the local maven repo... but they do not tell how they do it, or they
 show it for some very simple cases. Sure, there is a lot of instructions
 like use mvn install:install-file a-lot-of-stuff-goes-here or lein
 localrepo install less-stuff-but-hey... so do I have to do it for all
 the 30 (thirty) jar files? Considering too, that I have to invent an
 artifactId for every one of them, invent a version number, type all
 that in manually. And that is not my library, I do not want to invent that.
 And even, if I do that, then, how do I specify that all them are
 interdependant (are parts of one thing) and have to be always drawn in
 together? I will have to specify the 30 dependencies in my project.clj each
 time? Well, and even if I do, then I will still have that pain with
 manually copying all that stuff on each new machine where I work, picking
 it from the local maven repo and putting it to another maven repo. And
 if I want to push it to Clojars, I have do that for each one manually too,
 typing in commands in the Windows cmd and taking care for inventing version
 numbers?... oh, and maybe I could go about specifying dependency clauses
 in a pom? pinch me am I dreaming a nightmare? :)

 I have tried to do something along these lines... spent about 15 hours in
 general and got almost nothing but headache and eyesore... and a feeling of
 being extremily stupid for not being able to plug a few jars into a jvm
 program (isn't java all just about putting jars together? :) ). I am a
 Clojure newb and maybe I am missing somewhat essential.. but in Scala, with
 or without SBT, using Scala IDE for Eclipse, I got everything up and
 running in about 15 minutes.

 Please, could anyone give me a clear explanation or better, a full
 example of plugging in the JME3 into a Clojure project? Shouldn't it be
 simple? Thank you in advance, the situation is really disappointing for me
 :(

 --
 --
 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/groups/opt_out.




  --
 --
 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/groups/opt_out.




-- 
-- 
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 

Re: Using a Java game engine in my project

2013-04-29 Thread AtKaaZ
that seems unsafe.

I'd rather use a nightly zip or what I am currently using, jme3 engine as
project in eclipse and when needed ant build it and have my project always
refer to the lib folder in the dist ie. I've these 2 lines in my project:

  :bootclasspath false;false is needed here for JME3 specified in
:resource-paths below; else it will fail with ClassNotFoundException
com.jme3.app.SimpleApplication  java.net.URLClassLoader$1.run
(URLClassLoader.java:366)

  :resource-paths [resources, ../jme3_engine/dist/lib/*] ;needs eclipse
project present: jme3_engine from trunk/engine ie.
https://code.google.com/p/jmonkeyengine/source/browse/#svn%2Ftrunk%2Fengine
and make sure you ant build it once to create and populate dist/lib/ folder

works fine for me in eclipse/ccw

btw, maybe you(Jonathan) and James could focus your efforts and release one
clojure jme3 library instead of two (eventually), or not...  just a
thought. It would seem like a waste if there will be two. (like hermes and
titanium people are focusing only on titanium now)

It'd be really cool to have a clojure 3D lib based on jme3



On Mon, Apr 29, 2013 at 11:21 PM, Jonathan Fischer Friberg 
odysso...@gmail.com wrote:

 I'm currently making a library for jmonkeyengine. It's not
 ready yet, however, a while back I decided to put jme in a repository.

 Url: http://jmonkeyengine.s3-website-eu-west-1.amazonaws.com/;
 Add to deps: [jme 2013-04-01]

 The biggest problem with it right now is that it contains all test models
 and textures, which I didn't realise at the time (this accounts for more
 than half of the size). But it's quick  easy if you want to give it a go.

 Jonathan



 On Mon, Apr 29, 2013 at 9:56 PM, AtKaaZ atk...@gmail.com wrote:

 That's awesome!  Thanks James!


 On Mon, Apr 29, 2013 at 10:46 PM, James Reeves ja...@booleanknot.comwrote:

 I've been messing around with jME3 as well, and at some point I might
 release a library for it.

 One of the problems with jME3 is that its deployment mechanism hasn't
 quite caught up with the current century. I'm planning on packaging it up
 eventually, but in the meantime here's the ugly, dirty, terrible hack I've
 been using:

 1. Download the binaries:
 http://www.jmonkeyengine.com/nightly/jME3_2013-04-29.zip
 2. Create a new directory and extract the zip file into it
 3. Create a new Leiningen project
 4. Add the following to your project.clj file: :resource-paths [lib/*]
 5. Copy the lib directory from the jME3 binaries into your project
 directory

 Here's an example application to get you going:

 https://gist.github.com/weavejester/5484183

 - James


 On 29 April 2013 20:02, Alex Fowler alex.murat...@gmail.com wrote:

 Hello! I have a problem, I will try to explain.. I want to write a game
 with Clojure and JMonkeyEngine (http://jmonkeyengine.com/). So I take
 their latest nightie set of jars (http://jmonkeyengine.com/nightly/)
 and what? I can't make use of them in my CCW/Leiningen project no
 matter how hard I try. So ok, I have found some examples where people get
 them in the lib folder and it works, or where they recommend pushing them
 to the local maven repo... but they do not tell how they do it, or they
 show it for some very simple cases. Sure, there is a lot of instructions
 like use mvn install:install-file a-lot-of-stuff-goes-here or lein
 localrepo install less-stuff-but-hey... so do I have to do it for all
 the 30 (thirty) jar files? Considering too, that I have to invent an
 artifactId for every one of them, invent a version number, type all
 that in manually. And that is not my library, I do not want to invent that.
 And even, if I do that, then, how do I specify that all them are
 interdependant (are parts of one thing) and have to be always drawn in
 together? I will have to specify the 30 dependencies in my project.clj each
 time? Well, and even if I do, then I will still have that pain with
 manually copying all that stuff on each new machine where I work, picking
 it from the local maven repo and putting it to another maven repo. And
 if I want to push it to Clojars, I have do that for each one manually too,
 typing in commands in the Windows cmd and taking care for inventing version
 numbers?... oh, and maybe I could go about specifying dependency clauses
 in a pom? pinch me am I dreaming a nightmare? :)

 I have tried to do something along these lines... spent about 15 hours
 in general and got almost nothing but headache and eyesore... and a feeling
 of being extremily stupid for not being able to plug a few jars into a jvm
 program (isn't java all just about putting jars together? :) ). I am a
 Clojure newb and maybe I am missing somewhat essential.. but in Scala, with
 or without SBT, using Scala IDE for Eclipse, I got everything up and
 running in about 15 minutes.

 Please, could anyone give me a clear explanation or better, a full
 example of plugging in the JME3 into a Clojure project? Shouldn't it be
 simple? Thank you in advance, the situation

recur doesn't complain when autoboxing fails?

2013-04-28 Thread AtKaaZ
= (defn abc [] 3)
#'ants/abc

= (loop [a 1]
 (when (= 1 a) (recur (abc
NO_SOURCE_FILE:2 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
nil

= (loop [a 1]
 (when (= 1 a) (recur (long (abc)
nil

= (loop [a 1]
 (when (= 1 a) (recur *(var defn)*)))
NO_SOURCE_FILE:2 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
nil

How was that boxed into long? :O
since this wouldn't work:

= (loop [a 1]
 (when (= 1 a) (recur (long (var defn)
ClassCastException clojure.lang.Var cannot be cast to java.lang.Number
clojure.lang.RT.longCast (RT.java:1151)

= (long (var defn))
ClassCastException clojure.lang.Var cannot be cast to java.lang.Number
clojure.lang.RT.longCast (RT.java:1151)


= (loop [a 1]
 (cond (not (= 1 a))
   a
   :else
   (recur (var defn
NO_SOURCE_FILE:5 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
*#'clojure.core/defn*

Shouldn't it err saying that it can't autobox into long? or am I missing
the meaning here? it does say that it had Object and it needed long, does
that autoboxing make it Long or long? apparently it just leaves it as
is:*#'clojure.core/defn
*

Any thoughts on this?

= (loop [a 1]
 (cond (not (= 1 a))
   a
   :else
   (recur (abc
NO_SOURCE_FILE:5 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
3

= (loop [a 1]
 (cond (not (= 1 a))
   a
   :else
   (recur (long (abc)
3

this makes sense.

-- 
-- 
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/groups/opt_out.




Re: recur doesn't complain when autoboxing fails?

2013-04-28 Thread AtKaaZ
Thank you very much, I see it now.
1. boxing means from primitive to object; unboxing is from object to
primitive (I disregarded this for some reason)
2. it does say the loop arg not the recur arg: Auto-boxing loop arg: a



On Sun, Apr 28, 2013 at 3:38 PM, John D. Hume duelin.mark...@gmail.comwrote:

 On Sun, Apr 28, 2013 at 5:46 AM, AtKaaZ atk...@gmail.com wrote:

 = (defn abc [] 3)
 #'ants/abc

 = (loop [a 1]
  (when (= 1 a) (recur (abc
 NO_SOURCE_FILE:2 recur arg for primitive local: a is not matching
 primitive, had: Object, needed: long
 Auto-boxing loop arg: a
 nil


 The compiler isn't telling you it will need to box your recur arg into a
 long, but that it will be boxing your initial loop arg into an Object.
 Think of the message as Maybe you intended `a` to be a primitive local,
 but since you passed `recur` a who-knows-what, it won't be.

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




Re: printing and reading functions

2013-03-03 Thread AtKaaZ
On Sun, Mar 3, 2013 at 12:21 PM, Dave Sann daves...@gmail.com wrote:

 This may be a question for clojure dev

 I find myself wanting to be able to print data-structures containing
 resolvable functions

 e.g.

 (let [x assoc] (str [x :a :b]))

 would be:

   [#fn clojure.core/assoc :a :b]

 or similar, rather than the current:

   [#core$assoc clojure.core$assoc@6d289e48 :a :b]

 which is unreadable.

 I can read this tag very easily, using the data-reader

   {fn resolve} or,

   (set! *data-readers* {'fn resolve})



 But I don't know of any way to get the name and namespace of a function to
 write it out.

Did you mean this?
= (meta #'assoc)
{:ns #Namespace clojure.core, :name assoc, :arglists ([map key val] [map
key val  kvs]), :column 1, :added 1.0, :static true, :doc assoc[iate].
When applied to a map, returns a new map of the\nsame (hashed/sorted)
type, that contains the mapping of key(s) to\nval(s). When applied to a
vector, returns a new vector that\ncontains val at index. Note - index
must be = (count vector)., :line 177, :file clojure/core.clj}


 I think this is not possible at the moment.


 Anyone?

 Thanks

 Dave

 --
 --
 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/groups/opt_out.






-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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 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/groups/opt_out.




Re: printing and reading functions

2013-03-03 Thread AtKaaZ
that's true but I thought you meant in general
basically, I'm looking for a way to get the var... ie.
= (let [x assoc
 y x]
 *(var y)*
 )
CompilerException java.lang.RuntimeException: Unable to resolve var: y in
this context, compiling:(NO_SOURCE_PATH:3:3)

= (let [x assoc
 y x]
 y
 )
#core$assoc clojure.core$assoc@35fcd90c
= (var assoc)
#'clojure.core/assoc


something that can replace that (var y) with something that actually gets
the var that y resolves to.



On Sun, Mar 3, 2013 at 12:58 PM, Dave Sann daves...@gmail.com wrote:

 I think, that will only work if you do it directly.

 It will not work in the example I gave.

 Dave


 On Sunday, 3 March 2013 22:43:14 UTC+11, AtKaaZ wrote:




 On Sun, Mar 3, 2013 at 12:21 PM, Dave Sann dave...@gmail.com wrote:

 This may be a question for clojure dev

 I find myself wanting to be able to print data-structures containing
 resolvable functions

 e.g.

 (let [x assoc] (str [x :a :b]))

 would be:

   [#fn clojure.core/assoc :a :b]

 or similar, rather than the current:

   [#core$assoc clojure.core$assoc@6d289e48 :a :b]

 which is unreadable.

 I can read this tag very easily, using the data-reader

   {fn resolve} or,

   (set! *data-readers* {'fn resolve})



 But I don't know of any way to get the name and namespace of a function
 to write it out.

 Did you mean this?
 = (meta #'assoc)
 {:ns #Namespace clojure.core, :name assoc, :arglists ([map key val]
 [map key val  kvs]), :column 1, :added 1.0, :static true, :doc
 assoc[iate]. When applied to a map, returns a new map of the\nsame
 (hashed/sorted) type, that contains the mapping of key(s) to\nval(s).
 When applied to a vector, returns a new vector that\ncontains val at
 index. Note - index must be = (count vector)., :line 177, :file
 clojure/core.clj}


 I think this is not possible at the moment.


 Anyone?

 Thanks

 Dave

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 Please correct me if I'm wrong or incomplete,
 even if you think I'll subconsciously hate 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 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/groups/opt_out.






-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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 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/groups/opt_out.




Re: printing and reading functions

2013-03-03 Thread AtKaaZ
ok you're right, it's impossible to get the var since those x and y are
already resolved to the function, and multiple vars could point to the same
function anyway.
= (let [x assoc
 y x]
 (get-lexical-env)
 )
{x #core$assoc clojure.core$assoc@35fcd90c, y #core$assoc
clojure.core$assoc@35fcd90c}

for consistency, ignore the following:
;the following is inspired from
http://blog.jayfields.com/2011/02/clojure-and.html
(defmacro get-lexical-env []

= (let [a 1 b (+ 1 2)]
 (let [c (do \a\ \b\)]
   (q/get-lexical-env)
   )
 )
{a 1, b 3, c \b\}

  (let [envkeys (keys env)]
`(zipmap (quote ~envkeys) (list ~@envkeys))
)
  )

(defmacro show-lexical-env []
  `(clojure.pprint/pprint (get-lexical-env))
  )


On Sun, Mar 3, 2013 at 1:05 PM, AtKaaZ atk...@gmail.com wrote:

 that's true but I thought you meant in general
 basically, I'm looking for a way to get the var... ie.
 = (let [x assoc
  y x]
  *(var y)*
  )
 CompilerException java.lang.RuntimeException: Unable to resolve var: y in
 this context, compiling:(NO_SOURCE_PATH:3:3)

 = (let [x assoc
  y x]
  y
  )
 #core$assoc clojure.core$assoc@35fcd90c
 = (var assoc)
 #'clojure.core/assoc


 something that can replace that (var y) with something that actually gets
 the var that y resolves to.



 On Sun, Mar 3, 2013 at 12:58 PM, Dave Sann daves...@gmail.com wrote:

 I think, that will only work if you do it directly.

 It will not work in the example I gave.

 Dave


 On Sunday, 3 March 2013 22:43:14 UTC+11, AtKaaZ wrote:




 On Sun, Mar 3, 2013 at 12:21 PM, Dave Sann dave...@gmail.com wrote:

 This may be a question for clojure dev

 I find myself wanting to be able to print data-structures containing
 resolvable functions

 e.g.

 (let [x assoc] (str [x :a :b]))

 would be:

   [#fn clojure.core/assoc :a :b]

 or similar, rather than the current:

   [#core$assoc clojure.core$assoc@6d289e48 :a :b]

 which is unreadable.

 I can read this tag very easily, using the data-reader

   {fn resolve} or,

   (set! *data-readers* {'fn resolve})



 But I don't know of any way to get the name and namespace of a function
 to write it out.

 Did you mean this?
 = (meta #'assoc)
 {:ns #Namespace clojure.core, :name assoc, :arglists ([map key val]
 [map key val  kvs]), :column 1, :added 1.0, :static true, :doc
 assoc[iate]. When applied to a map, returns a new map of the\nsame
 (hashed/sorted) type, that contains the mapping of key(s) to\nval(s).
 When applied to a vector, returns a new vector that\ncontains val at
 index. Note - index must be = (count vector)., :line 177, :file
 clojure/core.clj}


 I think this is not possible at the moment.


 Anyone?

 Thanks

 Dave

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@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+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://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+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 Please correct me if I'm wrong or incomplete,
 even if you think I'll subconsciously hate 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 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/groups/opt_out.






 --
 Please correct me if I'm wrong or incomplete,
 even if you think I'll subconsciously hate it.




-- 
Please correct me if I'm wrong or incomplete,
even if you think I'll subconsciously hate 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 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

  1   2   3   4   >