atom and vector .. remove prolbem

2013-12-09 Thread 박재혁
sorry I can't write English. watch my code. (def room-list (*atom[]*)) (def rooms-1 {:key "12345" :create-dt "2013-11-22" :user-list[ {:name "name-1" :id "id-1"} {:name "name-2" :id "id-2"}] }) (def rooms-2 {:key "67890" :create-dt "2013-12-52" :user-list[ {:name "name-3" :id "id-3"} {:name

Re: atom and vector .. remove prolbem

2013-12-09 Thread Alex Baranosky
There are ways to achieve what you ask, but normally you wouldn't use nested vectors for data structures you want to operate on associatively. It will be inefficient, and the code will be ugly. Better to use more maps and key them by:key and :id. On Mon, Dec 9, 2013 at 12:46 AM, 박재혁 wrote: > s

Re: atom and vector .. remove prolbem

2013-12-09 Thread Walter van der Laan
Hi, You could try to do it like this... Use a hashmap instead of a vector in the atom: (def room-list (atom {})) Insert rooms using a hashmap for the user-id's: (swap! room-list assoc "67890" {:user-list {"id-3" {:name "name-3"}}}) You can now find a user in a room like this: (get-in @room-list

Re: atom and vector .. remove prolbem

2013-12-09 Thread 박재혁
thank.. I change my source... 2013년 12월 9일 월요일 오후 6시 20분 34초 UTC+9, Walter van der Laan 님의 말: > > Hi, > > You could try to do it like this... > > Use a hashmap instead of a vector in the atom: > (def room-list (atom {})) > > Insert rooms using a hashmap for the user-id's: > (swap! room-list asso

Re: clojure java.jdbc db-do-prepared and dynamic parameters

2013-12-09 Thread Niels van Klaveren
I think the OP just meant to ask how to do a PreparedStatement batch update in clojure.jdbc. The simplest answer is, just give in multiple parameter vectors to db-do-prepared (sql/db-do-prepared db "INSERT INTO fruit2 ( name, appearance, cost, grade ) VALUES ( ?, ?, ?, ?

error-on-reflection

2013-12-09 Thread Phillip Lord
I know about *warn-on-reflection* but is there anyway that I can get an error-on-reflection instead? I've been type hinting my application (50% done and yes it goes faster now), and it's a bit painful. What I would really want is to have a unit test which fails if reflection is used. So far, my

Re: error-on-reflection

2013-12-09 Thread Tassilo Horn
phillip.l...@newcastle.ac.uk (Phillip Lord) writes: > I know about *warn-on-reflection* but is there anyway that I can get > an error-on-reflection instead? I don't think so. > I've been type hinting my application (50% done and yes it goes faster > now), and it's a bit painful. What I would rea

Re: error-on-reflection

2013-12-09 Thread John D. Hume
Are you aware of `lein check`? We have our some of our CI builds wired to fail if that finds anything. On Dec 9, 2013 4:12 AM, "Phillip Lord" wrote: > > I know about *warn-on-reflection* but is there anyway that I can get an > error-on-reflection instead? > > I've been type hinting my application

implementing arithmetic operators without using [+ - * / even? odd? inc dec]

2013-12-09 Thread Jim - FooBar();
Hi all, A very popular interview question is to try implement all arithemtic operations for integers without using all the usual suspects. After thinking for a while I concluded that I only really need inc/dec in order to implement everything else. And the good news is that one can easily imp

Re: implementing arithmetic operators without using [+ - * / even? odd? inc dec]

2013-12-09 Thread Gary Verhaegen
If you limit your operations to positive integers, all you need are the three primitive operations inc, dec and zero?. Then you can build up the other operations pretty much as you did. However, bit shifts are far from the only way to build these three primitives. For example: (def zero? empty?)

[Clojure-CLR] implement interface that has properties

2013-12-09 Thread Frank Hale
I'm trying to implement an interface that has properties but can't quite seem to get it to work and I also have not found any relevant examples via Google (yet). I'm sure I'm doing something completely wrong here but have no idea how to fix it. (System.Reflection.Assembly/LoadWithPartialName "Syst

[ANN] Recursd - Functional Programming Conference in San Diego

2013-12-09 Thread Ron Toland
Recursd is a one day technical conference on functional programming. Join other programmers and enthusiasts Saturday January 18th, 2014, to take part in presentations and workshops about functional programming languages and applications. Recursd will be held in Central S

Re: [Clojure-CLR] implement interface that has properties

2013-12-09 Thread John D. Hume
If I recall, properties are just syntactic sugar for awkwardly named methods. Have you tried the compiler-generated get and set method-names? On Dec 9, 2013 9:50 AM, "Frank Hale" wrote: > I'm trying to implement an interface that has properties but can't quite > seem to get it to work and I also

Re: [Clojure-CLR] implement interface that has properties

2013-12-09 Thread Frank Hale
Hi John, Yes I've tried adding get_ to the property name but I'm still not doing something correctly. (defn foo-handler [] (reify System.Web.IHttpHandler (get_IsReusable [] false) (ProcessRequest [context] ( CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must supply at least

Re: [Clojure-CLR] implement interface that has properties

2013-12-09 Thread Frank Hale
I also tried deftype (deftype foo-handler [] System.Web.IHttpHandler (get_IsReusable [this] false) (ProcessRequest [this context] ())) InvalidCastException Unable to cast object of type 'clojure.lang.Var' to type 'System.Type'. clojure.lang.Namespace.ReferenceClass On Mon, Dec 9, 2013 at 12:24

Re: [Clojure-CLR] implement interface that has properties

2013-12-09 Thread Frank Hale
It took me a few hours of research and trial and error but I think this will work: user=> (def foo-handler (reify System.Web.IHttpHandler (get_IsReusable [this] false) (ProcessRequest [this context] ( #'user/foo-handler user=> On Mon, Dec 9, 2013 at 12:38 PM, Frank Hale wrote: > I also tri

Moseley's FRP

2013-12-09 Thread Brian Craft
Slightly OT, but I know many of you have read OOTTP. This paper describes a hypothetical relational modeling infrastructure that allows declaring indexes on and writing queries against denormalized tables as though they were normalized tables. The point of this is to eliminate the complexity th

[ANN] strucjure 0.4.0

2013-12-09 Thread Jamie Brandon
Better late than never :) https://github.com/jamii/strucjure Strucjure is a library for describing stuff in an executable manner. It gives you pattern matching (with first-class patterns), validators, parsers, walks and lenses (and eventually generators). The shape of your data is immediately app

Re: [ANN] strucjure 0.4.0

2013-12-09 Thread Jason Wolfe
Congrats, looks awesome -- looking forward to trying it out! -Jason On Monday, December 9, 2013 11:05:18 AM UTC-8, Jamie Brandon wrote: > > Better late than never :) > > https://github.com/jamii/strucjure > > Strucjure is a library for describing stuff in an executable manner. It > gives you p

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
Take a look at "A practical theory of language-integrated query" at http://homepages.inf.ed.ac.uk/wadler/topics/recent.html . In the FPDays talk linked there Wadler demonstrated writing queries which returned denormalised views on tables, composing those with queries on the denormalised view and co

Re: [ANN] Recursd - Functional Programming Conference in San Diego

2013-12-09 Thread boz
Just registered! Thanks! Looking forward to it! !!! :) On Monday, December 9, 2013 8:04:05 AM UTC-8, Ron Toland wrote: > > Recursd is a one day technical conference on > functional programming. > > Join other programmers and enthusiasts Saturday January 18th, 2014, to > tak

Help with Reduce

2013-12-09 Thread David Simmons
Hi I have the following function: (defn group [& validators] (fn [m] (reduce (fn [maps f] (let [[m error-m] maps [new-map errors] (f m)] [new-map (vec (flatten (if errors (conj error-m errors) error-m)))])) [m []]

Re: Help with Reduce

2013-12-09 Thread Guru Devanla
Hi Dave, I tried running your code. I did see a function being returned in both cases. Am I doing something different? Thanks Guru On Mon, Dec 9, 2013 at 12:09 PM, David Simmons wrote: > Hi > > I have the following function: > > (defn group > [& validators] > (fn [m] > (reduce (fn [map

Re: Help with Reduce

2013-12-09 Thread David Simmons
Hi Guru odd. I'll give it another go. Kind Regards 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

Re: Moseley's FRP

2013-12-09 Thread Brian Craft
Very interesting paper, thanks. Seem to be more about LINQ to SQL, though: translating queries in a host language to sql queries against a db. It doesn't, for example, address indexing in-memory data. On Monday, December 9, 2013 11:23:36 AM UTC-8, Jamie Brandon wrote: > > Take a look at "A pract

Re: Help with Reduce

2013-12-09 Thread David Simmons
Hi Guru Ah my mistake, silly typo in my version. cheers 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 y

[ClojureCLR] clr.tools.nrepl

2013-12-09 Thread Frank Hale
I'm attempting to run the CLR version of nREPL. I've cloned the code from: https://github.com/clojure/clr.tools.nrepl However, I'm not sure how to run the REPL. Doing lein run results in the following message: "No :main namespace specified in project.clj." running lein compile doesn't fail but

TypeInitializationException

2013-12-09 Thread John Jelinek
I grabbed the Clojure NuGet package 1.5.0.2, and when I new up my clojure namespace and execute a method, I get a TypeInitializationException. It seems to be referencing Clojure 1.4.0, but shouldn't it be targeting 1.5.0? namespace.clj: (ns my.namespace > (:gen-class > :methods [[testing

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
That part that seemed relevant to your question is compile queries on denormalised views to queries on normalised databases. On 9 December 2013 22:07, Brian Craft wrote: > Very interesting paper, thanks. Seem to be more about LINQ to SQL, though: > translating queries in a host language to sql

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
Both the denormalised view and the query on it are represented as LINQ queries. The compiler then optimises the composition of the two and returns something that acts directly on the database without building up an intermediate representation. It seems to me that the same technique should work for

Re: Moseley's FRP

2013-12-09 Thread Brian Craft
Ah yes, I see. Thanks! On Monday, December 9, 2013 6:00:19 PM UTC-8, Jamie Brandon wrote: > > Both the denormalised view and the query on it are represented as LINQ > queries. The compiler then optimises the composition of the two and returns > something that acts directly on the database withou

Re: Import dbpedia data into neo4j using clojure

2013-12-09 Thread Himakshi Mangal
Hi... I have query regarding the clojure and neo4j.. I have started the program to load the dataset and also allocated 4G ram to it. But after processing around 272000 records, the process hangs and nothing happens. If i try to stop the process then, and copy the data in neo4j folder i get this