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 "name-3" :id "id-3"}] })

(swap! room-list conj rooms-1)
(swap! room-list conj rooms-2)

@room-list
  --> [{:key "12345", :create-dt "2013-11-22", :user-list [{:name "name-1", 
:id "id-1"} {:name "name-2", :id "id-2"}]} 
{:key "67890", :create-dt "2013-12-52", :user-list [*{:name 
"name-3", :id "id-3"}* {:name "name-3", :id "id-3"}]}]


I want remove red color text. ( red colore )

@room-list
-->  [{:key "12345", :create-dt "2013-11-22", :user-list [{:name "name-1", 
:id "id-1"} {:name "name-2", :id "id-2"}]} 
{:key "67890", :create-dt "2013-12-52", :user-list [{:name 
"name-3", :id "id-3"}] }]


I don't know how to remove...

dissoc,, pop, peek function can;t not solve.


please help 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.


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:

> 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 "name-3" :id "id-3"}] })
>
> (swap! room-list conj rooms-1)
> (swap! room-list conj rooms-2)
>
> @room-list
>   --> [{:key "12345", :create-dt "2013-11-22", :user-list [{:name
> "name-1", :id "id-1"} {:name "name-2", :id "id-2"}]}
> {:key "67890", :create-dt "2013-12-52", :user-list [*{:name
> "name-3", :id "id-3"}* {:name "name-3", :id "id-3"}]}]
>
>
> I want remove red color text. ( red colore )
>
> @room-list
> -->  [{:key "12345", :create-dt "2013-11-22", :user-list [{:name "name-1",
> :id "id-1"} {:name "name-2", :id "id-2"}]}
> {:key "67890", :create-dt "2013-12-52", :user-list [{:name
> "name-3", :id "id-3"}] }]
>
>
> I don't know how to remove...
>
> dissoc,, pop, peek function can;t not solve.
>
>
> please help 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: 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 ["67890" :user-list "id-3"])

To remove a user from a room you can use:
(swap! room-list update-in ["67890" :user-list] dissoc "id-3")

Good luck!

On Monday, December 9, 2013 9:46:49 AM UTC+1, 박재혁 wrote:
>
> 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 "name-3" :id "id-3"}] })
>
> (swap! room-list conj rooms-1)
> (swap! room-list conj rooms-2)
>
> @room-list
>   --> [{:key "12345", :create-dt "2013-11-22", :user-list [{:name 
> "name-1", :id "id-1"} {:name "name-2", :id "id-2"}]} 
> {:key "67890", :create-dt "2013-12-52", :user-list [*{:name 
> "name-3", :id "id-3"}* {:name "name-3", :id "id-3"}]}]
>
>
> I want remove red color text. ( red colore )
>
> @room-list
> -->  [{:key "12345", :create-dt "2013-11-22", :user-list [{:name "name-1", 
> :id "id-1"} {:name "name-2", :id "id-2"}]} 
> {:key "67890", :create-dt "2013-12-52", :user-list [{:name 
> "name-3", :id "id-3"}] }]
>
>
> I don't know how to remove...
>
> dissoc,, pop, peek function can;t not solve.
>
>
> please help 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.


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 assoc "67890" {:user-list {"id-3" {:name "name-3"}}})
>
> You can now find a user in a room like this:
> (get-in @room-list ["67890" :user-list "id-3"])
>
> To remove a user from a room you can use:
> (swap! room-list update-in ["67890" :user-list] dissoc "id-3")
>
> Good luck!
>
> On Monday, December 9, 2013 9:46:49 AM UTC+1, 박재혁 wrote:
>>
>> 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 "name-3" :id "id-3"}] })
>>
>> (swap! room-list conj rooms-1)
>> (swap! room-list conj rooms-2)
>>
>> @room-list
>>   --> [{:key "12345", :create-dt "2013-11-22", :user-list [{:name 
>> "name-1", :id "id-1"} {:name "name-2", :id "id-2"}]} 
>> {:key "67890", :create-dt "2013-12-52", :user-list [*{:name 
>> "name-3", :id "id-3"}* {:name "name-3", :id "id-3"}]}]
>>
>>
>> I want remove red color text. ( red colore )
>>
>> @room-list
>> -->  [{:key "12345", :create-dt "2013-11-22", :user-list [{:name 
>> "name-1", :id "id-1"} {:name "name-2", :id "id-2"}]} 
>> {:key "67890", :create-dt "2013-12-52", :user-list [{:name 
>> "name-3", :id "id-3"}] }]
>>
>>
>> I don't know how to remove...
>>
>> dissoc,, pop, peek function can;t not solve.
>>
>>
>> please help 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.


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 ( ?, ?, ?, ? )"
 ["banana" "yellow" 1 1.0]
 ["apple" "green" 2 1.0]
 ["orange" "orange" 3 1.0])

And as usual, if you have what should be separate parameters already in a 
collection, use the apply function

  (apply sql/db-do-prepared db
  "INSERT INTO fruit2 ( name, appearance, cost, grade ) VALUES ( ?, ?, ?, ? 
)"
   [["banana" "yellow" 1 1.0]
["apple" "green" 2 1.0]
["orange" "orange" 3 1.0]])

On Sunday, December 8, 2013 11:56:40 PM UTC+1, Sean Corfield wrote:
>
> Do you want that specific piece of (procedural) Java converted to 
> Clojure or do you have a real use case in the context of a real 
> problem that you're trying to solve? 
>
> I suspect just showing you what that piece of Java would look like in 
> Clojure isn't going to teach you how to do this in general... and 
> there are multiple approaches that would each be more suitable to 
> particular real world problems. 
>
> Sean 
>
> On Sun, Dec 8, 2013 at 9:44 AM, Avinash Dongre 
> > 
> wrote: 
> > I see following example in Clojure.java.jdbc 
> > 
> > (sql/db-do-prepared db "INSERT INTO fruit2 ( name, appearance, cost, 
> grade ) 
> > VALUES ( ?, ?, ?, ? )" ["test" "test" 1 1.0]) 
> > 
> > But how do i convert following java code into clojure. I am new to 
> clojure 
> > and not sure how to i pass multiple vector 
> > 
> > final int numRows = 1; 
> > PreparedStatement pstmt = conn 
> > .prepareStatement("insert into new_order values (?, ?, ?)"); 
> > for (int id = 1; id <= numRows; id++) { 
> >   pstmt.setInt(1, id % 98); 
> >   pstmt.setInt(2, id % 98); 
> >   pstmt.setInt(3, id); 
> >   int count; 
> >   if ((count = pstmt.executeUpdate()) != 1) { 
> > System.err.println("unexpected update count for a single insert 
> " + 
> > count); 
> > System.exit(2); 
> >   } 
> >   if ((id % 500) == 0) { 
> > System.out.println("Completed " + id + " inserts ..."); 
> >   } 
> > } 
> > 
> > -- 
> > -- 
> > 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=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_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.


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 best idea is catching standard-out and parsing it for
reflection warnings. Not ideal.

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.


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 really want is to have a
> unit test which fails if reflection is used.
>
> So far, my best idea is catching standard-out and parsing it for
> reflection warnings. Not ideal.

clojure/test/clojure/test_helper.clj already contains some helper macros
for doing that, e.g., `should-not-reflect`:

https://github.com/clojure/clojure/blob/0b73494c3c855e54b1da591eeb687f24f608f346/test/clojure/test_helper.clj#L126

One problem is, though, that you not only get reflection warnings for
your own code but also for code in dependencies.  So you need to tweak
that macro with another regex that matches only reflection warnings in
your own files.  But then you should be able to do something like this:

--8<---cut here---start->8---
(ns myproject.test
  :require [clojure.test :as test])

(defmacro should-not-reflect ...)
  
(test/deftest no-reflection-at-all
  (should-not-reflect
(do
  (require 'myproject.ns1 :reload)
  (require 'myproject.ns2 :reload)
  ...)))
--8<---cut here---end--->8---

HTH,
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.


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 (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 best idea is catching standard-out and parsing it for
> reflection warnings. Not ideal.
>
> 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.


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 implement inc/dec using bit-shifts like so:


(ns interview.arithmetic
  (:refer-clojure :exclude [- * / + inc dec even? odd?]))


(defn even? [x]
 (== 0 (bit-and x 1)))

(defn odd? [x]
 (== 1 (bit-and x 1)))

(defn- halve-int [x]
 (bit-shift-right x 1))

(defn- double-int [x]
 (bit-shift-left x 1))

(defn inc [x]
  (cond
(even? x) (bit-xor x 1)
(== -1 x) 0
  :else
 (-> x
halve-int
inc
double-int)))

(defn dec [x]
  (if (odd? x) (bit-xor x 1)
  (-> x
 bit-not
 inc
 bit-not)))

At this point, having this I can implement all arithmetic operations on 
integers by combining 'iterate' + take/take-while. For example here is +:


(defn +
([] 0)
([x] x)
([x y]
(let [iter (if (neg? y) dec inc)]
  (->> x
 (iterate iter)
 (take (inc (Math/abs y)))
 last)))
([x y & more]
  (reduce + x (cons y more

The same pattern applies for [-  *  /].  My question is, can anyone see 
a better way of doing this? It seems pretty elegant to me but I'd like 
to see what other people think...


many thanks :)

Jim

ps: division is indeed a bit trickier than the rest due to 
positive/negative signs. Not really hard though...


--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
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: 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?)
(def inc vector)
(def dec first)

Should work too, assuming you "seed" with an empty collection as a zero.
I'm not guaranteeing any kind of perfomance or the ability to represent
large numbers with this scheme and the current clojure implementation.

On Monday, 9 December 2013, Jim - FooBar(); wrote:

> 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
> implement inc/dec using bit-shifts like so:
>
> (ns interview.arithmetic
>   (:refer-clojure :exclude [- * / + inc dec even? odd?]))
>
>
> (defn even? [x]
>  (== 0 (bit-and x 1)))
>
> (defn odd? [x]
>  (== 1 (bit-and x 1)))
>
> (defn- halve-int [x]
>  (bit-shift-right x 1))
>
> (defn- double-int [x]
>  (bit-shift-left x 1))
>
> (defn inc [x]
>   (cond
> (even? x) (bit-xor x 1)
> (== -1 x) 0
>   :else
>  (-> x
> halve-int
> inc
> double-int)))
>
> (defn dec [x]
>   (if (odd? x) (bit-xor x 1)
>   (-> x
>  bit-not
>  inc
>  bit-not)))
>
> At this point, having this I can implement all arithmetic operations on
> integers by combining 'iterate' + take/take-while. For example here is +:
>
> (defn +
> ([] 0)
> ([x] x)
> ([x y]
> (let [iter (if (neg? y) dec inc)]
>   (->> x
>  (iterate iter)
>  (take (inc (Math/abs y)))
>  last)))
> ([x y & more]
>   (reduce + x (cons y more
>
> The same pattern applies for [-  *  /].  My question is, can anyone see a
> better way of doing this? It seems pretty elegant to me but I'd like to see
> what other people think...
>
> many thanks :)
>
> Jim
>
> ps: division is indeed a bit trickier than the rest due to
> positive/negative signs. Not really hard though...
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 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.


[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 "System.Web")

(defn foo-handler []
(reify System.Web.IHttpHandler
(IsReusable [] false)
(ProcessRequest [context] (

IsReusable is a property and I don't know how to tell reify that it is not
a traditional function.

CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must supply
at least one argument for 'this' in: IsReusable

Okay, I supply 'this' for IsReusable

CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't define
method not in interfaces: IsReusable

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


[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 San Diego at the Ansir Innovation Center.

Registrationis
 $10 before Jan 4, 2014, and $20 after.

Presenters receive free admission. To submit a proposal, contact us at: 
recu...@gmail.com

Hope to see you there!

Ron

-- 
-- 
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: [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 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 "System.Web")
>
> (defn foo-handler []
> (reify System.Web.IHttpHandler
>  (IsReusable [] false)
> (ProcessRequest [context] (
>
> IsReusable is a property and I don't know how to tell reify that it is not
> a traditional function.
>
> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must supply
> at least one argument for 'this' in: IsReusable
>
> Okay, I supply 'this' for IsReusable
>
> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
> define method not in interfaces: IsReusable
>
>
>  --
> --
> 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: [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 one argument for 'this' in: get_IsReusable

If I supply 'this' in the arg list for get_IsReusable I get another error
(which is correct because get_IsReusable is a zero arg function):

CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't define
method not in interfaces: get_IsReusable





On Mon, Dec 9, 2013 at 12:15 PM, John D. Hume wrote:

> 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 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 "System.Web")
>>
>> (defn foo-handler []
>> (reify System.Web.IHttpHandler
>>  (IsReusable [] false)
>> (ProcessRequest [context] (
>>
>> IsReusable is a property and I don't know how to tell reify that it is
>> not a traditional function.
>>
>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must
>> supply at least one argument for 'this' in: IsReusable
>>
>> Okay, I supply 'this' for IsReusable
>>
>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
>> define method not in interfaces: IsReusable
>>
>>
>>  --
>> --
>> 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: [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 PM, Frank Hale  wrote:

> 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 one argument for 'this' in: get_IsReusable
>
> If I supply 'this' in the arg list for get_IsReusable I get another error
> (which is correct because get_IsReusable is a zero arg function):
>
> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
> define method not in interfaces: get_IsReusable
>
>
>
>
>
> On Mon, Dec 9, 2013 at 12:15 PM, John D. Hume wrote:
>
>> 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 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 "System.Web")
>>>
>>> (defn foo-handler []
>>> (reify System.Web.IHttpHandler
>>>  (IsReusable [] false)
>>> (ProcessRequest [context] (
>>>
>>> IsReusable is a property and I don't know how to tell reify that it is
>>> not a traditional function.
>>>
>>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must
>>> supply at least one argument for 'this' in: IsReusable
>>>
>>> Okay, I supply 'this' for IsReusable
>>>
>>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
>>> define method not in interfaces: IsReusable
>>>
>>>
>>>  --
>>> --
>>> 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: [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 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 PM, Frank Hale  wrote:
>
>> 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 one argument for 'this' in: get_IsReusable
>>
>> If I supply 'this' in the arg list for get_IsReusable I get another error
>> (which is correct because get_IsReusable is a zero arg function):
>>
>> CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
>> define method not in interfaces: get_IsReusable
>>
>>
>>
>>
>>
>> On Mon, Dec 9, 2013 at 12:15 PM, John D. Hume 
>> wrote:
>>
>>> 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 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 "System.Web")

 (defn foo-handler []
 (reify System.Web.IHttpHandler
  (IsReusable [] false)
 (ProcessRequest [context] (

 IsReusable is a property and I don't know how to tell reify that it is
 not a traditional function.

 CompilerException clojure.lang.CljCompiler.Ast.ParseException: Must
 supply at least one argument for 'this' in: IsReusable

 Okay, I supply 'this' for IsReusable

 CompilerException clojure.lang.CljCompiler.Ast.ParseException: Can't
 define method not in interfaces: IsReusable


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


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 that comes from demands of performance: algorithms become 
more brittle and harder to understand when they must be rewritten for a 
denormalized data structure, for example.

But does this infrastructure exist in the real world? I'm aware of various 
efforts to provide relational modeling in the application, LINQ, datomic, 
etc. But I haven't seen much in the way of indexing support, or support for 
logical/physical schema separation. Is there some obvious way to do these? 
Indexing in particular is critical. Hierarchical modeling provides very 
fast look-up. Switching to a relational model without indexes would mean 
potentially scanning millions of rows for every data access.

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


[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 apparent from your code and errors are clearly
reported. And the whole library is well under 500 loc.

-- 
-- 
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] 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 pattern matching (with first-class patterns), validators, 
> parsers, walks and lenses (and eventually generators). The shape of your 
> data is immediately apparent from your code and errors are clearly 
> reported. And the whole library is well under 500 loc.
>

-- 
-- 
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: 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 compiling the result into efficient sql that acts
over normalised tables.


On 9 December 2013 17:56, Brian Craft  wrote:

> 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 that comes from demands of performance: algorithms
> become more brittle and harder to understand when they must be rewritten
> for a denormalized data structure, for example.
>
> But does this infrastructure exist in the real world? I'm aware of various
> efforts to provide relational modeling in the application, LINQ, datomic,
> etc. But I haven't seen much in the way of indexing support, or support for
> logical/physical schema separation. Is there some obvious way to do these?
> Indexing in particular is critical. Hierarchical modeling provides very
> fast look-up. Switching to a relational model without indexes would mean
> potentially scanning millions of rows for every data access.
>
> --
> --
> 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] 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 
> take part in presentations and workshops about functional programming 
> languages and applications.
>
> Recursd will be held in Central San Diego at the Ansir Innovation Center.
>
> Registrationis
>  $10 before Jan 4, 2014, and $20 after.
>
> Presenters receive free admission. To submit a proposal, contact us at: 
> rec...@gmail.com 
>
> Hope to see you there!
>
> Ron
>

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


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 []]
validators
)))

The following call (def foo group) returns a function. All as I'd expect. I 
then thought I'd replace the anonymous function with a named function...

(defn validate
  [maps f]
  (let [[m error-m] maps
[new-map errors] (f m)]
[new-map (vec (flatten (if errors (conj error-m errors) error-m)))]))


(defn group2 
  [& validators]
  (fn [m]
(reduce validate
[m []]
validators
)))
The following call (def foo group2) returns an empty vector. I would have 
though it would have returned a function. Am I missing something?

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 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: 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 [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 []]
> validators
> )))
>
> The following call (def foo group) returns a function. All as I'd expect.
> I then thought I'd replace the anonymous function with a named function...
>
> (defn validate
>   [maps f]
>   (let [[m error-m] maps
> [new-map errors] (f m)]
> [new-map (vec (flatten (if errors (conj error-m errors) error-m)))]))
>
>
> (defn group2
>   [& validators]
>   (fn [m]
> (reduce validate
> [m []]
> validators
> )))
> The following call (def foo group2) returns an empty vector. I would have
> though it would have returned a function. Am I missing something?
>
> 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
> 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: 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 
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: 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 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 compiling the result into efficient sql that acts 
> over normalised tables.
>
>
> On 9 December 2013 17:56, Brian Craft >wrote:
>
>> 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 that comes from demands of performance: algorithms 
>> become more brittle and harder to understand when they must be rewritten 
>> for a denormalized data structure, for example.
>>
>> But does this infrastructure exist in the real world? I'm aware of 
>> various efforts to provide relational modeling in the application, LINQ, 
>> datomic, etc. But I haven't seen much in the way of indexing support, or 
>> support for logical/physical schema separation. Is there some obvious way 
>> to do these? Indexing in particular is critical. Hierarchical modeling 
>> provides very fast look-up. Switching to a relational model without indexes 
>> would mean potentially scanning millions of rows for every data access.
>>  
>> -- 
>> -- 
>> 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=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_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: 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 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.


[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 doesn't appear to do anything.

running lein uberjar works but I can't run the resulting jar's because they
don't have a main manifest attribute.

running lein test results in the following message:

"Error: Could not find or load main class clojure.main
Tests failed."

There is little to no information on the usage or status of this package.
Is this working yet?

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


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 [int] int]]))
> (defn -testing [x] (* x 2))


Program.cs:

using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.Threading.Tasks;
> namespace ConsoleApplication1
> {
> class Program
> {
> static void Main(string[] args)
> {
> var namespace = new my.namespace();
> namespace.testing(2);
> Console.ReadLine();
> }
> }
> }
>
 

> System.TypeInitializationException was unhandled
>   HResult=-2146233036
>   Message=The type initializer for 'my.namespace' threw an exception.
>   Source=log-analysis
>   TypeName=my.namespace
>   StackTrace:
>at my.namespace..ctor()
>at ConsoleApplication1.Program.Main(String[] args) in 
> c:\Users\jjelinek\Documents\Visual Studio 
> 2012\Projects\log-analysis\ConsoleApplication1\Program.cs:line 13
>at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, 
> String[] args)
>at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
> assemblySecurity, String[] args)
>at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>at System.Threading.ExecutionContext.RunInternal(ExecutionContext 
> executionContext, ContextCallback callback, Object state, Boolean 
> preserveSyncCtx)
>at System.Threading.ExecutionContext.Run(ExecutionContext 
> executionContext, ContextCallback callback, Object state, Boolean 
> preserveSyncCtx)
>at System.Threading.ExecutionContext.Run(ExecutionContext 
> executionContext, ContextCallback callback, Object state)
>at System.Threading.ThreadHelper.ThreadStart()
>   InnerException: System.IO.FileLoadException
>HResult=-2146234304
>Message=Could not load file or assembly 'Clojure, Version=1.4.0.0, 
> Culture=neutral, PublicKeyToken=d0a477b1756ef34d' or one of its 
> dependencies. The located assembly's manifest definition does not match the 
> assembly reference. (Exception from HRESULT: 0x80131040)
>Source=log-analysis
>FileName=Clojure, Version=1.4.0.0, Culture=neutral, 
> PublicKeyToken=d0a477b1756ef34d
>FusionLog Pre-bind state information ===
> LOG: DisplayName = Clojure, Version=1.4.0.0, Culture=neutral, 
> PublicKeyToken=d0a477b1756ef34d
>  (Fully-specified)
> LOG: Appbase = file:///C:/Users/jjelinek/documents/visual studio 
> 2012/Projects/log-analysis/ConsoleApplication1/bin/Debug/
> LOG: Initial PrivatePath = NULL
> Calling assembly : log-analysis, Version=0.0.0.0, Culture=neutral, 
> PublicKeyToken=null.
> ===
> LOG: This bind starts in default load context.
> LOG: Using application configuration file: 
> C:\Users\jjelinek\documents\visual studio 
> 2012\Projects\log-analysis\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config
> LOG: Using host configuration file: 
> LOG: Using machine configuration file from 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Post-policy reference: Clojure, Version=1.4.0.0, Culture=neutral, 
> PublicKeyToken=d0a477b1756ef34d
> LOG: Attempting download of new URL 
> file:///C:/Users/jjelinek/documents/visual studio 
> 2012/Projects/log-analysis/ConsoleApplication1/bin/Debug/Clojure.DLL.
> WRN: Comparing the assembly name resulted in the mismatch: Minor Version
> ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing 
> terminated.
>StackTrace:
> at my.namespace..cctor()
>InnerException: 


-- 
-- 
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: 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 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 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 compiling the result into efficient sql that acts
>> over normalised tables.
>>
>>
>> On 9 December 2013 17:56, Brian Craft  wrote:
>>
>>> 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 that comes from demands of performance: algorithms
>>> become more brittle and harder to understand when they must be rewritten
>>> for a denormalized data structure, for example.
>>>
>>> But does this infrastructure exist in the real world? I'm aware of
>>> various efforts to provide relational modeling in the application, LINQ,
>>> datomic, etc. But I haven't seen much in the way of indexing support, or
>>> support for logical/physical schema separation. Is there some obvious way
>>> to do these? Indexing in particular is critical. Hierarchical modeling
>>> provides very fast look-up. Switching to a relational model without indexes
>>> would mean potentially scanning millions of rows for every data access.
>>>
>>> --
>>> --
>>> 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=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_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: 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 a normalised view over a denormalised database.


On 10 December 2013 01:57, Jamie Brandon wrote:

> 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 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 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 compiling the result into efficient sql that acts
>>> over normalised tables.
>>>
>>>
>>> On 9 December 2013 17:56, Brian Craft  wrote:
>>>
  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 that comes from demands of performance: algorithms
 become more brittle and harder to understand when they must be rewritten
 for a denormalized data structure, for example.

 But does this infrastructure exist in the real world? I'm aware of
 various efforts to provide relational modeling in the application, LINQ,
 datomic, etc. But I haven't seen much in the way of indexing support, or
 support for logical/physical schema separation. Is there some obvious way
 to do these? Indexing in particular is critical. Hierarchical modeling
 provides very fast look-up. Switching to a relational model without indexes
 would mean potentially scanning millions of rows for every data access.

 --
 --
 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=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_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: 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 without building up an 
> intermediate representation. It seems to me that the same technique should 
> work for a normalised view over a denormalised database.
>
>
> On 10 December 2013 01:57, Jamie Brandon 
> 
> > wrote:
>
>> 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 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 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 compiling the result into efficient sql that acts 
 over normalised tables.


 On 9 December 2013 17:56, Brian Craft  wrote:

>  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 that comes from demands of performance: 
> algorithms 
> become more brittle and harder to understand when they must be rewritten 
> for a denormalized data structure, for example.
>
> But does this infrastructure exist in the real world? I'm aware of 
> various efforts to provide relational modeling in the application, LINQ, 
> datomic, etc. But I haven't seen much in the way of indexing support, or 
> support for logical/physical schema separation. Is there some obvious way 
> to do these? Indexing in particular is critical. Hierarchical modeling 
> provides very fast look-up. Switching to a relational model without 
> indexes 
> would mean potentially scanning millions of rows for every data access.
>  
> -- 
> -- 
> 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=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_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=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_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: 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 error :
 'neostore' does not contain a store version, please ensure that the
original database was shut down in a clean state.


Can you please advice what can be done on that and how should i proceed
further?

Many Thanks,

Kind Regards
Himakshi


On Sat, Dec 7, 2013 at 1:15 AM, Joseph Guhlin wrote:

> Glad it worked, if you have any further questions feel free to ask. I'm
> using it extensively and it and Clojure seem to be a perfect match these
> days, especially on very large datasets.
>
> --Joseph
>
>
> On Friday, December 6, 2013 12:56:40 AM UTC-6, Himakshi Mangal wrote:
>>
>> Hi Joseph Guhlin,
>>
>> Thanks your idea helped and i could send some sample data to my neo4j
>> database.
>>
>> Thank you very much... :)
>>
>>
>> On Monday, December 2, 2013 3:41:53 PM UTC+5:30, Himakshi Mangal wrote:
>>>
>>> Hi...
>>>
>>>
>>> I am using clojure to import dbpedia data into neo4j.
>>>
>>> Here's the code:
>>> (ns opal.dbpedia
>>>   (:use [clojure.tools.logging :only [log]])
>>>   (:require [clojure.java.io :as io])
>>>   (:import [uk.ac.manchester.cs.owl.owlapi.turtle.parser TurtleParser]
>>>[org.neo4j.unsafe.batchinsert BatchInserters]
>>>[org.neo4j.graphdb DynamicRelationshipType]))
>>>
>>> ;; PARSING METHODS
>>>
>>> (defn get-next-tuple
>>>   [parser]
>>>   (let [last-item (atom nil)
>>> tuple (atom [])]
>>> (while (and (not= "." @last-item)
>>> (not= "" @last-item))
>>>   (reset! last-item
>>>   (-> parser
>>> (.getNextToken)
>>> (.toString)))
>>>   (swap! tuple conj @last-item))
>>> (when-not (empty? (first @tuple)) ; .getNextToken returns "" once
>>> you are out of data
>>>   @tuple)))
>>>
>>> (defn seq-of-parser
>>>   [parser]
>>>   (if-let [next-tuple (get-next-tuple parser)]
>>> (lazy-cat [next-tuple]
>>>   (seq-of-parser parser
>>>
>>> (defn parse-file
>>>   [filename]
>>>   (seq-of-parser
>>> (TurtleParser.
>>>   (io/input-stream filename
>>>
>>> ;; BATCH UPSERT METHODS
>>>
>>> (def id-map (atom nil))
>>> (defn insert-resource-node!
>>>   [inserter res]
>>>   (if-let [id (get @id-map res)]
>>> ; If the resource has aleady been added, just return the id.
>>> id
>>> ; Otherwise, add the node for the node, and remember its id for
>>> later.
>>> (let [id (.createNode inserter {"resource" res})]
>>>   (swap! id-map #(assoc! % res id))
>>>   id)))
>>>
>>> (defn connect-resource-nodes!
>>>   [inserter node1 node2 label]
>>>   (let [relationship (DynamicRelationshipType/withName label)]
>>> (.createRelationship inserter node1 node2 relationship nil)))
>>>
>>> (defn insert-tuple!
>>>   [inserter tuple]
>>>   ; Get the resource and label names out of the tuple.
>>>   (let [[resource-1 label resource-2 & _ ] tuple
>>> ; Upsert the resource nodes.
>>> node-1 (insert-resource-node! inserter resource-1)
>>> node-2 (insert-resource-node! inserter resource-2)]
>>> ; Connect the nodes with an edge.
>>> (connect-resource-nodes! inserter node-1 node-2 label)))
>>>
>>> (defn -main [graph-path & files]
>>>   (let [inserter (BatchInserters/inserter graph-path)]
>>> (doseq [file files]
>>>   (log :debug (str "Loading file: " file))
>>>   (let [c (atom 0)]
>>> (doseq [tuple (parse-file file)]
>>>   (if (= (mod @c 1) 0)
>>> (log :debug (str file ": " @c)))
>>>   (swap! c inc)
>>>   (insert-tuple! inserter tuple
>>> (log :debug "Loading complete.")
>>> (log :debug "Shutting down.")
>>> (.shutdown inserter)
>>> (log :debug "Shutdown complete!")))
>>>
>>> I am getting the following errors:
>>>
>>> IllegalAccessError Transient used by non-owner thread  clojure.lang.
>>> PersistentArrayMap$TransientArrayMap.ensureEditable
>>> (PersistentArrayMap.java:449)
>>>
>>> &&
>>>
>>>
>>> IllegalArgumentException No matching method found: createNode for class
>>> org.neo4j.unsafe.batchinsert.BatchInserterImpl  clojure.lang.Reflector.
>>> invokeMatchingMethod
>>>
>>>
>>> Can anyone please help me in this.. Am doing something wrong or am i
>>> missing something.. I am completely new to clojure. Is there a working
>>> example for this?
>>>
>>>
>>> Please help..
>>>
>>> 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
>