[erlang-questions] Unable to call functions that are in a module in the same location

Yves S. Garret yoursurrogategod@REDACTED
Fri Sep 5 03:39:17 CEST 2014


Hi,

Thanks for your reply.  You're right, I did screw that up.  This is after I
made the proper fix:

6> genotype:test().
Morphology: xor_mimic
{aborted,{undef,[{random,unifrom,[],[]},
                 {genotype,construct_InitialNeurons,6,
                           [{file,"genotype.erl"},{line,101}]},
                 {genotype,construct_InitialNeuroLayer,7,
                           [{file,"genotype.erl"},{line,84}]},
                 {genotype,construct_Cortex,3,
                           [{file,"genotype.erl"},{line,51}]},
                 {genotype,construct_Agent,3,
                           [{file,"genotype.erl"},{line,20}]},
                 {genotype,'-test/0-fun-0-',0,
                           [{file,"genotype.erl"},{line,420}]},

{mnesia_tm,apply_fun,3,[{file,"mnesia_tm.erl"},{line,830}]},
                 {mnesia_tm,execute_transaction,5,
                            [{file,"mnesia_tm.erl"},{line,810}]}]}}

I kept digging in here and then this is what I've found.  The AgentId (in
test/0) is set to test.  However, when the attempt is made to retrieve it,
obviously, it gives me the above error.

I think I need to keep reading and try to better understand what Gene Sher
is trying to pull together here.


On Thu, Sep 4, 2014 at 1:27 PM, Gustavo Pires <devgutt@REDACTED> wrote:

> You shouldn't be using the record #actuator instead of #sensor in
> xor_mimic(actuators)? There is a error in construct_Cortex because of this
>
> xor_mimic(sensors) ->
>   [#sensor{name = xor_GetInput, scape = {private, xor_sim}, vl = 2}];
> xor_mimic(actuators) ->
>   [#sensor{name = xor_SendOutput, scape = {private, xor_sim}, vl = 1}].
>
>
> On Wed, Sep 3, 2014 at 9:43 PM, Yves S. Garret <yoursurrogategod@REDACTED
> > wrote:
>
>> Hello,
>>
>> I completely forgot about this problem.
>>
>> Here are some more files that will hopefully get rid of some of the
>> confusion:
>> records.hrl:
>> http://textsnip.com/a148rx
>> polis.erl:
>> http://textsnip.com/bk8xao
>> morphology.erl:
>> http://textsnip.com/8rlag9
>> genotype.erl:
>> http://textsnip.com/ax1n49
>>
>> Let me know if there's anything else that I can hopefully shed light on.
>>
>>
>> On Sun, Aug 17, 2014 at 9:59 PM, Gustavo Pires <devgutt@REDACTED> wrote:
>>
>>> Where's the code of construct_Agent(Specie_Id, Agent_Id, SpecCon)? You
>>> only sent construct_Cortex. Probably the problem is there.
>>>
>>>
>>> On Sun, Aug 17, 2014 at 1:31 PM, Steve Strong <steve@REDACTED>
>>> wrote:
>>>
>>>>  The record will be initialised with the defaults as specified in the
>>>> hrl.  The code and stacktrace in the gist still suggest that
>>>> SpecCon#constraint.morphology is ‘undefined’ - so something between the
>>>> record construction below and the crash within the gist must be modifying
>>>> the record.
>>>>
>>>> --
>>>> Steve Strong
>>>> Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
>>>>
>>>>  On Sunday, 17 August 2014 at 15:36, Yves S. Garret wrote:
>>>>
>>>> The record in question is "constraint".  The thing is, when I call it,
>>>> it looks like this with none of the values initialized:
>>>>
>>>> test() ->
>>>>   Specie_Id = test,
>>>>   Agent_Id = test,
>>>>   CloneAgent_Id = test_clone,
>>>>   SpecCon = #constraint{}, % <---- HERE IS WHERE THE FIRST INSTANCE IS
>>>> CREATED
>>>>   F = fun() ->
>>>>     construct_Agent(Specie_Id, Agent_Id, SpecCon),
>>>>     clone_Agent(Specie_Id, CloneAgent_Id),
>>>>     print(Agent_Id),
>>>>     print(CloneAgent_Id),
>>>>     delete_Agent(Agent_Id),
>>>>     delete_Agent(CloneAgent_Id)
>>>>   end,
>>>>
>>>>   mnesia:transaction(F).
>>>>
>>>> My question is thus, if I make a record with #constraint{}, does that
>>>> mean that all of its values are by default set to undefined or the default
>>>> values that were specified in records.hrl?
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Aug 16, 2014 at 2:35 AM, Steve Strong <steve@REDACTED>
>>>> wrote:
>>>>
>>>> I'm guessing that this:
>>>>
>>>>   Morphology = SpecCon#constraint.morphology,
>>>>
>>>>
>>>>
>>>>
>>>> Is setting Morphology to 'undefined' - that's what the stack trace
>>>> looks to be saying.
>>>>
>>>> Cheers,
>>>>
>>>> Steve
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On 16 Aug 2014, at 04:54, "Yves S. Garret" <yoursurrogategod@REDACTED>
>>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> This is my code:
>>>> https://gist.github.com/anonymous/5b9b2c55a7684f5386e2
>>>>
>>>> When I run my code inside of erlang (17.0), this is the error that I
>>>> get:
>>>> 7> genotype:create_test().
>>>> {aborted,{undef,[{morphology,undefined,[sensors],[]},
>>>>                  {morphology,get_InitSensors,1,
>>>>                              [{file,"morphology.erl"},{line,8}]},
>>>>                  {genotype,construct_Cortex,3,
>>>>                            [{file,"genotype.erl"},{line,41}]},
>>>>                  {genotype,construct_Agent,3,
>>>>                            [{file,"genotype.erl"},{line,20}]},
>>>>                  {genotype,'-create_test/0-fun-0-',0,
>>>>                            [{file,"genotype.erl"},{line,434}]},
>>>>
>>>> {mnesia_tm,apply_fun,3,[{file,"mnesia_tm.erl"},{line,833}]},
>>>>                  {mnesia_tm,execute_transaction,5,
>>>>                             [{file,"mnesia_tm.erl"},{line,813}]},
>>>>
>>>> {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,661}]}]}}
>>>>
>>>> genotype.erl and morphology.erl are in the directory, so why can't
>>>> genotype's function call morphology's functions?  Or am I missing something
>>>> else entirely?
>>>>
>>>> Thanks.
>>>>
>>>> _______________________________________________
>>>>
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140904/7db9b7aa/attachment.htm>


More information about the erlang-questions mailing list