@@ -59,6 +59,7 @@ public void actionPerformed(ActionEvent arg0) {
5959 public void load (PrimitiveManager primitiveManager ) throws ExtensionException {
6060 primitiveManager .addPrimitive ("ask" , new Ask ());
6161 primitiveManager .addPrimitive ("of" , new Of ());
62+ primitiveManager .addPrimitive ("report" , new Report ());
6263 primitiveManager .addPrimitive ("load-headless-model" , new LoadModel <HeadlessChildModel >(HeadlessChildModel .class ));
6364 primitiveManager .addPrimitive ("load-gui-model" , new LoadModel <GUIChildModel >(GUIChildModel .class ));
6465 primitiveManager .addPrimitive ("name-of" , new ModelName ());
@@ -270,6 +271,31 @@ public Object report(Argument args[], Context context) throws LogoException, Ext
270271 }
271272 }
272273
274+ public static class Report extends DefaultReporter {
275+ @ Override
276+ public Syntax getSyntax () {
277+ return Syntax .reporterSyntax (
278+ new int []{
279+ Syntax .NumberType () | Syntax .ListType (),
280+ Syntax .ReporterTaskType () | Syntax .StringType (),
281+ Syntax .WildcardType () | Syntax .RepeatableType ()
282+ },
283+ Syntax .WildcardType (),
284+ 2
285+ );
286+ }
287+ public Object report (Argument args [], Context context ) throws LogoException , ExtensionException {
288+ LogoListBuilder results = new LogoListBuilder ();
289+ String reporter = args [1 ].getString ();
290+ Object [] actuals = getActuals (args , 2 );
291+ for (ChildModel model : toModelList (args [0 ])){
292+ results .add (model .of (reporter , actuals ));
293+ }
294+ LogoList returnValue = results .toLogoList ();
295+ return args [0 ].get () instanceof Double ? returnValue .first () : returnValue ;
296+ }
297+ }
298+
273299 public static void askDescendant (LogoList modelTreePath , String command , Object [] args ) throws ExtensionException , HaltException {
274300 ChildModel child = getModel (castToId (modelTreePath .first ()));
275301 if (modelTreePath .size () == 1 ) {
0 commit comments