[Larceny-users] SRFIs in R6RS mode
Ken Dickey
Ken.Dickey at whidbey.com
Wed Feb 27 21:01:06 EST 2008
Greetings,
I am attempting to write portable R6RS code which makes use of implementation
specific features wrapped in a library.
My approach is to have a larceny-specific.sls, ikarus-specific.sls,
r6rs-default.sls each separately linked [copied in Windoz] to a file with the
common name "implementation-specific.sls" which is local to the library
include path of the implementation [the library paths are all different,
anyway!].
My copy of format.sls imports library "implementation-specific", which works
for the (presumably small) number of variant imports required.
I have not yet determined how to do this for Larceny Scheme.
--------diagnostic--------
Syntax violation: library
Unbound export
Subform: write-with-shared-structure
--------invocation---------
larceny -r6rs --path /usr/local/src/TinyTalk -program "tiny-tests.ss"
----------version----------
export LARCENY_ROOT=/usr/local/src/Larceny-0.961/bin-native-ia32-linux86
-----------------------------
Larceny v0.961 "Fluoridation" (Jan 2 2008 08:01:50, precise:Linux:unified)
larceny.heap, built on Wed Jan 2 08:11:02 EST 2008
-----------------------------
My attempts have been along the lines of:
===============================================
#!r6rs
;;; FILE "larceny-dependent.sls"
;;; IMPLEMENTS Larceny specific compatability functions
;;; AUTHOR Ken [dot] Dickey [at] Whidbey [dot] Com
;;;COPYRIGHT (c) 2008 by Kenneth A Dickey. All rights reserved.
;;;
;;;Permission is hereby granted, free of charge, to any person
;; <...foss legal boiler plate elided...>
;; USAGE: copy or link to Larceny lib dir with name:
;; "implementation-dependent.sls"
(library (implementation-dependent)
(export
dont-print
;; from srfi-6 "basic string ports"
open-output-string get-output-string
write-with-shared-structure ;; srfi-38
pretty-print
)
(import
(rnrs)
(larceny load)
(rnrs io simple)
(rnrs mutable-pairs (6))
(rnrs lists (6))
)
(define dont-print (if (eq? #t #f) 1))
;;(require 'srfi-6) @@@ no-op @@@
;; Will, how best to expose string ports?
(define %string-port-alist% '())
(define (open-output-string)
(let-values ( [(port get-output) (open-string-output-port)] )
(set! %string-port-alist%
(cons (cons port get-output) %string-port-alist%))
port))
(define (get-output-string port)
;; NB: one-shot -- removes accessor to allow gc'ing the port
(let ( [probe (assq port %string-port-alist%)] )
(if probe
(begin
(set! %string-port-alist% (remq probe %string-port-alist%))
(cdr probe))
(error 'get-output-string "could not find accessor for port" port))))
;(require 'srfi-38) ;; write-with-shared-structure
;;(load "lib/SRFI/srfi-38.sch")
(load "/usr/local/src/Larceny-0.961/bin-native-ia32-linux86/lib//SRFI/srfi-38.sch")
;(load "lib/Standard/pretty.sch") ;; pretty-print
(load "/usr/local/src/Larceny-0.961/bin-native-ia32-linux86/lib/Standard/pretty.sch")
)
===============================================
Any help is appreciated.
Thanks in advance,
-KenD
PS: I am _not_ a readed of this list.
More information about the Larceny-users
mailing list