<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>59869</integer>
    </number>
    <user>
      <string>Hasone</string>
    </user>
    <title>
      <string>gdb output</string>
    </title>
    <contents>
      <string>[Thread debugging using libthread_db enabled]
[New Thread -1214974288 (LWP 16430)]
Unknown format dispatch character,  

Program received signal SIGABRT, Aborted.
[Switching to Thread -1214974288 (LWP 16430)]
0xffffe410 in __kernel_vsyscall ()
(gdb) when
Undefined command: &quot;when&quot;.  Try &quot;help&quot;.
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7986875 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7988201 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb7cc410f in dylanZdylan_visceraZinvoke_debugger_METH ()
   from /usr/local/lib/dylan/2.4.0/x86-linux-gcc/libdylan-dylan.so.0
#4  0x080d1008 in ?? ()
#5  0xb7cdbfa0 in ?? () from /usr/local/lib/dylan/2.4.0/x86-linux-gcc/libdylan-dylan.so.0
#6  0x00000001 in ?? ()
#7  0x0809fb30 in standard_ioZstandard_ioZVstandard_outputV ()
#8  0xb7d09dc0 in ?? () from /usr/local/lib/dylan/2.4.0/x86-linux-gcc/libdylan-dylan.so.0
#9  0x00000000 in ?? ()
</string>
    </contents>
    <universal-time>
      <integer>3418408479</integer>
    </universal-time>
    <channel>
      <string>#dylan</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </paste>
  <annotation>
    <number>
      <integer>1</integer>
    </number>
    <user>
      <string>hasone</string>
    </user>
    <title>
      <string>hasone's program </string>
    </title>
    <contents>
      <string>/*

module: nerves

define variable bond-names = #[&quot;north&quot;, &quot;south&quot;, &quot;east&quot;, &quot;west&quot;];

define class &lt;nerve&gt; (&lt;Object&gt;)
  slot activation-level :: &lt;real&gt; = 0;
  slot type :: &lt;nerve-type&gt;, init-keyword: type:, init-value: make(&lt;computation&gt;);
  slot bonds :: &lt;string-table&gt; = init-bond-slot(0);
  slot bond-activated :: &lt;string-table&gt; = init-bond-slot(#f);
end class; 

define method init-bond-slot(value) =&gt; (bond-slot :: &lt;table&gt;)
  let bond-slot :: &lt;table&gt; = make(&lt;string-table&gt;);
  for(i :: &lt;integer&gt; from 0 to 3)
    bond-slot[bond-names[i]] := value;
  end for; 
  bond-slot;
end method init-bond-slot;

define method transmit-impulse(net :: &lt;neural-network&gt;, sender-coords :: &lt;sequence&gt;) 
    =&gt; (sender :: &lt;nerve&gt; )
  let sender = net.network[sender-coords[0], sender-coords[1]];
  for(i :: &lt;integer&gt; from 0 to 3)
    sender.bond-activated[bond-names[i]] := #t;
  end for;
  if(sender.bond-activated[&quot;west&quot;])
     format-out(&quot;good&quot;);
  end if;
  if(~sender.bond-activated[&quot;west&quot;])
    format-out(&quot;bad&quot;);
  end if;
  if(sender-coords[0] = 0)
    sender.bond-activated[&quot;west&quot;] := #f;
  end if;
  if(sender-coords[1] = 0)
    sender.bond-activated[&quot;south&quot;] := #f;
  end if; 
 
  if(sender-coords[0] = 5)
    sender.bond-activated[&quot;east&quot;] := #f;
  end if; 
  if(sender-coords[1] = 5)
    sender.bond-activated[&quot;north&quot;] := #f;
  end if; 
  sender;
end method transmit-impulse;

define method test-transmit-impulse()
  let net :: &lt;neural-network&gt; = make(&lt;neural-network&gt;); 
  let sender :: &lt;nerve&gt; = (net.network)[0,1];
  let test-passed :: &lt;boolean&gt; = #t;

  sender := transmit-impulse(net, #[0,1]);
  
  test-passed := sender.bond-activated[&quot;north&quot;];
  test-passed := (sender.bond-activated[&quot;west&quot;]);
  
  if(~sender.bond-activated[&quot;west&quot;])
    format-out(&quot;huh?&quot;);
  end if;
 
  test-passed := check-true(sender.bond-activated[&quot;north&quot;], &quot;N not active, should be&quot;, 
                              test-passed);

  test-passed := check-true(sender.bond-activated[&quot;east&quot;], &quot;E inactive, should be&quot;,
                              test-passed);
//the next two statements don't work, test-passed:= sender.bond-activated[&quot;west&quot;] yields the same error
  test-passed := check-true(sender.bond-activated[&quot;west&quot;], &quot;W should be active&quot;, 
                              test-passed);
 test-passed := check-true(~sender.bond-activated[&quot;south&quot;], 
                              &quot;south bond should NOT be activated&quot;, test-passed);   
 
  report(&quot;test-transmit-impulse&quot;, test-passed);
end method test-transmit-impulse;

define class &lt;neural-network&gt; (&lt;Object&gt;)
  slot network :: &lt;array&gt; = make(&lt;array&gt;, dimensions: #[6,6]);
  slot time :: &lt;integer&gt; = 0;
end class &lt;neural-network&gt;;

define method initialize(net :: &lt;neural-network&gt;, #key keywords) =&gt; (net :: &lt;neural-network&gt;)

  next-method();
  net.network := fill-network(net.network);
  net.network := initialize-special-neurons(net.network);
  net;
end method initialize;
define method fill-network(network-array :: &lt;array&gt;)
  for(i :: &lt;integer&gt; from 0 to 5)
    for(j :: &lt;integer&gt; from 0 to 5)
      network-array[i,j] := make(&lt;nerve&gt;);
    end for; 
  end for;
  network-array;
end method fill-network;
define method initialize-special-neurons(neural-network :: &lt;array&gt;)

  neural-network[0 , 0].type := make(&lt;feedback-signal&gt;); 
 
  neural-network[0 , 1].type := make(&lt;add-signal&gt;);
  neural-network[0,2].type := make(&lt;sign-flag&gt;);
  for(i :: &lt;integer&gt; from 3 to 5)
    neural-network[0 , i].type := make(&lt;binary-input&gt;);
  end for; 
  for(i :: &lt;integer&gt; from 1 to 3)
    neural-network[5,i].type := make(&lt;binary-output&gt;);
  end for;
  neural-network;
end method;

define method add-test(suite :: &lt;suite&gt;, test :: &lt;function&gt;) 
  =&gt; (suite :: &lt;sequence&gt;)
    suite.tests := add (suite.tests, test);
end method add-test;

define method check-true(predicate :: &lt;boolean&gt;, failure-message :: &lt;string&gt;, test-passed :: &lt;boolean&gt;)
  if(test-passed )
    test-passed := predicate; 
    if(~test-passed)
       format-out(failure-message);
    end if; 
  end if;
  test-passed;
end method check-true;   

define method check-equal (first-object, second-object, failure-message :: &lt;string&gt;, test-passed :: &lt;boolean&gt;)
  check-true((first-object = second-object), failure-message, test-passed);
end method check-equal;

define method report(test-name :: &lt;string&gt;, test-passed? :: &lt;boolean&gt;)
  if ( test-passed?)
    format-out(&quot;  %s passed\n&quot;, test-name);
  else
    format-out(&quot;%  s failed\n&quot;, test-name);
  end if
end method report;

</string>
    </contents>
    <universal-time>
      <integer>3418409411</integer>
    </universal-time>
    <channel>
      <string>#dylan</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </annotation>
</paste-with-annotations>