[polyml] Run polyml in the broswer

2020-10-20 Thread David Topham
Thanks to Fabrice Bellard (of QEMU fame) for his wonderful work on JSLinux,
we can now run Alpine Linux in modern browsers using Javascript and
Webassembly to support a virtual x86 machine.

I installed polyml in the Alpine Linux users home directory, so now anyone
can run polyml in their browser.  Try it! (it takes a few seconds to boot
up)

https://bellard.org/jslinux/vm.html?url=alpine-x86-xwin.cfg=1024=1_url=https://vfsync.org/u/polyml/pub
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] Install to users home directory

2020-10-20 Thread David Topham
Thanks Phil, I found I needed to set
LD_LIBRARY_PATH as well as PATH to $HOME to use interpreter.
I really appreciate the helpful information from this community!

On Tue, Oct 20, 2020 at 4:00 AM  wrote:

> Send polyml mailing list submissions to
> polyml@inf.ed.ac.uk
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
> or, via email, send a message with subject or body 'help' to
> polyml-requ...@inf.ed.ac.uk
>
> You can reach the person managing the list at
> polyml-ow...@inf.ed.ac.uk
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of polyml digest..."
>
>
> Today's Topics:
>
>1. Re: Install to users home directory (Phil Clayton)
>2. Re: polyml install to Alpine Linux (David Matthews)
>
>
> --
>
> Message: 1
> Date: Tue, 20 Oct 2020 10:12:37 +0100
> From: Phil Clayton 
> To: polyml@inf.ed.ac.uk
> Subject: Re: [polyml] Install to users home directory
> Message-ID: <090b6bb7-106a-eb9e-0732-2b00a050e...@veonix.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 20/10/20 05:40, David Topham wrote:
> > I know it is most efficient to install software system wide so all users
> > share same code. But I have a situation where I want to install only to
> > my home directory. i.e. It is Linux system where I don't have sudo
> > privilege.
> > Is that possible?
> > I am building from source, so perhaps
> > ./configure ?--prefix=$HOME
> > make
> > make install
> >
> > Or does polyml have too many dependencies on other system libraries to
> > make that impractical?
>
> You can specify any prefix to install to - this does not affect how
> dependencies are found.  However, depending on your choice of prefix,
> you may need to manually add /bin to PATH.  Depending on your
> Linux distribution, it would probably be more idiomatic to do a per-user
> install to
>$HOME/.local
> to avoid cluttering the home directory.  Also, if you have Poly/ML
> installed system-wide via the package manager, you would need to make
> sure that /bin occurs in the path before the system bin
> directory, to ensure your user version is found first.
>
> There are some instructions previously posted here:
> http://lists.inf.ed.ac.uk/pipermail/polyml/2017-July/002038.html
> which also show how to disable the package manager version of Poly/ML on
> Fedora.
>
> Phil
>
>
> --
>
> Message: 2
> Date: Tue, 20 Oct 2020 11:56:55 +0100
> From: David Matthews 
> To: polyml@inf.ed.ac.uk
> Subject: Re: [polyml] polyml install to Alpine Linux
> Message-ID: <5bca1bc6-063e-b199-65f1-31e259038...@prolingua.co.uk>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 19/10/2020 21:08, David Matthews wrote:
> >> Yes, using .data.rel.ro., i.e. relocatable read-only data.
> >
> > Thanks, Jess.? That seems to work, at least on SELinux and Alpine.
> > OpenBSD seems to still want it to be writeable.
>
> I've now changed the ELF exporter to write the data to .data.rel.ro.
> The byte code interpreted version (--disable-native-codegeneration) now
> builds without a problem on Alpine Linux and on SELinux with hardening
> turned on.  That isn't a complete solution because it doesn't deal with
> native code but it does show that if code could be handled everything
> else will work.
>
> I see this primarily as future-proofing Poly/ML.  It's not unlikely that
> a future release of, say Mac OS X, might outlaw TEXTRELs.
>
> David
>
>
> --
>
> Subject: Digest Footer
>
> ___
> polyml mailing list
> polyml@inf.ed.ac.uk
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
>
> --
>
> End of polyml Digest, Vol 168, Issue 9
> **
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] Install to users home directory

2020-10-19 Thread David Topham
I know it is most efficient to install software system wide so all users
share same code. But I have a situation where I want to install only to my
home directory. i.e. It is Linux system where I don't have sudo privilege.
Is that possible?
I am building from source, so perhaps
./configure  --prefix=$HOME
make
make install

Or does polyml have too many dependencies on other system libraries to make
that impractical?
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] polyml install to Alpine Linux

2020-10-17 Thread David Topham
Thanks Stefan!  Brilliant!  It is so nice to have a supportive community to
build software with!

That did it:  no-pie


On Sat, Oct 17, 2020 at 2:41 PM  wrote:

> Send polyml mailing list submissions to
> polyml@inf.ed.ac.uk
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
> or, via email, send a message with subject or body 'help' to
> polyml-requ...@inf.ed.ac.uk
>
> You can reach the person managing the list at
> polyml-ow...@inf.ed.ac.uk
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of polyml digest..."
>
>
> Today's Topics:
>
>1. Re: polyml Digest, Vol 168, Issue 4 (David Topham)
>
>
> ------
>
> Message: 1
> Date: Sat, 17 Oct 2020 14:39:11 -0700
> From: David Topham 
> To: polyml@inf.ed.ac.uk
> Subject: Re: [polyml] polyml Digest, Vol 168, Issue 4
> Message-ID:
>  sbpr9pjxowms6h...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Thank you for the quick response. That is useful to know. Perhaps my
> original download of source was corrupt. I tried again this time use the
> polyml-master.zip *from github" and that made it much further.
>
> I think it may be almost complete, but got a segment fault at the last
> minute.
>
> make  all-recursive
> make[1]: Entering directory '/root/polyml-master'
> Making all in libpolyml
> make[2]: Entering directory '/root/polyml-master/libpolyml'
> Making all in libffi
> make[3]: Entering directory '/root/polyml-master/libpolyml/libffi'
> make 'AR_FLAGS=' 'CC_FOR_BUILD=' 'CFLAGS=-O3 -fomit-frame-pointer
> -fstrict-aliasing -ffast-math -march=pentium  -Wall -fexceptions'
> 'CXXFLAGS=-g -O2' 'CFLAGS_FOR_BUILD=' 'CFLAGS_FOR_TARGET='
> 'INSTALL=/usr/bin/install -c' 'INSTALL_DATA=/usr/bin/install -c -m 644'
> 'INSTALL_PROGRAM=/usr/bin/install -c' 'INSTALL_SCRIPT=/usr/bin/install -c'
> 'JC1FLAGS=' 'LDFLAGS=' 'LIBCFLAGS=' 'LIBCFLAGS_FOR_TARGET=' 'MAKE=make'
> 'MAKEINFO=/bin/sh /root/polyml-master/libpolyml/libffi/missing makeinfo '
> 'PICFLAG=' 'PICFLAG_FOR_TARGET=' 'RUNTESTFLAGS=' 'SHELL=/bin/sh'
> 'exec_prefix=/usr/local' 'infodir=/usr/local/share/info'
> 'libdir=/usr/local/lib' 'mandir=/usr/local/share/man' 'prefix=/usr/local'
> 'AR=ar' 'AS=as' 'CC=gcc' 'CXX=g++' 'LD=/usr/i586-alpine-linux-musl/bin/ld'
> 'NM=/usr/bin/nm -B' 'RANLIB=ranlib' 'DESTDIR=' all-recursive
> make[4]: Entering directory '/root/polyml-master/libpolyml/libffi'
> Making all in include
> make[5]: Entering directory '/root/polyml-master/libpolyml/libffi/include'
> make[5]: Nothing to be done for 'all'.
> make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/include'
> Making all in testsuite
> make[5]: Entering directory
> '/root/polyml-master/libpolyml/libffi/testsuite'
> make[5]: Nothing to be done for 'all'.
> make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/testsuite'
> Making all in man
> make[5]: Entering directory '/root/polyml-master/libpolyml/libffi/man'
> make[5]: Nothing to be done for 'all'.
> make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/man'
> make[5]: Entering directory '/root/polyml-master/libpolyml/libffi'
> make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi'
> make[4]: Leaving directory '/root/polyml-master/libpolyml/libffi'
> make[3]: Leaving directory '/root/polyml-master/libpolyml/libffi'
> make[3]: Entering directory '/root/polyml-master/libpolyml'
> make[3]: Nothing to be done for 'all-am'.
> make[3]: Leaving directory '/root/polyml-master/libpolyml'
> make[2]: Leaving directory '/root/polyml-master/libpolyml'
> Making all in libpolymain
> make[2]: Entering directory '/root/polyml-master/libpolymain'
> make[2]: Nothing to be done for 'all'.
> make[2]: Leaving directory '/root/polyml-master/libpolymain'
> Making all in .
> make[2]: Entering directory '/root/polyml-master'
> make[2]: Leaving directory '/root/polyml-master'
> Making all in modules
> make[2]: Entering directory '/root/polyml-master/modules'
> Making all in IntInfAsInt
> make[3]: Entering directory '/root/polyml-master/modules/IntInfAsInt'
> echo "use \"./ROOT.sml\";" | ../../poly -q -error-exit
> Segmentation fault
> make[3]: *** [Makefile:479: IntInfAsInt] Error 139
> make[3]: Leaving directory '/root/polyml-master/modules/IntInfAsInt'
> make[2]: *** [Makefile:377: all-recursive] Error 1
> make[2]: Leaving directory '/root/polyml-master/modules'
> make[1]: *** [Makefile:729: all-recursive] Error 1
> make[1]: Leaving directory '/root/polyml-master'
> make: *** [Makefile:488: all] Erro

[polyml] polyml install to Alpine Linux

2020-10-17 Thread David Topham
I noticed same error seemed to have occurred from user installing to gentoo
Linux.  I can't tell from this if it was resolved or not (I'm relatively
inexperienced)

https://bugs.gentoo.org/713178

One thing in common between Alpine and this environment is they are using
musl libc

Could that be an issue?
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] polyml Digest, Vol 168, Issue 4

2020-10-17 Thread David Topham
Thank you for the quick response. That is useful to know. Perhaps my
original download of source was corrupt. I tried again this time use the
polyml-master.zip *from github" and that made it much further.

I think it may be almost complete, but got a segment fault at the last
minute.

make  all-recursive
make[1]: Entering directory '/root/polyml-master'
Making all in libpolyml
make[2]: Entering directory '/root/polyml-master/libpolyml'
Making all in libffi
make[3]: Entering directory '/root/polyml-master/libpolyml/libffi'
make 'AR_FLAGS=' 'CC_FOR_BUILD=' 'CFLAGS=-O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=pentium  -Wall -fexceptions'
'CXXFLAGS=-g -O2' 'CFLAGS_FOR_BUILD=' 'CFLAGS_FOR_TARGET='
'INSTALL=/usr/bin/install -c' 'INSTALL_DATA=/usr/bin/install -c -m 644'
'INSTALL_PROGRAM=/usr/bin/install -c' 'INSTALL_SCRIPT=/usr/bin/install -c'
'JC1FLAGS=' 'LDFLAGS=' 'LIBCFLAGS=' 'LIBCFLAGS_FOR_TARGET=' 'MAKE=make'
'MAKEINFO=/bin/sh /root/polyml-master/libpolyml/libffi/missing makeinfo '
'PICFLAG=' 'PICFLAG_FOR_TARGET=' 'RUNTESTFLAGS=' 'SHELL=/bin/sh'
'exec_prefix=/usr/local' 'infodir=/usr/local/share/info'
'libdir=/usr/local/lib' 'mandir=/usr/local/share/man' 'prefix=/usr/local'
'AR=ar' 'AS=as' 'CC=gcc' 'CXX=g++' 'LD=/usr/i586-alpine-linux-musl/bin/ld'
'NM=/usr/bin/nm -B' 'RANLIB=ranlib' 'DESTDIR=' all-recursive
make[4]: Entering directory '/root/polyml-master/libpolyml/libffi'
Making all in include
make[5]: Entering directory '/root/polyml-master/libpolyml/libffi/include'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/include'
Making all in testsuite
make[5]: Entering directory '/root/polyml-master/libpolyml/libffi/testsuite'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/testsuite'
Making all in man
make[5]: Entering directory '/root/polyml-master/libpolyml/libffi/man'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi/man'
make[5]: Entering directory '/root/polyml-master/libpolyml/libffi'
make[5]: Leaving directory '/root/polyml-master/libpolyml/libffi'
make[4]: Leaving directory '/root/polyml-master/libpolyml/libffi'
make[3]: Leaving directory '/root/polyml-master/libpolyml/libffi'
make[3]: Entering directory '/root/polyml-master/libpolyml'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/root/polyml-master/libpolyml'
make[2]: Leaving directory '/root/polyml-master/libpolyml'
Making all in libpolymain
make[2]: Entering directory '/root/polyml-master/libpolymain'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/root/polyml-master/libpolymain'
Making all in .
make[2]: Entering directory '/root/polyml-master'
make[2]: Leaving directory '/root/polyml-master'
Making all in modules
make[2]: Entering directory '/root/polyml-master/modules'
Making all in IntInfAsInt
make[3]: Entering directory '/root/polyml-master/modules/IntInfAsInt'
echo "use \"./ROOT.sml\";" | ../../poly -q -error-exit
Segmentation fault
make[3]: *** [Makefile:479: IntInfAsInt] Error 139
make[3]: Leaving directory '/root/polyml-master/modules/IntInfAsInt'
make[2]: *** [Makefile:377: all-recursive] Error 1
make[2]: Leaving directory '/root/polyml-master/modules'
make[1]: *** [Makefile:729: all-recursive] Error 1
make[1]: Leaving directory '/root/polyml-master'
make: *** [Makefile:488: all] Error 2

On Sat, Oct 17, 2020 at 4:00 AM  wrote:

> Send polyml mailing list submissions to
> polyml@inf.ed.ac.uk
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
> or, via email, send a message with subject or body 'help' to
> polyml-requ...@inf.ed.ac.uk
>
> You can reach the person managing the list at
> polyml-ow...@inf.ed.ac.uk
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of polyml digest..."
>
>
> Today's Topics:
>
>1. building polyml on Alpine Linux (David Topham)
>2. Re: PolyML REPL (Anton Lobach)
>3. Re: building polyml on Alpine Linux (David Matthews)
>
>
> ------
>
> Message: 1
> Date: Fri, 16 Oct 2020 15:17:37 -0700
> From: David Topham 
> To: polyml@inf.ed.ac.uk
> Subject: [polyml] building polyml on Alpine Linux
> Message-ID:
> <
> cad034bh36ek--zkkho2iyui4x6ar+7qjg28le3t-nfs+js-...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I have been trying to get polyml working on Alpine Linux 32-bit
>
> Since there is't yet a package to install it, I tried getting the source
> from github
>
> When doing make, I first got error about missing libffi directory.
>
> I thought I may bypass that by configuring with optio

[polyml] building polyml on Alpine Linux

2020-10-16 Thread David Topham
I have been trying to get polyml working on Alpine Linux 32-bit

Since there is't yet a package to install it, I tried getting the source
from github

When doing make, I first got error about missing libffi directory.

I thought I may bypass that by configuring with option to use system libffi
i.e.
apk add libffi-dev
./configure --with-system-libffi --with-x

Here is result:


make  all-recursive
make[1]: Entering directory '/root/vfpub/polyml-master'
Making all in libpolyml
make[2]: Entering directory '/root/vfpub/polyml-master/libpolyml'
make[3]: Entering directory '/root/vfpub/polyml-master/libpolyml'
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.
-I..  -O3   -Wall -DMODULEDIR=\"/usr/local/lib/polyml/modules\"   -O3 -MT
arb.lo -MD -MP -MF .deps/arb.Tpo -c -o arb.lo arb.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -O3 -Wall
"-DMODULEDIR=\"/usr/local/lib/polyml/modules\"" -O3 -MT arb.lo -MD -MP -MF
.deps/arb.Tpo -c arb.cpp  -fPIC -DPIC -o .libs/arb.o
arb.cpp:87:10: fatal error: globals.h: No such file or directory
   87 | #include "globals.h"
  |  ^~~
compilation terminated.
make[3]: *** [Makefile:800: arb.lo] Error 1
make[3]: Leaving directory '/root/vfpub/polyml-master/libpolyml'
make[2]: *** [Makefile:840: all-recursive] Error 1
make[2]: Leaving directory '/root/vfpub/polyml-master/libpolyml'
make[1]: *** [Makefile:729: all-recursive] Error 1
make[1]: Leaving directory '/root/vfpub/polyml-master'
make: *** [Makefile:488: all] Error 2
---

Has anyone had luck building on Alpine?
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] sets of sets

2016-10-11 Thread David Topham
I doubt if I am the first person to ask this question, but I have not seen
an "answer" in any of the ML books I have read yet...

Is there a way to represent a "set of sets" so that a function can process
a query such as
" is  [2] an element of [ 3 , [2], 4, 5]?"

I know we can easily do a query such as
" is 2 an element of [ 3 , 2, 4, 5]?"

I know the problem is that lists cannot have different types, but this is a
common, normal query in mathematics so someone must have figured out a way
to do it perhaps?

-Dave
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] Echo code as well as output

2016-03-05 Thread David Topham
I am looking for a way to display the code as well as the output when
running SML.

I believe it might be called "trace" or "log"... I did find this suggestion
online:

PolyML.startLog

but that seems to be deprecated?

Is there another option?

e.g.

fun f x = x * x;
f 4;
just displays
val it = 16: int

and I would like something like:

f 4 = 16
or similar to see what code was evaluated to get the 16
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] Interpreter commands?

2015-07-16 Thread David Topham
Are there commands for the PolyML interpreter to do things list the values
in the current environment?  e.g. If I have loaded or defined several
functions and then want to review them as reference to calling them
correctly, is there a way to display their prototypes?  (I did look through
the documentation and tried to search the archives but I don't seem to
have a search feature for that purpose)

-Dave

p.s. I did discover the use of rlwarp (on Linux) to solve the problem of
not being able to use arrow keys within the interpreter--that is a nice
addition for repeating previous commands.  i.e.  rlwrap poly
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] linking polyML modules to C

2015-01-24 Thread David Topham
I wanted to follow through on this to expand the GUI to receive input, so
this is the result (here and attached). The tgz file has the sml and script
to build them as well.
-Dave

#include stdio.h
#include Xm/Xm.h
#include Xm/RowColumn.h
#include Xm/Label.h
#include Xm/TextF.h
#include Xm/PushB.h
#include stdlib.h
#include ctype.h

double (*sml_hypot) (double x, double y);

static void EnterCallback ( Widget w, XtPointer clientData, XtPointer
callData);

Widget sideA, sideB, sideC;

void c_main (void)
{
Widget shell, rowcol, button;
XtAppContext app;

int argc = 1;char* argv[] = {PolyML GUI };
shell = XtAppInitialize ( app, Memo, NULL, 0,
  argc, argv, NULL, NULL, 0 );

rowcol = XtCreateManagedWidget (rowcol, xmRowColumnWidgetClass,
shell, NULL, 0);

XmString xmstr;
xmstr = XmStringCreateLtoR ( Right Triangle, XmFONTLIST_DEFAULT_TAG );
XtVaCreateManagedWidget ( message, xmLabelWidgetClass, rowcol,
  XmNlabelString, xmstr, NULL );
XmStringFree ( xmstr );

sideA = XmCreateTextField ( rowcol, input, NULL, 0 );
XtManageChild ( sideA );
sideB = XmCreateTextField ( rowcol, input, NULL, 0 );
XtManageChild ( sideB );

button = XtCreateManagedWidget(Calculate Hypontenuse,
 xmPushButtonWidgetClass, rowcol, NULL, 0 );
XtAddCallback ( button, XmNactivateCallback, EnterCallback, NULL);

sideC = XmCreateTextField ( rowcol, input, NULL, 0 );
XtManageChild ( sideC );

XtRealizeWidget ( shell );
XtAppMainLoop ( app );

  return;
}
static void EnterCallback ( Widget w, XtPointer clientData, XtPointer
callData )
{
double a, b;
printf ( text entered = %s\n, XmTextFieldGetString ( sideA ) );
printf ( text entered = %s\n, XmTextFieldGetString ( sideB ) );
a = atof(XmTextFieldGetString ( sideA ));
b = atof(XmTextFieldGetString ( sideB ));
double c;
c = sml_hypot (a, b);  /* call back to SML! */
printf(c = %.6f\n, c);
char msg[256];
sprintf(msg,%.1f, c);
XmTextFieldSetString(sideC,msg);
}




On Thu, Jan 22, 2015 at 10:40 AM, David Topham dtop...@gmail.com wrote:



 On Thu, Jan 22, 2015 at 10:36 AM, David Topham dtop...@gmail.com wrote:

 Wonderful! Thank you so much for posting that Phil!

 I was not able to build the code using the Makefile because my system
 does not have libpolyml.so;
 however, the commands within the Makefile did work, so perhaps that file
 is not needed?
 I put them within the attached tgz file in a shell script.
 Here are the commands in that file:

 gcc -fPIC -g -Wall -c testlib.c -o testlib.o
 gcc -shared -Wl,-soname,testlib.so.1 -o testlib.so.1 testlib.o
 polyc call_c_test_10.sml
 LD_LIBRARY_PATH=. ./a.out

 and this runs successfully displaying the output in an X Window!

 I think this is a viable approach to integrating PolyML with a GUI or at
 least graphics output but of course will require lots of experimenting...I
 wish I had tons of time, but will only be able to try things
 once-in-a-while now that a new semester has begun.

 Here is the modified C program that invokes the Motif window:
 (but it is also in the attached tgz file if you want to try it)

 #include stdio.h
 #include Xm/Xm.h
 #include Xm/Label.h
 #include stdlib.h

 double (*sml_hypot) (double x, double y);

 void c_main (void)
 {
   double a, b, c;

   a = 3.0;
   b = 4.0;
   printf(a = %.6f\n, a);
   printf(b = %.6f\n, b);

   c = sml_hypot (a, b);  /* call back to SML! */

   printf(c = %.6f\n, c);
   fflush(stdout);

 char msg[256];
 sprintf(msg,c = %.6f\n, c);
 Widget   shell;
 XtAppContext app;
 XmString xmstr;
 int argc = 1;
 char* argv[] = {polygui };
 shell = XtAppInitialize ( app, Memo, NULL, 0,
   argc, argv, NULL, NULL, 0 );

 xmstr = XmStringCreateLtoR ( msg, XmFONTLIST_DEFAULT_TAG );
 XtVaCreateManagedWidget ( message,
 xmLabelWidgetClass, shell,
 XmNlabelString, xmstr,
 NULL );
 XmStringFree ( xmstr );
 XtRealizeWidget ( shell );
 XtAppMainLoop ( app );

   return;
 }










 On Thu, Jan 22, 2015 at 4:00 AM, polyml-requ...@inf.ed.ac.uk wrote:

 Send polyml mailing list submissions to
 polyml@inf.ed.ac.uk

 To subscribe or unsubscribe via the World Wide Web, visit
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
 or, via email, send a message with subject or body 'help' to
 polyml-requ...@inf.ed.ac.uk

 You can reach the person managing the list at
 polyml-ow...@inf.ed.ac.uk

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of polyml digest...


 Today's Topics:

1. Re: linking polyML modules to C (Phil Clayton)


 --

 Message: 1
 Date: Wed, 21 Jan 2015 20:20:06 +
 From: Phil Clayton

Re: [polyml] polyml Digest, Vol 111, Issue 7

2015-01-22 Thread David Topham
Wonderful! Thank you so much for posting that Phil!

I was not able to build the code using the Makefile because my system does
not have libpolyml.so;
however, the commands within the Makefile did work, so perhaps that file is
not needed?
I put them within the attached tgz file in a shell script.
Here are the commands in that file:

gcc -fPIC -g -Wall -c testlib.c -o testlib.o
gcc -shared -Wl,-soname,testlib.so.1 -o testlib.so.1 testlib.o
polyc call_c_test_10.sml
LD_LIBRARY_PATH=. ./a.out

and this runs successfully displaying the output in an X Window!

I think this is a viable approach to integrating PolyML with a GUI or at
least graphics output but of course will require lots of experimenting...I
wish I had tons of time, but will only be able to try things
once-in-a-while now that a new semester has begun.

Here is the modified C program that invokes the Motif window:
(but it is also in the attached tgz file if you want to try it)

#include stdio.h
#include Xm/Xm.h
#include Xm/Label.h
#include stdlib.h

double (*sml_hypot) (double x, double y);

void c_main (void)
{
  double a, b, c;

  a = 3.0;
  b = 4.0;
  printf(a = %.6f\n, a);
  printf(b = %.6f\n, b);

  c = sml_hypot (a, b);  /* call back to SML! */

  printf(c = %.6f\n, c);
  fflush(stdout);

char msg[256];
sprintf(msg,c = %.6f\n, c);
Widget   shell;
XtAppContext app;
XmString xmstr;
int argc = 1;
char* argv[] = {polygui };
shell = XtAppInitialize ( app, Memo, NULL, 0,
  argc, argv, NULL, NULL, 0 );

xmstr = XmStringCreateLtoR ( msg, XmFONTLIST_DEFAULT_TAG );
XtVaCreateManagedWidget ( message,
xmLabelWidgetClass, shell,
XmNlabelString, xmstr,
NULL );
XmStringFree ( xmstr );
XtRealizeWidget ( shell );
XtAppMainLoop ( app );

  return;
}










On Thu, Jan 22, 2015 at 4:00 AM, polyml-requ...@inf.ed.ac.uk wrote:

 Send polyml mailing list submissions to
 polyml@inf.ed.ac.uk

 To subscribe or unsubscribe via the World Wide Web, visit
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
 or, via email, send a message with subject or body 'help' to
 polyml-requ...@inf.ed.ac.uk

 You can reach the person managing the list at
 polyml-ow...@inf.ed.ac.uk

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of polyml digest...


 Today's Topics:

1. Re: linking polyML modules to C (Phil Clayton)


 --

 Message: 1
 Date: Wed, 21 Jan 2015 20:20:06 +
 From: Phil Clayton phil.clay...@veonix.com
 To: polyml@inf.ed.ac.uk
 Subject: Re: [polyml] linking polyML modules to C
 Message-ID: 54c009f6.1050...@veonix.com
 Content-Type: text/plain; charset=iso-8859-1; Format=flowed

 19/01/15 12:19, David Matthews wrote:
  On 19/01/2015 04:34, David Topham wrote:
  Thanks David for your response.
 
  While searching I found this comment you made earlier:
 
  The foreign-function interface allows for call-back functions so
  there is
  the mechanism to produce a C function that when called calls an ML
  function.
 
  in
  http://stackoverflow.com/questions/17580386/shared-libraries-in-poly-ml
 
  Doesn't this indicate a mechanism that allows an SML function to be
  called
  from C?
 
  Yes, but the main program still has to be in ML.  You can call C
  library functions and pass an ML function as an argument.

 Or the ML functions can be passed via global variables that are
 initialized from the ML side - see attached example.  That may be easier
 if there are a large number of ML functions.


  Actually, I did wonder whether this could be used as a way of exporting
  ML functions to create a library that could be called from a C main
  program and came to the conclusion that it was going to be too
  complicated.  Poly/ML uses libffi to interface with C.  libffi can build
  closures that wrap around ML functions so that these can be passed into
  C.  The format of the closure it constructs differs markedly depending
  on the particular architecture since different architectures have
  different calling conventions for C.  The closure is a data structure
  with pointers in it.  Exporting it would require turning the pointers
  into relocations that the linker/loader will understand.  libffi simply
  doesn't provide that information.  It's there by implication in the
  source code but not explicitly.
 
  David
  ___
  polyml mailing list
  polyml@inf.ed.ac.uk
  http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
 

 -- next part --
 A non-text attachment was scrubbed...
 Name: call_c_test_10.tar.gz
 Type: application/x-gzip
 Size: 1438 bytes
 Desc: not available
 URL: 
 http://lists.inf.ed.ac.uk/pipermail/polyml/attachments/20150121/edcb7e81/attachment-0001.gz

[polyml] PolyML (or just SML) sample code?

2015-01-14 Thread David Topham
As part of my SML education, I want to look at sample code...I do have
several good books already and that certainly helps, but what about some
specific coding ideas people have explored?

 I noticed there is a website:

http://rosettacode.org/wiki/Category:Standard_ML_Implementations

that does good comparisons between languages of certain tasks, but don't
see
PolyML there.

Are there other central places where people upload/share SML code?

-Dave
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] ProofPower as an SML environment and IDE

2014-12-26 Thread David Topham
Omar, I recently installed ProofPower
http://www.lemma-one.com/ProofPower/index/index.htmland discovered that
it has capabilities as an efficient and effective PolyML IDE too!  It also
uses a simplified variation of Knuth's literate programming idea where
you can intersperse mathematics with the correct symbols (rather than ASCII
code approximations).  In an earlier post, I had mistakenly claimed that
ProofPower required an earilier version of PolyML (v 4), but Rob Arthan
helped me through the very minor update to a makefile to get it to build
easily using the latest PolyML version, so that is not a problem. I have
attached a small sample to show how the integration works with math using a
few macros in the source code. The source (in the doc file) was entered
using the xpp IDE which allows you to run the SML code right in the
editor.   -Dave Topham


2. Re: [isabelle] Isabelle as an SML environment and IDE
   (Omar Montano Rivas)

 --
 Date: Mon, 22 Dec 2014 11:50:28 -0600
 From: Omar Montano Rivas omarmri...@gmail.com
 To: Aleks Kissinger ale...@gmail.com
 Cc: isabelle-us...@cl.cam.ac.uk, Poly/ML Mailing List
 polyml@inf.ed.ac.uk
 Subject: Re: [isabelle] Isabelle as an SML environment and  IDE

 Really useful. Thanks for sharing.

 Best,
 Omar.

 2014-12-19 10:49 GMT-06:00 Aleks Kissinger ale...@gmail.com:

  It recently came up on the Poly/ML mailing list that Isabelle/jEdit
  makes a pretty efficient SML IDE these days. I manage a fairly large
  SML project called Quantomatic, so I thought I'd have a go at getting
  a setup to work. I've got a setup now that I am pretty happy with, so
  I thought I'd share my results. Hopefully other people will find this
  helpful.
 
  Quantomatic is fairly unique in that it is designed to run inside of
  Isabelle or as a standalone project. As a result, the whole codebase
  is implemented on top of an Isabelle/ML-like environment, obtained by
  importing chunks of the ML code in Pure. This can be done by copying
  src/Pure from Isabelle 2014 into an SML project and using this file:
 
 
 
 https://github.com/Quantomatic/quantomatic/blob/integration/core/isabelle_env.ML
 
  In the past, we used a slightly hacked-up version of Pure, but for the
  sake of maintainability, we now use an exact copy.
 
  The project itself is loaded with special thy files that only
  contain comments and ML_file commands. These can be run from inside
  Isabelle/jEdit (in the real Isabelle/ML environment), or they can be
  imported in poly/ML with the function use_thy:
 
 
 https://github.com/Quantomatic/quantomatic/blob/integration/core/use_thy.ML
 
  This implements a baby version of the outer syntax parser, which
  ignores imports and translates the ML_file commands into use
  statements. This makes the external ROOT.ML tiny and easy to maintain:
 
  https://github.com/Quantomatic/quantomatic/blob/integration/core/ROOT.ML
 
  This can be executed with, e.g. poly --use ROOT.ML
 
 
 -- next part --
 An HTML attachment was scrubbed...
 URL: 
 http://lists.inf.ed.ac.uk/pipermail/polyml/attachments/20141222/a0665ed1/attachment-0001.html
 





higherOrder.pdf
Description: Adobe PDF document


higherOrder.doc
Description: MS-Word document
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] printTypesWithStructureName

2014-12-26 Thread David Topham




David Matthews David.Matthews@... writes:

 
 Rob,
 Yes, I removed PolyML.Compiler.printTypesWithStructureName.  5.3 does a 
 much better at trying to detect exactly what path is needed to identify 
 a type and always tries to produce the minimal path.  This isn't always 
 easy or possible in the presence of sharing, type abbreviations and type 
 and structure renaming since what it's trying to do is get back from the 
 abstract type name that represents a unique type to a concrete type 
 constructor that carries that type.
 
 For example:
 Poly/ML 5.3 Enhanced Reporting Testing
   structure S = struct datatype t = A val x = A end;
 structure S : sig val x : t datatype t = A end (* x just has type t *)
   val y = S.x;
 val y = A : S.t (* Reports S.t as the path *)
   open S;
 datatype t = A
 val x = A : t (* Reports t because it's now in scope *)
   x;
 val it = A : t (* As above *)
   type t = int; (* Redefine t *)
 eqtype t
   x;
 val it = A : S.t (* Now reports S.t because t doesn't mean S.t *)
  
 
 This makes it difficult to know what printTypesWithStructureName ought 
 to do.  Should it suppress all structure prefixes even if they're needed 
 or add them on even if they're not?  The simplest answer was to remove 
 it.  I could reinstate it for backwards compatibility if it would make 
 things easier and simply ignore the value it has.
 
 Regards,
 David
 
 Rob Arthan wrote:
  I wrote:
  I am completely baffled. I thought I hada solved all my problems on 
  MacOS X
  10.6 and was just tidying up, when I had to recompile a 32 bit version of
  Poly/ML to test a tidied up make file. This failed because
  PolyML.Compiler.printTypesWithStructureName no longer exists. The same
  problem happened when i rebuild a 64 bit version. What has happened?
  but it was a false alarm: my make file was wrong for other reasons and 
  the absence of PolyML.Compiler.printTypesWithStructureName was not 
  relevant. No doubt there are good reasons why this variable has been 
  withdrawn.
  
 

I am trying to install QCheck 
(http://contrapunctus.net/league/haques/qcheck/qcheck_2.html) which generates 
unit tests for SML code, and found that it uses printTypesWithStructureName in 
this way:
--
PolyML.Compiler.printTypesWithStructureName := false;
PolyML.print_depth 0;
OS.FileSys.chDir src;
PolyML.make QCheck;
OS.FileSys.chDir ../tests;
use from-to-str.sml;
use from-to-poly.sml;
use reverse.sml;
use compose.sml;

...in order to check the installation...what should I use in place of 

PolyML.Compiler.printTypesWithStructureName := false;  ?

or can it just be removed with no consequences?

I tried just removing that first line, and the testcases do run, with 2 
failures related to String/invalid and String/from-to
(but those failures may have nothing to do with 
printTypesWithStructureName)

I am just doing a sanity check by asking if anyone has had experience with
QCheck.
-Dave Topham





___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


[polyml] ML_dbase

2014-12-19 Thread David Topham
I noticed several references to ML_dbase in the documentation (obviously I
am a new user!), but do not see that file anywhere after my (virgin) PolyML
version 5 installation. Is this file needed?  Is it created automatically?
What is it for?  -Dave



___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] GUI Interface (Motif)

2014-12-15 Thread David Topham
David, Thank you so much! I really appreciate your help with this. Your
sample below builds fine with polyc on my system (PolyML 5.5.2). I am using
a minimal Linux distribution named TinyCore (
http://distro.ibiblio.org/tinycorelinux/) which comes with OpenMotif 2.3.3
 It runs in a virtual machine within another computer only taking up a few
hundred MBs!

I am going to use it to help my students explore Discrete Math next
semester (this textbook uses SML for that purpose:
http://cs.wheaton.edu/~tvandrun/dmfp/).

I also found a reasonably current project using PolyML and Motif here:
http://www.lemma-one.com/ProofPower/index/

...however it was built on PolyML 4 and has not yet been ported to the
newer version (e.g. depends on PolyML.commit which no longer seems to be
supported).

Happy Holidays to everyone in the PolyML community!

-David Topham


Re: GUI Interface (David Matthews)

 I've experimented with building a stand-alone executable with Motif and
 succeeded in getting it to work for me using polyc.  (It required
 building Poly/ML with --with-x).  I took the example from
 http://www.polyml.org/docs/Motif.html and wrapped it up in a function.
 I did find a problem, though.  It looks as though the function has to
 suspend itself with something like Posix.Process.pause otherwise nothing
 happens.  I seem to recall that the Motif stuff is handled on a separate
 thread to allow the REPL to continue to accept commands.  With a
 stand-alone application there isn't a REPL so without the pause it
 terminates immediately.

 David

 open XWindows ;
 open Motif ;

 fun main() =
 let
 val shell =
  XtAppInitialise  xed Editor [] [XmNwidth 400, XmNheight 400] ;

 val main = XmCreateMainWindow shell main [] ;

 val bar = XmCreateMenuBar main bar [] ;

 val fileMenu = XmCreateCascadeButton bar file [XmNlabelString File] ;
 val editMenu = XmCreateCascadeButton bar edit [XmNlabelString Edit] ;
 val viewMenu = XmCreateCascadeButton bar view [XmNlabelString View] ;
 val helpMenu = XmCreateCascadeButton bar help [XmNlabelString Help] ;

 val command = XmCreateText main command [XmNeditMode XmSINGLE_LINE_EDIT]
 ;

 val hscroll = XmCreateScrollBar main hscroll [XmNorientation
 XmHORIZONTAL] ;
 val vscroll = XmCreateScrollBar main vscroll [XmNorientation XmVERTICAL]
 ;

 val work = XmCreateDrawingArea main work [] ;
 in

 XtManageChildren [fileMenu, editMenu, viewMenu, helpMenu] ;
 XtManageChildren [bar, command, hscroll, vscroll, work] ;

 XmMainWindowSetAreas main bar command hscroll vscroll work ;

 XtManageChild main ;
 XtRealizeWidget shell;
 Posix.Process.pause()
 end;


 --

 ___
 polyml mailing list
 polyml@inf.ed.ac.uk
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

 End of polyml Digest, Vol 110, Issue 12
 ***

 --
 The University of Edinburgh is a charitable body, registered in
 Scotland, with registration number SC005336.


___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] GUI Interface

2014-12-13 Thread David Topham

  The X-Windows/Motif code still builds as far as I'm aware but that's as
  far as it goes.  I would say it was better to use something else through
  CInterface.
 
  The Poly/ML interactive environment (read-eval-print loop or REPL) is
  usually the easiest way to develop and test your code.  It prints the
  types and values of top-level expressions.  When building an application
  it is probably easier to use polyc.  This is really a wrapper script
  for poly which compiles, exports and links a stand-alone application.
You need to define a function called main that is the root function
  of your application.
 
  $ cat  testme.ML
  fun main() = print Hello World\n;
  $ polyc testme.ML
  $ ./a.out
  Hello World
 
  David Matthews
 

   Thanks for your reply David, I will look into using CInterface.  That
   makes me think that another approach could be to use an imperative
  language
   for the GUI and link in the ML functions! That way existing GUI
 builders
   could be used. I will experiment.
  


I did get the interactive version of the sample Motif code to work OK, but
failed to get it to build stand-alone (i.e. using polyc).  Perhaps the
polyc script doesn't include the needed Motif libraries?  But also, my
limited understanding of how to incorporate that GUI code into a main
function may be to blame. I will keep trying, but after more reading, I am
beginning to think that my idea to use the CInterface backwards: calling ML
code from C rather than the other way around is not going to work!  I had
been thinking that instead of wrapping some new GUI library around ML (like
the Motif code which seems to be obsolete), I could use existing C/C++ GUI
frameworks and have the logic of the program be in ML, but that means
calling ML functions from C. Can that be done?

What surprises me is that all these years of people using ML,  but no one
has felt the need to write stand-alone programs for end-users that have a
GUI?

I don't see any example code that does that (I did see Polychrome within a
web browser).  ...and some examples that mention Isabelle has an IDE -- not
PolyML though, just SML/NJ? and with Java required?)

-Dave
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] GUI Interface

2014-12-13 Thread David Topham
Continuing my experiments, I came across sml_tk (
http://www.informatik.uni-bremen.de/~cxl/sml_tk/doc/manual.html) which
looks promising. It is also a little old (uses PolyML 4). I ran the
Makefile to install it and find it fails trying to do a commit. I noticed
that there seems to have been a change in Poly 5.5.2 that removes
PolyML.commit).  I see in the sml_tk source this line (in poly.sml) :
PolyML.comit();
..so I wonder, what do I replace that with?
I see this instruction in Poly v 5 :
PolyML.export(mypoly,PolyML.rootFunction);

but that is a precursor to doing a compile?
cc -o mypoly mypoly.o -lpolymain -lpolyml

i.e. Those 2 lines replace the idea from v 4 of doing commit?

-Dave

On Sat, Dec 13, 2014 at 9:04 AM, David Topham dtop...@gmail.com wrote:

  The X-Windows/Motif code still builds as far as I'm aware but that's as
  far as it goes.  I would say it was better to use something else through
  CInterface.
 
  The Poly/ML interactive environment (read-eval-print loop or REPL) is
  usually the easiest way to develop and test your code.  It prints the
  types and values of top-level expressions.  When building an application
  it is probably easier to use polyc.  This is really a wrapper script
  for poly which compiles, exports and links a stand-alone application.
You need to define a function called main that is the root function
  of your application.
 
  $ cat  testme.ML
  fun main() = print Hello World\n;
  $ polyc testme.ML
  $ ./a.out
  Hello World
 
  David Matthews
 

   Thanks for your reply David, I will look into using CInterface.  That
   makes me think that another approach could be to use an imperative
  language
   for the GUI and link in the ML functions! That way existing GUI
 builders
   could be used. I will experiment.
  


 I did get the interactive version of the sample Motif code to work OK, but
 failed to get it to build stand-alone (i.e. using polyc).  Perhaps the
 polyc script doesn't include the needed Motif libraries?  But also, my
 limited understanding of how to incorporate that GUI code into a main
 function may be to blame. I will keep trying, but after more reading, I am
 beginning to think that my idea to use the CInterface backwards: calling ML
 code from C rather than the other way around is not going to work!  I had
 been thinking that instead of wrapping some new GUI library around ML (like
 the Motif code which seems to be obsolete), I could use existing C/C++ GUI
 frameworks and have the logic of the program be in ML, but that means
 calling ML functions from C. Can that be done?

 What surprises me is that all these years of people using ML,  but no one
 has felt the need to write stand-alone programs for end-users that have a
 GUI?

 I don't see any example code that does that (I did see Polychrome within a
 web browser).  ...and some examples that mention Isabelle has an IDE -- not
 PolyML though, just SML/NJ? and with Java required?)

 -Dave


___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] polyml Digest, Vol 110, Issue 5

2014-12-11 Thread David Topham
Thank you David for the suggestion to use polyc; I hadn't seen that
anywhere in the documentation on the main website!

I entered the code in the sample tutorial for the Motif interface and it
works very well in interactive mode. When I try to use polyc on it, there
is an error (attached in image file). I suspect from reading it that
perhaps the main needed from polyc must have type that returns int, but
in general (in Motif) it has return type Widget. Is polyc restricted to
console only? i.e. perhaps more wrapper code is needed to make a
stand-alone GUI using polyc?

p.s. Even though I will take your advice and not spend too much time on
Motif; I think the overall mechanics may be similar even if I find a way to
use an updated GUI.

On Thu, Dec 11, 2014 at 4:00 AM, polyml-requ...@inf.ed.ac.uk wrote:

 Send polyml mailing list submissions to
 polyml@inf.ed.ac.uk

 To subscribe or unsubscribe via the World Wide Web, visit
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
 or, via email, send a message with subject or body 'help' to
 polyml-requ...@inf.ed.ac.uk

 You can reach the person managing the list at
 polyml-ow...@inf.ed.ac.uk

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of polyml digest...


 Today's Topics:

1. Re: Poly/ML (David Matthews)
2. Re: emacs SML mode (Peter Gammie)
3. Re: emacs SML mode (Makarius)


 --

 Message: 1
 Date: Wed, 10 Dec 2014 12:51:42 +
 From: David Matthews david.matth...@prolingua.co.uk
 To: polyml@inf.ed.ac.uk
 Subject: Re: [polyml] Poly/ML
 Message-ID: 548841de.1050...@prolingua.co.uk
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 The X-Windows/Motif code still builds as far as I'm aware but that's as
 far as it goes.  I would say it was better to use something else through
 CInterface.

 The Poly/ML interactive environment (read-eval-print loop or REPL) is
 usually the easiest way to develop and test your code.  It prints the
 types and values of top-level expressions.  When building an application
 it is probably easier to use polyc.  This is really a wrapper script
 for poly which compiles, exports and links a stand-alone application.
   You need to define a function called main that is the root function
 of your application.

 $ cat  testme.ML
 fun main() = print Hello World\n;
 $ polyc testme.ML
 $ ./a.out
 Hello World

 David

 On 09/12/2014 17:25, David Topham wrote:
  Thanks for your reply Richard, I will look into using CInterface.  That
  makes me think that another approach could be to use an imperative
 language
  for the GUI and link in the ML functions! That way existing GUI builders
  could be used. I will experiment. I scannned through your work on
 wrapping
  SDL and find it interesting. Since I am new to ML could you supply a
 short
  demo of how one would integrate those into a complete example? (I think
 SDL
  is supplied with TinyCore, so I will test it there). I noticed when
 loading
  the Motif library in PolyML (the use command), that the screen would
  display each function as it is loaded. Do you know if there is a way to
  create a standalone app that does not bombard the user with that kind of
  loading info?  e.g. When you start up your SDL game, does it scroll
 through
  screens of info before game starts?   -Dave
 


 --

 Message: 2
 Date: Wed, 10 Dec 2014 20:52:36 -0600
 From: Peter Gammie pete...@gmail.com
 To: PolyML mailing list polyml@inf.ed.ac.uk
 Cc: Stefan Monnier monn...@iro.umontreal.ca
 Subject: Re: [polyml] emacs SML mode
 Message-ID: 78d81d05-7a9a-4bb6-83fe-2790f21b4...@gmail.com
 Content-Type: text/plain; charset=windows-1252

 David, Makarius,

 On 3 Dec 2014, at 13:20, Makarius makar...@sketis.net wrote:

  Here is also an example for that, to implement a home-made eval
 function in Poly/ML:
 http://stackoverflow.com/questions/9555790/does-sml-poly-have-a-cl-like-repl
 
  This should give some clues how to do it.  It is up to that function to
 say how errors are printed.
 
  An actual REPL requires a bit more work, with proper handling of
 interrupts in contrast to regular exceptions.  Isabelle2014 still happens
 to have such a REPL in isar.ML, but it is not used by default and already
 deleted for the next release. (Such a nostalgic REPL is actually more
 complicated than having a direct editing model that is now standard in
 Isabelle/PIDE.)

 Thanks for the pointer. I?ve stashed this one away for a rainy day. Right
 now I just want to interact with Poly/ML in the most straightforward way.

 On 3 Dec 2014, at 5:33, David Matthews d...@prolingua.co.uk wrote:

  It would be nice to have SML emacs mode working with Poly/ML for those
 who would like to use it but my feeling is that it is rather
 old-fashioned.  Poly/ML now supports a much more extensive interface
 designed for an IDE.  The best example of this is Isabelle's

Re: [polyml] polyml Digest, Vol 110, Issue 3

2014-12-09 Thread David Topham
Thanks for your reply Richard, I will look into using CInterface.  That
makes me think that another approach could be to use an imperative language
for the GUI and link in the ML functions! That way existing GUI builders
could be used. I will experiment. I scannned through your work on wrapping
SDL and find it interesting. Since I am new to ML could you supply a short
demo of how one would integrate those into a complete example? (I think SDL
is supplied with TinyCore, so I will test it there). I noticed when loading
the Motif library in PolyML (the use command), that the screen would
display each function as it is loaded. Do you know if there is a way to
create a standalone app that does not bombard the user with that kind of
loading info?  e.g. When you start up your SDL game, does it scroll through
screens of info before game starts?   -Dave

On Tue, Dec 9, 2014 at 4:00 AM, polyml-requ...@inf.ed.ac.uk wrote:

 Send polyml mailing list submissions to
 polyml@inf.ed.ac.uk

 To subscribe or unsubscribe via the World Wide Web, visit
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
 or, via email, send a message with subject or body 'help' to
 polyml-requ...@inf.ed.ac.uk

 You can reach the person managing the list at
 polyml-ow...@inf.ed.ac.uk

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of polyml digest...


 Today's Topics:

1. Poly/ML (David Topham)
2. Re: Poly/ML (Richard Molitor)


 --

 Message: 1
 Date: Mon, 8 Dec 2014 18:03:27 + (UTC)
 From: David Topham dtop...@gmail.com
 To: polyml@inf.ed.ac.uk
 Subject: [polyml] Poly/ML
 Message-ID: loom.20141208t185725-...@post.gmane.org
 Content-Type: text/plain; charset=us-ascii

 I just discovered PolyML while looking for a distribution of Standard ML
 that I
 could compile from source on TinyCore Linux.  It worked perfectly (unike
 SMLNJ
 e.g.).

 I am interested in connecting GUI to ML as well as functions written in
 C/C++ and all that seems like it would work (form reading the
 documentation). My
 question is this:
The doc for using PolyML Motif is 14 years old and one posting from
 David
 Matthews in this forum mentioned that Motif is no longer maintained, so I
 wonder
 if that was a project that is no longer worth learning.

 Is there a better way to mix GUI with PolyML?

 (I have been using FLTK with C++ with very good success so
 far, but want to add in the ability to mix in functional (SML) programming.

 Any suggestions would be appreciated!



 --

 Message: 2
 Date: Tue, 9 Dec 2014 00:02:24 +0100 (CET)
 From: Richard Molitor gattscha...@googlemail.com
 To: polyml@inf.ed.ac.uk
 Subject: Re: [polyml] Poly/ML
 Message-ID: alpine.LNX.2.03.141209160.5655@localdomain.local
 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

 Hello David,

 On Mon, 8 Dec 2014, David Topham wrote:

  I am interested in connecting GUI to ML as well as functions written in
  C/C++ and all that seems like it would work (form reading the
 documentation).
  [...]
  Is there a better way to mix GUI with PolyML?

 I myself picked up PolyML recently and I'm liking the small distribution.
 Unfortunately that means it doesn't comes with batteries included, as
 they
 say.

  Any suggestions would be appreciated!

 What I found is that wrapping C libraries using the interface documented at
 http://polyml.org/docs/CInterface.html is rather simple - provided you
 know C,
 but from reading your mail that seems to be no issue.

 I didn't want a GUI library, but I wrapped parts of SDL2 for some simple
 game
 development, see
 https://github.com/gattschardo/hashira/blob/master/sdl.sml
 it's not a complete wrapper, just what I felt I needed myself.
 Also I have a somewhat more complete wrapping for libjson at:
 https://github.com/fkmsoft/fridge/blob/master/ml/json.ML

 So you might want to try just wrapping relevant parts of e.g. Gtk yourself
 and
 see how far you can get (don't know how wrapping C++ for getting Qt would
 work)

 Cheers
 Richard

 PS: if anybody is interested in using my WIP wrappers, I'd be happy to
 polish
 them a little and put them in proper repositories.


 --

 ___
 polyml mailing list
 polyml@inf.ed.ac.uk
 http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

 End of polyml Digest, Vol 110, Issue 3
 **

 --
 The University of Edinburgh is a charitable body, registered in
 Scotland, with registration number SC005336.


___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

[polyml] Poly/ML

2014-12-08 Thread David Topham
I just discovered PolyML while looking for a distribution of Standard ML that I 
could compile from source on TinyCore Linux.  It worked perfectly (unike SMLNJ 
e.g.). 

I am interested in connecting GUI to ML as well as functions written in 
C/C++ and all that seems like it would work (form reading the documentation). 
My 
question is this:
   The doc for using PolyML Motif is 14 years old and one posting from David 
Matthews in this forum mentioned that Motif is no longer maintained, so I 
wonder 
if that was a project that is no longer worth learning. 

Is there a better way to mix GUI with PolyML?   

(I have been using FLTK with C++ with very good success so 
far, but want to add in the ability to mix in functional (SML) programming.

Any suggestions would be appreciated!

___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml