Re: [Larceny-users] recursive lists and C-c problems

2008-12-08 Thread Marco Maggi
[EMAIL PROTECTED] wrote:
Marco Maggi wrote:
   I am new to Larceny (10 minutes) taking a look at
 larceny-0.963-bin-native-ia32-linux86)

v0.97b1 is newer and should have fewer bugs.

Is it also still open to very small non-language
related changes?

 The R6RS does not specify any finite notation for
 circular pseudo-lists [...] Attempts to print
 circular pseudo-lists in R6RS-conforming
 systems should result in infinite output.

Fine. But is there a switch that makes larceny print
some non-infinite output in
R6RS-compatible-mode-for-everything-else?

 After hitting C-c, I see that the debugger is here
 and I can exit it with q. And I am left with a prompt?

Yes.  It isn't a very useful prompt, since nothing is
in scope, but it's a prompt.

Nothing is in scope until I issue (import (rnrs)),
then I do what I want with escalated privileges.

 Although Larceny checks for accidental
 problems with the R6RS top-level program and libraries
 being executed, it does not even try to guard against
 malicious manipulation of the program and libraries.

It would suffice to have a command line switch that
makes the process exit whenever an exception is not
blocked.

-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] finding libraries

2008-12-08 Thread Marco Maggi
William D Clinger wrote:
Marco Moggie wrote:
(I am not a cat :-)

 You could, for example, edit the
 startup.sch file documented in sections
 3.2.4 of Larceny's User Manual.  If you
 prefer to use an environment variable,
 then you could edit the shell scripts
 provided with Larceny.

All of this is possible, but not easy;
I do not want to learn how to hack scripts,
and hack them again after each upgrade. I
will roll my own script, but I am still
convinced that making it simple with an
env-var would be a good service to the
users.

 You can put (uriel lang) in either of

 dir-in-path/uriel/lang.sls
 or  dir-in-path/uriel.sls

 Similarly, you can put (uriel lang compat) in

 dir-in-path/uriel/lang/compat.sls
 or  dir-in-path/uriel/lang.sls
 or  dir-in-path/uriel.sls

Yes. I will experiment with this, and probably
adopt this convention.

 v0.97 is also expected to allow

dir-in-path/uriel/lang/compat.larceny.sls

Fine!
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] recursive lists and C-c problems

2008-12-08 Thread Marco Maggi
William D Clinger wrote:
 It would suffice to have a command
 line switch that makes the process
 exit whenever an exception is not
 blocked.

 For what purpose(s) would that suffice?
 If by exception you mean an R6RS
 exception, then it seems to me you could
 do that yourself by installing a handler.

I used bad words. What I mean is that I am
UNused to runtimes that enter a debugger
by default when running a program; my
least surprise behaviour is to just exit
with an error code, when something that
the program was not expecting goes wrong.
IMHO the go-in-debugger-by-default is a
REPL thing.

I see this as both a security problem and
a workflow problem.

I speculate that most of the times I would
just exit the debugger because I am not
ready for a debug session (I rarely use
the debugger in any language). For example,
when I am in a write-and-run cycle for a test
suite using the lightweight testing SRFI, and
I make a mistake that causes an exception to
go through to the top level (not a failing
test, but a mistake in using something), I do
not want to enter the debugger: I just want
to see the error message.

It may be that I have a bad workflow...
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] ANF size error with 0.97b1

2008-12-09 Thread Marco Maggi
With larceny-0.97b1-bin-native-ia32-linux86
I get this output:

ANF size: 20396

and on the same program with
larceny-0.963-bin-native-ia32-linux86 I get

ANF size: 20416

the program works with both Ikarus and Ypsilon.

It is complex to provide code, because I am
using the R6RS port of the SRFI by Derick
Eddington[1]. (I failed to understand how to
load Larceny's SRFIs from larceny -r6rs, I
will have to read the guide more carefully.)

Is it something to report as a bug?

[1]
https://code.launchpad.net/~ikarus-libraries-team/ikarus-libraries/srfi
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] ANF size error with 0.97b1

2008-12-09 Thread Marco Maggi
William D Clinger wrote:
 Is it something to report as a bug?

The ANF size: reports come from the compiler, and
provide an estimate of the code size. [...] It would
probably be better for me to file that bug report.

Thanks. The following script triggers the output; the
import specs I have commented out will cause errors
(Derick is still working to Larceny support).

;; proof.sls --
(import (rnrs)
  (srfi and-let-star)
  (srfi args-fold)
  (srfi case-lambda)
  (srfi char-set)
  (srfi compare)
  (srfi cond-expand)
  (srfi cut)
  (srfi eager-comprehensions)
;;  (srfi error-reporting)
  (srfi format)
;;  (srfi general-cond)
  (srfi let-values)
  (srfi lightweight-testing)
  (srfi lists)
  (srfi parameters)
  (srfi random)
  (srfi rec)
  (srfi receive)
;;  (srfi records)
  (srfi sharing)
  (srfi streams)
  (srfi string-ports)
;;  (srfi strings)
  (srfi time)
;;  (srfi vectors)
  )
(display 123)
;;; end of file

I run it with:

$ larceny -r6rs -path /usr/local/lib/scheme \
-program proof.sps

after putting Derick's SRFIs in the selected
directory. In the SRFI distribution I rename
all the xxx.larceny.sls to xxx.sls else
they are not found. I have NOT tried to
precompile the libraries.

The following libraries, when imported alone,
will NOT trigger the output:

(srfi and-let-star)
(srfi args-fold)
(srfi case-lambda)
(srfi char-set)
(srfi compare)
(srfi cond-expand)
(srfi cut)
(srfi format)
(srfi let-values)
(srfi lists)
(srfi parameters)
(srfi random)
(srfi rec)
(srfi receive)
(srfi sharing)
(srfi streams)
(srfi string-ports)
(srfi time)

while the following will do:

(srfi eager-comprehensions)
(srfi lightweight-testing)

The following script imports all the
libraries that, when imported, alone do
NOT trigger the output, and it does NOT
trigger the output:

;; proof.sls --

(import (rnrs)
 (srfi and-let-star)
 (srfi args-fold)
 (srfi case-lambda)
 (srfi char-set)
 (srfi compare)
 (srfi cond-expand)
 (srfi cut)
  (srfi format)
  (srfi let-values)
  (srfi lists)
  (srfi parameters)
  (srfi random)
  (srfi rec)
  (srfi receive)
  (srfi sharing)
  (srfi streams)
  (srfi string-ports)
  (srfi time))
(display 123)
;;; end of file

Derick is using an INCLUDE/RESOLVE form
to include source files, but it does not
seem to cause problems because it does it
in (srfi time), which is loaded without
output messages.

The lightweight testing library loads
the eager comp library, so it may be that
the ec library is the culprit.

 We expect to add a bunch of SRFIs as
 R6RS libraries after SRFI 97 becomes
 final[...]

Thanks.
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] finding libraries

2008-12-09 Thread Marco Maggi
Jon Wells wrote:
Has there ever been any discussion of
allowing import clauses to appear
anywhere other than the toplevel...

I cannot speak for R6RS requests, but
Ikarus allows it in non-R6RS mode.
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] finding libraries

2008-12-24 Thread Marco Maggi
William D Clinger wrote:
Here's a brief report on their status
in the current development version of
Larceny: [...]

Thanks for all of this (the website
restyling is also good). In the next
weeks I will try to add support for
Larceny to my infrastructure.

Can I ask for a word on the status of
the FFI? I do not strictly need the
callbacks right now, but can I trust
the callout mechanism and the raw
pokers and peekers?

For the non-Schemers reading this: it
seems that I have successfully built
larceny checkout 5877 with the following
bash script (which requires a binary
distribution of larceny already installed)
on a i686-pc-linux-gnu:

# make-larceny.sh --
#
set -ex
SCHEME='/opt/larceny/0.97/larceny -r5rs'
echo 
(load \setup.sch\)
(setup 'scheme: 'larceny 'host: 'linux86 'sassy 'string-rep: 'flat4)
(build-config-files)
(load-compiler)
(build-heap)
(build-runtime)
(build-executable)
(build-larceny-files)
 | ${SCHEME}
echo (exit) | ./larceny.bin -stopcopy -- src/Build/iasn-larceny-heap.fasl
echo (exit) | ./larceny.bin -stopcopy -- src/Build/iasn-twobit-heap.fasl
cp larceny twobit
echo 
(require 'r6rsmode)
(larceny:compile-r6rs-runtime)
(exit)
 | ./larceny
### end of file

-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] error compiling cons form

2008-12-26 Thread Marco Maggi
On a i686-pc-linux-gnu running larceny-5877
compiled with:

(setup 'scheme: 'larceny
   'host: 'linux86
   'sassy 'string-rep: 'flat4)

I COMPILE-LIBRARY file with this chunk of
code:

(define deferred-exceptions
  (make-parameter #f))

(define-syntax defer-exceptions
  (syntax-rules ()
((_ ?form0 ?form ...)
 (guard (exc (else
  (when (deferred-exceptions)
(deferred-exceptions
  (cons exc (deferred-exceptions))
   ?form0 ?form ...

Ypsilon and Ikarus run a test suite
for the library with no problems and
no failing tests.

Larceny gives me this error:

|Compiling uriel/lang.sls
|
|Error: no handler for exception #record compound-condition
|Compound condition has these components: 
|#record assertion
|#record who
|who : car
|#record message
|message :  () is not a pair.\n
|
|Terminating program execution.

but if I replace the form:

(cons exc (deferred-exceptions))

with:

(cons '(1 2) (deferred-exceptions))

compilation completes fine.

Posting the whole code is impossible,
if there is the need I can only give
you a distribution to download. But,
the following program compiles fine:

(import (rnrs))
(define-syntax defer-exceptions
  (syntax-rules ()
((_ ?form0 ?form ...)
 (guard (exc (else
  (cons exc #t)))
   ?form0 ?form ...

and the MAKE-PARAMETER in the failing
library is the following SRFI-39
implementation:

(define make-this-parameter
(case-lambda
 ((value validator)
  (let ((the-parm (make-parameter 'unnamed (validator value
(case-lambda
 ((value)
  (the-parm (validator value)))
 (()
  (the-parm)
 ((value)
  (make-this-parameter value (lambda (x) x)

which works with my test suite.

I really, really, really do not
want to know why compiling CONS
does this, just tell me if it is
a bug in the compiler and I have
to wait for a fix.

-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb



___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] error compiling cons form

2008-12-26 Thread Marco Maggi
The problem goes away if I do:

(define-syntax defer-exceptions
  (syntax-rules ()
((_ ?form0 ?form ...)
 (guard (exc (else
  (let ((e (deferred-exceptions)))
(and e (deferred-exceptions (cons exc e))
   ?form0 ?form ...

Marco Maggi wrote:
I really, really, really do not
want to know why compiling CONS
does this, just tell me if it is
a bug in the compiler and I have
to wait for a fix.

Sorry for the whining. :)
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] on porting to larceny

2008-12-27 Thread Marco Maggi
 the  error about (uriel  cstring), but in
Uriel's compilation script I have:

| (compile-library uriel/cstring.sls
|  uriel/cstring.larceny.slfasl)
| (compile-library uriel/foreign.sls
|  uriel/foreign.larceny.slfasl)

so cstring is compiled first.  I dunno what to do.

*** I  have added  a Larceny  shell script  to the
collection of GNU  Readline wrappers using Rlwrap.
I have  gathered a  set of completions  files.  Is
there an  automagic way to get a  list of non-R6RS
Larceny bindings that may be useful in R6RS mode?

-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] on porting to larceny

2008-12-28 Thread Marco Maggi
William D Clinger wrote:
Marco Moggi wrote:
 The built in PARAMETERIZE does not act as a
 LETREC-like form:

That has been logged as a requested enhancement
(ticket #601).

Thanks.

 If I have not missed it in the source, the FFI
 does not implement peekers and pokers for long
 double and long long.  They are unusual, but if
 the cost of adding them is small...

I don't think they are supported by all C compilers,
so trying to support them in our basic FFI might
compromise portability.  Perhaps they should go into
a dynamically loadable library.

I agree. In fact, Nausicaa already has a Stubs
project to collect C language libraries that
do strange things. I can add a library
to handle long long and long double values as
blocks of memory, and provide the to_string
feature (so that, for example, one can use
the GNU Scientific Library's vectors and matrix
functions for long double).

I revised the main Wiki page.

Looks good to me.

 Cough... sorry for making myself a nuisance,
 but can LARCENYLIBPATH be renamed to
 LARCENY_LIBPATH? It would be more readable.

Will do.

Thanks. :-)

 I tried to run compiled Larceny programs using
 the binfmt_misc Linux  kernel module, but it has
 not worked  because larceny -r6rs  -program does
 not like compiled files.

I don't know anything about binfmt_misc, but I do
know that Larceny runs compiled top-level programs
via a larceny -r6rs -program mypgm command.

My fault! It works. It goes like this:

1. at system boot load the binfmt module
   by putting in a shell boot script (on a
   Slackware system /etc/rc.d/rc.modules):

|  /sbin/modprobe binfmt_misc

2. put in a system shell boot script (on Slackware
   /etc/rc.d/rc.local):

| if test -f /proc/sys/fs/binfmt_misc/register ; then
|echo enabling Larceny compiled files execution
|echo ':LARCENY:M:2:fasl::/opt/larceny/last/scheme-script:'\ |  
/proc/sys/fs/binfmt_misc/register
| else
|echo 'skipping Larceny compiled files execution (binfmt_misc not ready)'
| fi

   which tells the Linux kernel to do the following
   when running an executable file: look at offset 2
   in the file for the string fasl, and if it is
   there run the file using the given scheme-script
   pathname;

3. write a Larceny program and COMPILE-FILE it,
   obtaining, say, proof.sps.slfasl;

4. give it a beautiful name and make it
   executable:

|   $ mv proof.sps.slfasl proof
|   $ chmod 0755 proof

5. run it:

$ ./proof

6. the original source file is not needed,
   we can remove it and install the compiled
   program in a PATH directory.

We can inspect the status of the executable
files record with:

|  $ cat /proc/sys/fs/binfmt_misc/LARCENY

disable it with (as root):

|  $ echo 0 /proc/sys/fs/binfmt_misc/LARCENY

enable it with (as root):

|  $ echo 1 /proc/sys/fs/binfmt_misc/LARCENY

and remove this record with (as root):

|  $ echo -1 /proc/sys/fs/binfmt_misc/LARCENY

Nice! :-)

 I cannot use COMPILE-STALE-LIBRARIES [...]

That has been logged as a requested enhancement
(ticket #602).

Fine.

Are you saying that you have some program A that
works sometimes but not others, without any
intervening changes to program A or to any of the
libraries or to any compiled files at all?

I can say nothing for sure. :-/ I found a precedence
error in my compilation script, but after having
solved it I get a Client was expanded ... error
about (rnrs mutable-string) when compiling
(uriel lang) but I have not changed the Larceny
installation.

Can you confirm that only the timestamps are
involved? I ask this because maybe it is my
laptop (I had a calendar clock reset, so maybe
some timestamp is broken somewhere in the
file systems).

 Larceny's apropos procedure can be
 used to compute a list of *all* variables
 present within the current interaction
 environment.

Thanks this is enough to start.

-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] on porting to larceny

2008-12-29 Thread Marco Maggi
Oll Korrect. After restarting from a
fresh Larceny installation everything
works. The POSIX interface is running,
too (of course errors are not reported
correctly without the errno interface).
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] on porting to larceny

2009-01-01 Thread Marco Maggi
William D Clinger wrote:
 As an extremely temporary measure (to be
 fixed within a few days), Marco can use
 the following definitions:

  (define (get-errno)
(syscall 47))

The tests I have done[1][2] give me the same
results with all the Scheme implementations,
so from my point of view it works. (It is a
single-threaded point of view.)

[1] http://github.com/marcomaggi/nausicaa/tree/master/uriel/tests/test-ffi.sps
[2] 
http://github.com/marcomaggi/nausicaa/tree/master/uriel/libraries/uriel/ffi/compat.larceny.sls
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] Re

2009-01-02 Thread Marco Maggi
William D Clinger wrote:
 Peter Keller wrote:
 No function in this volume of IEEE Std
 1003.1-2001 shall set errno to 0.

 Just to keep that in mind

 Right.  So, quoting more from that same link,
 the paradigm is:

   An application that needs to examine the
   value of errno to determine the error should
   set it to 0 before a function call, then
   inspect it before a subsequent function call.

Peter Keller wrote:
 The question becomes, if someone writes a scheme
 layer wrapping the libc layer, then do they
 violate POSIX semantics in the context of the
 scheme layer if their wrapper sets errno to zero
 before calling the glibc function associated with
 it?

I dunno if there is value in letting the POSIX
semantics filter through a Scheme layer, what
I know is that there are functions, like
readdir(), for which setting errno to zero
before the call is the only way to distinguish
an error condition from another event.

So setting errno is a mandatory feature.
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb




___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] srfi-19 testing and larceny-5889 errors

2009-01-07 Thread Marco Maggi
In my effort to test srfi-19 I have
written:

http://github.com/marcomaggi/nausicaa/tree/master/srfi/tests/test-time.sps

which shows errors when loading (srfi :19)
from Larceny into Larceny-5889.

My modified reference implementation:

http://github.com/marcomaggi/nausicaa/tree/master/srfi/libraries/srfi/time.sls

passes most of the tests (the wrong ones
are DATE-STRING with ~U and ~V escape
sequences, for which I still have to
understand exactly what the SRFI document
requires and if it conforms to what GNU
date prints).

I do not guarantee that my modified
implementation does the right thing, but
with some of the tests IMHO Larceny really
does the wrong thing.

Notice also:

http://srfi.schemers.org/srfi-19/post-mail-archive/msg00029.html

I will stick with what the reference
implementation does...
-- 
Marco Maggi

Now feel the funk blast!
Rage Against the Machine - Calm like a bomb


___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] Bootstrapping...

2009-04-21 Thread Marco Maggi
David Rush wrote:
 I am of course referring the bootstrapping of
 Larceny in the cases where there is any kind
 of a library mismatch from the supported
 distributions.

I am not sure to understand correctly... You
used to rely on a PLT installation to build
Larceny from its sources, and now this is a
problem because PLT itself does not build
correctly?

So something is preventing you from trying
to boot Larceny using a Larceny binary
distribution? If this is the case, maybe the
problem to solve is why Larceny-binary does
not run on your system?

I can successfully build Larceny on the
latest Slackware on my x86 netbook using the
prebuilt distribution from:

http://www.ccs.neu.edu/home/will/Larceny/download.html

can you? If not why?

HTH
-- 
Marco Maggi




___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] writing values writes the first value only

2009-06-03 Thread Marco Maggi
Ciao,

  using Larceny checkout 6282 on i686-pc-linux-gnu I see:

(write (values 123 456))
= 123

while Ikarus raises an  incorrect number of values returned
to single value context error, and Ypsilon prints #values
123 456.   Larceny's behaviour is confusing  when WRITE is
used for debugging purposes.  Can something be done?

  I do  not want  to enter a  debate over the  True Semantic
Meaning of things, I just want some help when debugging.

TIA

P.S.  Sorry if  this has been discussed before.   Is there a
way to  search the  mailing list archive  better than  a row
google  search   on  larceny-users  write   values?
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] writing values writes the first value only

2009-06-28 Thread Marco Maggi
I have written:
 In Larceny revision 6303  the state-set function tests for
 the state vector length to be 7, it its length is actually
 6.

Sorry, this is a wrong report.  I confused the original file
in  the  reference  implementation  with a  file  I  already
started to modify some time ago.  The chunk of code:

  (if (and (list? external-state)
   (= (length external-state) 7)
   (eq? (car external-state) 'lecuyer-mrg32k3a))

in the function mrg32k3a-state-set is correct in Larceny.
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] weird error message compiling library

2009-06-29 Thread Marco Maggi
I  get the following  error while  compiling a  library with
Larceny revision 6303 on a i686-pc-linux-gnu:

Compiling random.sls
ERROR detected by compiler:
Wrong number of arguments to known procedure 
((begin \x2e;\x0;make-integer~1aiicu~25147\x7c;958))
Error while loading src/Build/iasn-larceny-heap.fasl
larceny.heap, built on Fri Jun 26 16:17:13 CEST 2009

the same  library is loaded, compiled and  tested fine under
Ikarus, Mosh and Ypsilon.   I have been wrong multiple times
these days, whose to blame here?

  To  have a  look  at the  library  (still in  development)
source code:

1. Go here:

http://github.com/marcomaggi/nausicaa/tree/master

2. Browse the repository: scheme/src/library/random.sls

or try the following ugly URL:

http://github.com/marcomaggi/nausicaa/blob/25e23467cf948eb464704595e5a247d11bbd0158/scheme/src/libraries/random.sls

The symbol make-integer appears 3 times in the library, in
the body of a CASE-LAMBDA:

(define (make-integer n)
  (if (and (integer? n) (exact? n) (positive? n))
  (mod (next-integer) n)
(assertion-violation 'integers-maker
  range upper limit must be an exact positive integer n)))

(define (make-real)
  (* (inexact (make-integer)) const:1/2^32^2))

and:

(:random-source-make
  ---
  (lambda (n) ; integers-maker
(make-integer n))
  ---)

TIA
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] error peeking short values from raw memory

2009-07-09 Thread Marco Maggi
Felix Klock wrote:
 Filed as Ticket #646 and fixed by changeset:6344.

Confirmed, it is fixed.
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] [long] identifier bindings and visibility across phases

2009-10-04 Thread Marco Maggi
Ciao,

  I am trying to implement  an expansion time feature for my
R6RS  libraries;   basically  it  works   like  this,  using
identifier macros:

(define-record-extension string
  (fields (length string-length #f)
  (upcase string-upcase #f)
  (dncase string-downcase #f)))

(let ((S Ciao))

  (with-virtual-fields ((length string S))
length)
  ; = 4

  (with-virtual-fields (((upcase dncase) string S))
(list upcase dncase))
  ; = (CIAO ciao))

I have prepared an  archive of test files[1] with everything
in it, which can be  downloaded from the Downloads page of
Nausicaa[2].

  As the tests show, the basic feature works when the record
extension  is in the  same file  that makes  use of  it; but
there  is a  problem  when  the extension  is  defined in  a
library (lib-test-2.sls).

  With the test in test.sps:

(with-virtual-fields ((def beta o))
  def)

I get the following error:



Syntax violation: invalid reference

No binding available for beta-def-ref in library (...program...)

Form: beta-def-ref

Trace:

  (beta-def-ref the-record)

  def

  (lambda (the-record)
  (let-syntax
((def (identifier-syntax
(_ (beta-def-ref the-record))
((set! _ e) (beta-def-set! the-record e)
(with-virtual-fields () (set! def '(90 91)) def)))

  ((lambda (the-record)
   (let-syntax
 ((def (identifier-syntax
 (_ (beta-def-ref the-record))
 ((set! _ e) (beta-def-set! the-record e)
 (with-virtual-fields () (set! def '(90 91)) def)))
 o)

  (let-syntax
  ((dummy (lambda (stx)
(syntax-case
  stx
  ()
  ((_ ?kontext)
   (let ((RTD (record-type-descriptor beta)))
 (with-syntax
   (((EXPR) (datum-syntax #'?kontext '(o)))
((VAR ...) (datum-syntax #'?kontext '(def)))
((ACCESSOR ...)
 `(,(%virtual-field-accessor 'beta RTD 'def)))
((MUTATOR ...)
 `(,(%virtual-field-mutator 'beta RTD 'def)))
((FORMS ...)
 (datum-syntax
   #'?kontext
   '((with-virtual-fields () (set! def '(90 91)) def)
   #'(let ((the-record EXPR))
   (let-syntax
 ((VAR (identifier-syntax
 (_ (ACCESSOR the-record))
 ((set! _ e) (MUTATOR the-record e
  ...)
 FORMS
 ...)
  (dummy beta))

  (with-virtual-fields
  def def)) beta o))
  (with-virtual-fields () (set! def '(90 91)) def))

  (with-virtual-fields
  (((def) beta o))
  (set! def '(90 91))
  def)

  (write (with-virtual-fields
 (((def) beta o))
 (set! def '(90 91))
 def))

  (lambda (o)
  (write (with-virtual-fields ((def beta o)) def))
  (newline)
  (write (with-virtual-fields
   (((def) beta o))
   (set! def '(90 91))
   def))
  (newline))

  ((lambda (o)
   (write (with-virtual-fields ((def beta o)) def))
   (newline)
   (write (with-virtual-fields
(((def) beta o))
(set! def '(90 91))
def))
   (newline))
 (make beta 1 2 3 4 5 6))


Error: no handler for exception #record compound-condition
Compound condition has these components:
#record who
who : invalid reference
#record message
message : No binding available for beta-def-ref in library (...program...)
#record syntax
form : beta-def-ref
subform : #f

Terminating program execution.



the test  fully works with Ikarus and  Ypsilon (and probably
it will work with Mosh, too, when Issue 102 is solved); only
Larceny fails, so  I understand it is a  phasing problem.  I
am  not  able  to   understand  how  to  change  the  import
specifications of the libraries to make the code work; I am
still learning how phasing works...

  Anyway, in the definition of DEFINE-RECORD-EXTENSION I do:

(datum-syntax #'?kontext '?accessor)

where,   IMHO,   ?kontext   holds  the   correct   context
informations to  make everything work,  whatever the context
in which  the output form of WITH-VIRTUAL-FIELDS  ends up to
be.

  What is wrong?

TIA

[1] 
http://cloud.github.com/downloads/marcomaggi/nausicaa/virtual-fields.tar.gz
[2] http://github.com/marcomaggi/nausicaa/downloads
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] [long] identifier bindings and visibility across phases

2009-10-06 Thread Marco Maggi
Andre van Tonder wrote:
 On Tue, 6 Oct 2009, Andre van Tonder wrote:
 
  WOPPA is not exported from library DEF, so any attempt to refer to it from
  outside DEF should fail.  The behavior of Larceny and Ypsilon are correct,
  and that of Ikarus and Mosh are incorrect.
 
 Reconsidering, I think this might be underspecified in R6RS, so both
 behaviours might be fine.

Thanks, I see that changing (def) to:

(library (def)
  (export woppa)
  (import (rnrs) (lib))
  (define (woppa) 123)
  (define-thing woppa woppa))

makes everything work; are  there relevant paragraphs in the
R6RS  documents?   It  seems  to  me  that  the  chapter  on
SYNTAX-CASE  says  nothing  about non-exported  bindings  in
syntax objects.

  But, if it is an export problem, why the following works?
BLUE is not exported by (sublib):

(library (sublib)
  (export h)
  (import (rnrs))
  (define (blue)
456)
  (define h
(make-eq-hashtable))
  (hashtable-set! h 'b blue))

(library (lib)
  (export thing)
  (import (rnrs) (for (sublib) expand run))
  (define-syntax thing
(lambda (stx)
  (syntax-case stx ()
((_)
 (with-syntax ((f (hashtable-ref h 'b #f)))
   #'('f)))

;;; the program
(import (rnrs) (lib))
(write (thing))

is it  a specific  interaction between exporting  and syntax
objects?  The following works with Ikarus, Mosh and Ypsilon;
it fails only on Larceny:

(library (sublib)
  (export h)
  (import (rnrs))
  (define (blue)
456)
  (define h
(make-eq-hashtable))
  (hashtable-set! h 'b (syntax blue)))

(library (lib)
  (export thing)
  (import (rnrs) (for (sublib) expand run))
  (define-syntax thing
(lambda (stx)
  (syntax-case stx ()
((_)
 (with-syntax ((f (hashtable-ref h 'b #f)))
   #'(f)))

;;; the program
(import (rnrs) (lib))
(write (thing))

-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] [long] identifier bindings and visibility across phases

2009-10-06 Thread Marco Maggi
I have written:
   But, if it is an export problem, why the following works?
 BLUE is not exported by (sublib):
 
 (library (sublib)
   (export h)
   (import (rnrs))
   (define (blue)
 456)
   (define h
 (make-eq-hashtable))
   (hashtable-set! h 'b blue))
 
 (library (lib)
   (export thing)
   (import (rnrs) (for (sublib) expand run))
   (define-syntax thing
 (lambda (stx)
   (syntax-case stx ()
   ((_)
(with-syntax ((f (hashtable-ref h 'b #f)))
  #'('f)))
 
 ;;; the program
 (import (rnrs) (lib))
 (write (thing))

Okay,  that  is  a  stupid  example...  Anyway,  why  is  it
different from:

 (library (sublib)
   (export h)
   (import (rnrs))
   (define (blue)
 456)
   (define h
 (make-eq-hashtable))
   (hashtable-set! h 'b (syntax blue)))
 
 (library (lib)
   (export thing)
   (import (rnrs) (for (sublib) expand run))
   (define-syntax thing
 (lambda (stx)
   (syntax-case stx ()
   ((_)
(with-syntax ((f (hashtable-ref h 'b #f)))
  #'(f)))
 
 ;;; the program
 (import (rnrs) (lib))
 (write (thing))

? Creating a  syntax object is done exactly  to maintain the
lexical context informations, no?
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] documentation license

2009-10-15 Thread Marco Maggi
Ciao,

  as  a  companion  to   the  huge  documentation  file  for
Nausicaa[0],  I   would  like  to   prepare  a  Larceny-only
documentation  file; it  should be  an introduction  to: the
usage of the larceny  executable; how libraries are found;
other bits.

  I am interested in taking  stuff from the page at [1], but
I do not  see a copyright notice.  If  possible, can someone
give me directives?

[0] http://marcomaggi.github.com/docs/nausicaa.html
[1] http://www.ccs.neu.edu/home/lth/larceny/manual/ffi.html
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] uncatchable syntax violation

2009-11-05 Thread Marco Maggi
Felix Klock wrote:
 Marco: is  this consistent  with your experience?   Or are
 you actually seeing the operating system process terminate
 before the end of the program has been reached?

I get the  same thing you get.  I  thought the process was
terminated; I was tricked by the error message.
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] Larceny's FFI wins, I loose

2009-11-13 Thread Marco Maggi
Ciao,

  I admit  my defeat  and ask for  help with  the following:
Under R6RS mode, is there  a way to build callback functions
as described in[1]?

  Looking  at Larceny's  code, there  seems to  be a  way to
build trampolines and wrapping them around Scheme functions,
but I do not understand how to do it.

TIA

[1] http://marcomaggi.github.com/docs/nausicaa.html#ffi-call-back
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


Re: [Larceny-users] Exporting 'fields'

2009-12-29 Thread Marco Maggi
Eduardo Cavazos wrote:
 I  have a  library  which  acts as  a  wrapper around  the
 '(rnrs)'  library.  I.e. it  simply re-exports  some stuff
 from rnrs plus some other things.

This is what I do in the following libraries:

http://github.com/marcomaggi/nausicaa/raw/master/scheme/src/libraries/nausicaa.larceny.sls
http://github.com/marcomaggi/nausicaa/raw/master/scheme/src/libraries/nausicaa.ikarus.sls
http://github.com/marcomaggi/nausicaa/raw/master/scheme/src/libraries/nausicaa.mosh.sls
http://github.com/marcomaggi/nausicaa/raw/master/scheme/src/libraries/nausicaa.ypsilon.sls

HTH
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users


[Larceny-users] rebuilding from a checkout

2010-09-20 Thread Marco Maggi
Ciao,

  after building Larceny from  a repository checkout, I want
to rebuild  it from  scratch; there is  no make  clean, so
what do I do?  I  was not able to find relevant informations
in the doc directory.

  Trying  to just  rebuild  revision 6420  running again  my
build script gives me an error:

   Loading Larceny compatibility package.
  src/Compat/Larceny/compat2.fasl


  Error: enable-interrupts: not a fixnum: (larceny . host-system)
  Entering debugger; type ? for help.
  debug Bad command.  ? for help.
  debug Bad command.  ? for help.
  debug Bad command.  ? for help.
  debug Bad command.  ? for help.
  debug Bad command.  ? for help.
  debug Bad command.  ? for help.
  debug #EOF

somewhere while evaluating:

  (load setup.sch)
  (setup 'scheme: 'larceny 'host: 'linux86 'sassy 'string-rep: 'flat4)
  (build-config-files)
  (load-compiler)
  (build-heap)
  (build-runtime)
  (build-executable)
  (build-larceny-files)

TIA
-- 
Marco Maggi

___
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users