Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/tests/vis15-bugs/gst2a.diderot
ViewVC logotype

View of /branches/vis15/src/tests/vis15-bugs/gst2a.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4497 - (download) (annotate)
Sat Sep 3 14:12:36 2016 UTC (2 years, 8 months ago) by jhr
File size: 903 byte(s)
  working on merge: updating tests with new version 2 syntax
#version 2

/*
Compiling with vis15 r4464 the attached program generates:

[gst2a.diderot:29.8-10] Warning: local variable 'dd' is unused
uncaught exception Fail [Fail: unknown or incorrect operator Strands<id(S),all>]
 raised at common/phase-timer.sml:78.57-78.59
 raised at cxx-util/tree-to-cxx.sml:229.26-231.20
*/
/*const*/ int N = 10;
real target = 0.0;

strand S (int i) {
  output real e = i;
  real delta = 0;

  update {
    delta = (target - e)/2;
    print (i, ": e = ", e, ", delta = ", delta, "\n");
    if (|delta| < 0.001) {
	stabilize;
    } else {
	e += delta;
    }
  }

}

create_collection { S(i) | i in 1..N }

start {
  target = mean { p.e | p in S.all };
  print("initially: target = ", target, "\n");
}

update {
  target = sum { p.e | p in S.all } / N;
  real dd = mean { p.delta | p in S.all };
  print("update: target = ", target, "\n");
  print("update: dd = ", dd, "\n");
}

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0