swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax and use of ObjectLoader i/o files


From: Marcus G. Daniels
Subject: Re: Syntax and use of ObjectLoader i/o files
Date: 11 Sep 1999 10:21:29 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "WS" == William S Shu <address@hidden> writes:

WS> 3) How can I adapt input files to take simple arithmetic
WS> expressions (.e.g.  1.0/365): this is necesseary for documentation
WS> purpose, as well as ease entry of "derived" data for separate
WS> runs.

You might take a look at Sugarscape for Swarm 2.0.¹
  
In particular, the file hdf5.R.  This shows how to read and transform
a text file in R² and save it as HDF5³ for loading in to Swarm as a 
Discrete2d.  (In this case, the data is a lattice of sugar density values.)

$ R -q
> source("hdf5.R")
Read 2500 items
> image(m)
> m * 1.0/365
> ^D
Save workspace image? [y/n/c]: n
$ make EXTRACPPFLAGS=-DUSE_HDF5
$ ./sss

(Compare the result of "image(m)" with the Sugarspace map in Swarm.)

So, one way to get expressions like "1.0/365" is to put those
expressions in a R program and save the transformed output data to
HDF5 for Swarm.  R is a fully programmable interpreted environment
which has variety of data structures that can be preserved in
hierarchical structures in HDF5.  These HDF5 data structures can
be resuscitated as Swarm data structures.  For example, R `data frames'
end up being represented as Maps in Swarm.

It's also possible to read and write data in Lisp format.  Take a look
at swarmapps-2.0's heatbugs and mousetrap for examples of that (the
.scm files).  The longer term goal with the Lisp format is to add a
Lisp layer (just like the Java layer) to Swarm.  The advantage of that
would be direct support for the kind of thing you mention: runtime
manipulation of code and expression evaluation.  Right now the Lisp
serialization support is just data format; it's not actually
programmable.

Note that in some sense, this is already possible with the Java layer.
One can use Java libraries like gnu.jel or gnu.expr to process
expressions, or load a whole Scheme interpreter (e.g. Kawa) into the
Java interpreter, calling Swarm features.  For a list of some these
packages, see:

  http://www.gnu.org/software/java/java-software.html 

¹ ftp://ftp.santafe.edu/pub/swarm/users-contrib/anarchy/sss-2.0.tar.gz
² http://www.ci.tuwien.ac.at/R  (a free SPlus clone)
³ http://hdf.ncsa.uiuc.edu/HDF5

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]