Re: 2 way transform in single definition ? unification ?

2015-07-14 Thread Jules
This does look good - I'll give it a whirl - thanks for the example :-)

Jules


On Monday, 13 July 2015 11:00:55 UTC+1, Jonathan Winandy wrote:

 To me it's a very good option.

 Given you example :

 (./pull '[org.clojure/core.logic 0.8.10])

 (ns yo (:refer-clojure :exclude [==]) (:use [clojure.core.logic]))


 (defne a-to-b [x y]
   ([ {:a {:b b :c c}} [b [c]]  ]))


 (run* [a]
   (a-to-b a [1 [2]]))

 ;#= ({:a {:b 1, :c 2}})



 On 13 July 2015 at 11:47, Gary Verhaegen gary.ve...@gmail.com 
 javascript: wrote:

 I have not used it. I'm mentioning it because you mentioned unification 
 and prolog and because you basically want a two-way function, which is what 
 was touted as the ideal use-case for core.logic when it was heavily 
 discussed on this list a few months (years?) ago.

 I'm not aware of the details of the performance tradeoffs, though. I 
 imagine it would be slower than writing both functions by hand, but I have 
 no idea how much.


 On Monday, 13 July 2015, Jules jules@gmail.com javascript: wrote:

 I haven't.

 Are you just suggesting it because I mentioned unification, or have you 
 used it and know that it might be a good fit ?

 Thanks,

 Jules

 On Monday, 13 July 2015 10:37:55 UTC+1, Gary Verhaegen wrote:

 Have you already looked at core.logic?

 On Monday, 13 July 2015, craig worrall craig@transacumen.com 
 wrote:

 You may have already discounted Java versions, but just in case  ... 
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have 
 further representations to map to in the future.

 My question - Is there a library that will allow me to define the 
 relationship between the two representations declaratively and then 
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g. 
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules

  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient 
 with your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  -- 
 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 
 javascript:
 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 javascript:
 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 javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at

Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Gary Verhaegen
Have you already looked at core.logic?

On Monday, 13 July 2015, craig worrall craig.worr...@transacumen.com
wrote:

 You may have already discounted Java versions, but just in case  ...
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further
 representations to map to in the future.

 My question - Is there a library that will allow me to define the
 relationship between the two representations declaratively and then
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g.
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules

  --
 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
 javascript:_e(%7B%7D,'cvml','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
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Jules
I haven't.

Are you just suggesting it because I mentioned unification, or have you 
used it and know that it might be a good fit ?

Thanks,

Jules

On Monday, 13 July 2015 10:37:55 UTC+1, Gary Verhaegen wrote:

 Have you already looked at core.logic?

 On Monday, 13 July 2015, craig worrall craig@transacumen.com 
 javascript: wrote:

 You may have already discounted Java versions, but just in case  ... 
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further 
 representations to map to in the future.

 My question - Is there a library that will allow me to define the 
 relationship between the two representations declaratively and then 
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g. 
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules

  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Jonathan Winandy
To me it's a very good option.

Given you example :

(./pull '[org.clojure/core.logic 0.8.10])

(ns yo (:refer-clojure :exclude [==]) (:use [clojure.core.logic]))


(defne a-to-b [x y]
  ([ {:a {:b b :c c}} [b [c]]  ]))


(run* [a]
  (a-to-b a [1 [2]]))

;#= ({:a {:b 1, :c 2}})



On 13 July 2015 at 11:47, Gary Verhaegen gary.verhae...@gmail.com wrote:

 I have not used it. I'm mentioning it because you mentioned unification
 and prolog and because you basically want a two-way function, which is what
 was touted as the ideal use-case for core.logic when it was heavily
 discussed on this list a few months (years?) ago.

 I'm not aware of the details of the performance tradeoffs, though. I
 imagine it would be slower than writing both functions by hand, but I have
 no idea how much.


 On Monday, 13 July 2015, Jules jules.gosn...@gmail.com wrote:

 I haven't.

 Are you just suggesting it because I mentioned unification, or have you
 used it and know that it might be a good fit ?

 Thanks,

 Jules

 On Monday, 13 July 2015 10:37:55 UTC+1, Gary Verhaegen wrote:

 Have you already looked at core.logic?

 On Monday, 13 July 2015, craig worrall craig@transacumen.com
 wrote:

 You may have already discounted Java versions, but just in case  ...
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further
 representations to map to in the future.

 My question - Is there a library that will allow me to define the
 relationship between the two representations declaratively and then
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g.
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


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

Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Jules
I was hoping for something in idiomatic Clojure - but I'll take a look 
 thanks.

Jules

On Monday, 13 July 2015 04:45:00 UTC+1, craig worrall wrote:

 You may have already discounted Java versions, but just in case  ... 
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further 
 representations to map to in the future.

 My question - Is there a library that will allow me to define the 
 relationship between the two representations declaratively and then 
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g. 
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Gary Verhaegen
I have not used it. I'm mentioning it because you mentioned unification and
prolog and because you basically want a two-way function, which is what was
touted as the ideal use-case for core.logic when it was heavily discussed
on this list a few months (years?) ago.

I'm not aware of the details of the performance tradeoffs, though. I
imagine it would be slower than writing both functions by hand, but I have
no idea how much.

On Monday, 13 July 2015, Jules jules.gosn...@gmail.com wrote:

 I haven't.

 Are you just suggesting it because I mentioned unification, or have you
 used it and know that it might be a good fit ?

 Thanks,

 Jules

 On Monday, 13 July 2015 10:37:55 UTC+1, Gary Verhaegen wrote:

 Have you already looked at core.logic?

 On Monday, 13 July 2015, craig worrall craig@transacumen.com wrote:

 You may have already discounted Java versions, but just in case  ...
 http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

 Craig

 On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further
 representations to map to in the future.

 My question - Is there a library that will allow me to define the
 relationship between the two representations declaratively and then
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g.
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  --
 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
 javascript:_e(%7B%7D,'cvml','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
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 2 way transform in single definition ? unification ?

2015-07-12 Thread craig worrall
You may have already discounted Java versions, but just in case  ... 
http://www.javacodegeeks.com/2013/10/java-object-to-object-mapper.html

Craig

On Monday, July 13, 2015 at 3:53:19 AM UTC+10, Jules wrote:

 Guys,

 I have an external and an internal data representation.

 I need to define transforms both ways.

 Both models are structured.

 A pair of in/out functions might look like:

 (fn [{{b :b c c:} :a}] [b [c]])

 (fn [[b [c]] {:a {:b b :c c}})

 I just typed that OTTOMH so please forgive any mistakes.

 I have about 50 of these to define and maintain and I may have further 
 representations to map to in the future.

 My question - Is there a library that will allow me to define the 
 relationship between the two representations declaratively and then 
 generate the transform functions from that single src.

 Ideally it would allow me to extend it to construct/destructure e.g. 
 joda-time class instances etc as some of my internal rep uses these.

 It feels a bit like unification in PROLOG...

 Looking forward to hearing your ideas.

 regards,


 Jules



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.