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 <[email protected]> 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 <[email protected]> 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 <[email protected]>
>>> 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 [email protected]
>>>> Note that posts from new members are moderated - please be patient with
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> 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 [email protected].
>>>> 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 [email protected]
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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 [email protected].
>> 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 [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.