It depends on what the exact predicate is you're trying to define (if you
tell us, we might be able to suggest a way). However, I would caution
against this. It sounds like you're encoding properties into ASTs that may
be better off in a proper data structure.

On Fri, Feb 26, 2016 at 6:21 PM, Julia Tylors <[email protected]> wrote:

> How about an unofficial way? If you are to do it, how would you do it?
>
> Thanks
>
> On Fri, Feb 26, 2016 at 1:44 PM, Stefan Karpinski <[email protected]>
> wrote:
>
>> This application is a little more plausible since it's an optimization
>> and you can tolerate false negatives (functions that are actually the same
>> but appear different). There's no official way to do this but maybe Tom's
>> function helps.
>>
>> On Fri, Feb 26, 2016 at 4:42 PM, Tom Short <[email protected]>
>> wrote:
>>
>>> I'm interested in something like that, too. I only want to rerun parts
>>> of calculations if functions change or if input data has changed. Here's
>>> what I came up with to check functions:
>>>
>>> https://github.com/tshort/Make.jl/blob/master/src/Make.jl#L43-L49
>>>
>>> It's probably not right but it's working reasonably well for me, at
>>> least for anonymous functions. Changes in Julia v0.5 will probably change
>>> this. I'm currently wrestling with how to maintain some state between Julia
>>> sessions.
>>>
>>>
>>>
>>>
>>> On Fri, Feb 26, 2016 at 3:18 PM, Julia Tylors <[email protected]>
>>> wrote:
>>>
>>>> to check whether they are equal so that i don't need to make them go
>>>> through another of my operations to save time. That way it will be cached.
>>>>
>>>> On Friday, February 26, 2016 at 12:16:18 PM UTC-8, Stefan Karpinski
>>>> wrote:
>>>>>
>>>>> Why?
>>>>>
>>>>> On Fri, Feb 26, 2016 at 3:14 PM, Julia Tylors <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> This was a nice question,
>>>>>> i think i am trying to figure out a way to check if 2 functions
>>>>>> (partial possibly) are  at the same syntactic location in the AST and 
>>>>>> their
>>>>>> free variables refer to the equal/same data
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Friday, February 26, 2016 at 12:02:30 PM UTC-8, Stefan Karpinski
>>>>>> wrote:
>>>>>>>
>>>>>>> What are you trying to discover about these functions?
>>>>>>>
>>>>>>> On Fri, Feb 26, 2016 at 2:50 PM, Julia Tylors <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Isn't there a trick like i can serialize a partial function and
>>>>>>>> then check their equality in the serialized form?
>>>>>>>>
>>>>>>>> On Friday, February 26, 2016 at 11:22:37 AM UTC-8, Stefan Karpinski
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Functions are compared by identity – they are equal if they are
>>>>>>>>> the same function, and not otherwise. Comparing functions 
>>>>>>>>> syntactically is
>>>>>>>>> shallow and nearly useless. Comparing functions by what they compute 
>>>>>>>>> is
>>>>>>>>> undecidable. So identity is essentially the only useful way to compare
>>>>>>>>> functions.
>>>>>>>>>
>>>>>>>>> On Fri, Feb 26, 2016 at 2:09 PM, Julia Tylors <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> I have a simple question. I like to compare functions. For
>>>>>>>>>> example:
>>>>>>>>>>
>>>>>>>>>> function some_func(x::Target, y::Config, z::Int64)
>>>>>>>>>>    #some code here
>>>>>>>>>> end
>>>>>>>>>>
>>>>>>>>>> #some partialization here
>>>>>>>>>> f1 = (x::Target,y::Config) -> some_func(x,y,5)
>>>>>>>>>> f2 = (x::Target,y::Config) -> some_func(x,y,4)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I want to evaluate the following expression:
>>>>>>>>>>
>>>>>>>>>> f1 == f2
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>
>>>
>>
>

Reply via email to