~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to sigscheme/doc/spec.html

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 
2
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
3
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 
4
<head>
 
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
6
<meta name="generator" content="AsciiDoc 7.0.2" />
 
7
<style type="text/css">
 
8
/* Debug borders */
 
9
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
 
10
/*
 
11
  border: 1px solid red;
 
12
*/
 
13
}
 
14
 
 
15
body {
 
16
  margin: 1em 5% 1em 5%;
 
17
}
 
18
 
 
19
a { color: blue; }
 
20
a:visited { color: fuchsia; }
 
21
 
 
22
em {
 
23
  font-style: italic;
 
24
}
 
25
 
 
26
strong {
 
27
  font-weight: bold;
 
28
}
 
29
 
 
30
tt {
 
31
  color: navy;
 
32
}
 
33
 
 
34
h1, h2, h3, h4, h5, h6 {
 
35
  color: #527bbd;
 
36
  font-family: sans-serif;
 
37
  margin-top: 1.2em;
 
38
  margin-bottom: 0.5em;
 
39
  line-height: 1.3;
 
40
}
 
41
 
 
42
h1 {
 
43
  border-bottom: 2px solid silver;
 
44
}
 
45
h2 {
 
46
  border-bottom: 2px solid silver;
 
47
  padding-top: 0.5em;
 
48
}
 
49
 
 
50
div.sectionbody {
 
51
  font-family: serif;
 
52
  margin-left: 0;
 
53
}
 
54
 
 
55
hr {
 
56
  border: 1px solid silver;
 
57
}
 
58
 
 
59
p {
 
60
  margin-top: 0.5em;
 
61
  margin-bottom: 0.5em;
 
62
}
 
63
 
 
64
pre {
 
65
  padding: 0;
 
66
  margin: 0;
 
67
}
 
68
 
 
69
span#author {
 
70
  color: #527bbd;
 
71
  font-family: sans-serif;
 
72
  font-weight: bold;
 
73
  font-size: 1.2em;
 
74
}
 
75
span#email {
 
76
}
 
77
span#revision {
 
78
  font-family: sans-serif;
 
79
}
 
80
 
 
81
div#footer {
 
82
  font-family: sans-serif;
 
83
  font-size: small;
 
84
  border-top: 2px solid silver;
 
85
  padding-top: 0.5em;
 
86
  margin-top: 4.0em;
 
87
}
 
88
div#footer-text {
 
89
  float: left;
 
90
  padding-bottom: 0.5em;
 
91
}
 
92
div#footer-badges {
 
93
  float: right;
 
94
  padding-bottom: 0.5em;
 
95
}
 
96
 
 
97
div#preamble,
 
98
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
 
99
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
 
100
div.admonitionblock {
 
101
  margin-right: 10%;
 
102
  margin-top: 1.5em;
 
103
  margin-bottom: 1.5em;
 
104
}
 
105
div.admonitionblock {
 
106
  margin-top: 2.5em;
 
107
  margin-bottom: 2.5em;
 
108
}
 
109
 
 
110
div.content { /* Block element content. */
 
111
  padding: 0;
 
112
}
 
113
 
 
114
/* Block element titles. */
 
115
div.title, caption.title {
 
116
  font-family: sans-serif;
 
117
  font-weight: bold;
 
118
  text-align: left;
 
119
  margin-top: 1.0em;
 
120
  margin-bottom: 0.5em;
 
121
}
 
122
div.title + * {
 
123
  margin-top: 0;
 
124
}
 
125
 
 
126
td div.title:first-child {
 
127
  margin-top: 0.0em;
 
128
}
 
129
div.content div.title:first-child {
 
130
  margin-top: 0.0em;
 
131
}
 
132
div.content + div.title {
 
133
  margin-top: 0.0em;
 
134
}
 
135
 
 
136
div.sidebarblock > div.content {
 
137
  background: #ffffee;
 
138
  border: 1px solid silver;
 
139
  padding: 0.5em;
 
140
}
 
141
 
 
142
div.listingblock > div.content {
 
143
  border: 1px solid silver;
 
144
  background: #f4f4f4;
 
145
  padding: 0.5em;
 
146
}
 
147
 
 
148
div.quoteblock > div.content {
 
149
  padding-left: 2.0em;
 
150
}
 
151
div.quoteblock .attribution {
 
152
  text-align: right;
 
153
}
 
154
 
 
155
div.admonitionblock .icon {
 
156
  vertical-align: top;
 
157
  font-size: 1.1em;
 
158
  font-weight: bold;
 
159
  text-decoration: underline;
 
160
  color: #527bbd;
 
161
  padding-right: 0.5em;
 
162
}
 
163
div.admonitionblock td.content {
 
164
  padding-left: 0.5em;
 
165
  border-left: 2px solid silver;
 
166
}
 
167
 
 
168
div.exampleblock > div.content {
 
169
  border-left: 2px solid silver;
 
170
  padding: 0.5em;
 
171
}
 
172
 
 
173
div.verseblock div.content {
 
174
  white-space: pre;
 
175
}
 
176
 
 
177
div.imageblock div.content { padding-left: 0; }
 
178
div.imageblock img { border: 1px solid silver; }
 
179
span.image img { border-style: none; }
 
180
 
 
181
dl {
 
182
  margin-top: 0.8em;
 
183
  margin-bottom: 0.8em;
 
184
}
 
185
dt {
 
186
  margin-top: 0.5em;
 
187
  margin-bottom: 0;
 
188
  font-style: italic;
 
189
}
 
190
dd > *:first-child {
 
191
  margin-top: 0;
 
192
}
 
193
 
 
194
ul, ol {
 
195
    list-style-position: outside;
 
196
}
 
197
ol.olist2 {
 
198
  list-style-type: lower-alpha;
 
199
}
 
200
 
 
201
div.tableblock > table {
 
202
  border-color: #527bbd;
 
203
  border-width: 3px;
 
204
}
 
205
thead {
 
206
  font-family: sans-serif;
 
207
  font-weight: bold;
 
208
}
 
209
tfoot {
 
210
  font-weight: bold;
 
211
}
 
212
 
 
213
div.hlist {
 
214
  margin-top: 0.8em;
 
215
  margin-bottom: 0.8em;
 
216
}
 
217
td.hlist1 {
 
218
  vertical-align: top;
 
219
  font-style: italic;
 
220
  padding-right: 0.8em;
 
221
}
 
222
td.hlist2 {
 
223
  vertical-align: top;
 
224
}
 
225
 
 
226
@media print {
 
227
  div#footer-badges { display: none; }
 
228
}
 
229
/* Workarounds for IE6's broken and incomplete CSS2. */
 
230
 
 
231
div.sidebar-content {
 
232
  background: #ffffee;
 
233
  border: 1px solid silver;
 
234
  padding: 0.5em;
 
235
}
 
236
div.sidebar-title, div.image-title {
 
237
  font-family: sans-serif;
 
238
  font-weight: bold;
 
239
  margin-top: 0.0em;
 
240
  margin-bottom: 0.5em;
 
241
}
 
242
 
 
243
div.listingblock div.content {
 
244
  border: 1px solid silver;
 
245
  background: #f4f4f4;
 
246
  padding: 0.5em;
 
247
}
 
248
 
 
249
div.quoteblock-content {
 
250
  padding-left: 2.0em;
 
251
}
 
252
 
 
253
div.exampleblock-content {
 
254
  border-left: 2px solid silver;
 
255
  padding-left: 0.5em;
 
256
}
 
257
</style>
 
258
<title>Specifications of SigScheme</title>
 
259
</head>
 
260
<body>
 
261
<div id="header">
 
262
<h1>Specifications of SigScheme</h1>
 
263
</div>
 
264
<h2>1. General</h2>
 
265
<div class="sectionbody">
 
266
<h3>1.1. 64-bit data models</h3>
 
267
<p>Supports LL64, LLP64, LP64 and ILP64 on both storage-fatty and storage-compact.</p>
 
268
<h3>1.2. Addressable memory space</h3>
 
269
<p>Ordinary storage implementation can address any Scheme object scattered on
 
270
whole memory space. Both storage-fatty and storage-compact have no
 
271
limitation on any 32 and 64-bit data models. But it may be limited if a
 
272
storage implementation is designed to do so for some specific advantages,
 
273
as like GNU Emacs' 28-bit tagged pointer does.</p>
 
274
<h3>1.3. Integer range</h3>
 
275
<p>Current implementation only supports fixnum, and its range varies by the
 
276
user-selected underlying storage implementation. The range can be known via
 
277
R6RS (R5.91RS) compatible <tt>(fixnum-width)</tt>, <tt>(least-fixnum)</tt> and
 
278
<tt>(greatest-fixnum)</tt>.</p>
 
279
</div>
 
280
<h2>2. R5RS conformance</h2>
 
281
<div class="sectionbody">
 
282
<h3>2.1. Proper tail recursion</h3>
 
283
<p>Supported. But the conformance of <tt>eval</tt> procedure is uncertain. See the
 
284
comments of <tt>scm_p_eval()</tt> and <tt>rec-by-eval</tt> of <tt>test-tail-rec.scm</tt> for further
 
285
information about <tt>eval</tt>.</p>
 
286
<h3>2.2. Continuations</h3>
 
287
<p>Limited to nested use due to its setjmp/longjmp implementation. If a
 
288
continuation that is not an ancestor of current continuation called, all
 
289
continuation objects lying between the curent and the common ancestor of
 
290
the destination are invalidated. Calling an invalidated continuation object
 
291
causes an error.</p>
 
292
<h3>2.3. Macros</h3>
 
293
<p>The hygienic macros are fully supported. But although the macro expansion
 
294
engine itself works well and can be expected as R5RS-conformant, its
 
295
integration into SigScheme is not fully validated yet. It is likely having a
 
296
problem on identifier references.</p>
 
297
<h3>2.4. Numbers</h3>
 
298
<p>SigScheme supports only the integer part of the numerical tower.</p>
 
299
<h4>2.4.1. Literals</h4>
 
300
<p>SigScheme recognizes only these limited part of numerical forms of "7.1.1
 
301
Lexical structure" section of R5RS. Other valid R5RS forms for numbers produce
 
302
errors.</p>
 
303
<div class="listingblock">
 
304
<div class="content">
 
305
<pre><tt>  &lt;number&gt; --&gt; &lt;num 2&gt;| &lt;num 8&gt;
 
306
       | &lt;num 10&gt;| &lt;num 16&gt;
 
307
 
 
308
  &lt;num R&gt; --&gt; &lt;prefix R&gt; &lt;complex R&gt;
 
309
  &lt;complex R&gt; --&gt; &lt;real R&gt;
 
310
  &lt;real R&gt; --&gt; &lt;sign&gt; &lt;ureal R&gt;
 
311
  &lt;ureal R&gt; --&gt; &lt;uinteger R&gt;
 
312
  &lt;uinteger R&gt; --&gt; &lt;digit R&gt;+ #*   ;; '#' must not occur
 
313
  &lt;prefix R&gt; --&gt; &lt;radix R&gt;
 
314
 
 
315
  &lt;sign&gt; --&gt; &lt;empty&gt;  | + |  -
 
316
  &lt;radix 2&gt; --&gt; #b
 
317
  &lt;radix 8&gt; --&gt; #o
 
318
  &lt;radix 10&gt; --&gt; &lt;empty&gt; | #d
 
319
  &lt;radix 16&gt; --&gt; #x
 
320
  &lt;digit 2&gt; --&gt; 0 | 1
 
321
  &lt;digit 8&gt; --&gt; 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
 
322
  &lt;digit 10&gt; --&gt; &lt;digit&gt;
 
323
  &lt;digit 16&gt; --&gt; &lt;digit 10&gt; | a | b | c | d | e | f
 
324
  &lt;digit&gt; --&gt; 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9</tt></pre>
 
325
</div></div>
 
326
<p>SigScheme accepts only lower case alphabets as radices as follows. But
 
327
hexadecimal digits can be written as either lower or upper.</p>
 
328
<div class="listingblock">
 
329
<div class="content">
 
330
<pre><tt>  #b11  ==&gt;  3
 
331
  #B11  ==&gt;  error
 
332
  #xa1  ==&gt;  161
 
333
  #Xa1  ==&gt;  error
 
334
  #xAb  ==&gt;  171</tt></pre>
 
335
</div></div>
 
336
<p>SigScheme uses a fixed-size buffer for number literals parsing. Due to the
 
337
implementation, it can accept only one optional <em>0</em> prefix for maximum-length
 
338
binary number literals. Two or more <em>0</em> prefixes causes an error as follows.</p>
 
339
<div class="listingblock">
 
340
<div class="content">
 
341
<pre><tt>  ;; storage-compact on ILP32 env
 
342
 
 
343
  (greatest-fixnum)                      ==&gt; 2147483647
 
344
  #b11111111000000001111111100000000     ==&gt; 4278255360
 
345
  #b011111111000000001111111100000000    ==&gt; 4278255360
 
346
  #b0011111111000000001111111100000000   ==&gt; error
 
347
  #b00011111111000000001111111100000000  ==&gt; error</tt></pre>
 
348
</div></div>
 
349
<h4>2.4.2. Optional procedures</h4>
 
350
<p>The procedures <em>-</em> and <em>/</em> support following optional form.</p>
 
351
<div class="listingblock">
 
352
<div class="content">
 
353
<pre><tt>  6.2.5 Numerical operations
 
354
 
 
355
  optional procedure: - z1 z2 ...
 
356
  optional procedure: / z1 z2 ...</tt></pre>
 
357
</div></div>
 
358
<h3>2.5. Characters</h3>
 
359
<p>All character category-sensitive procedures and predicates (such as
 
360
char-upcase) work correctly only in ASCII range. i.e. Neither Unicode
 
361
processing specified in SRFI-75 nor other non-Unicode multibyte character
 
362
processing are supported in such procedures/predicates.</p>
 
363
<h3>2.6. Case-insensitive character comparison</h3>
 
364
<p>SigScheme's case-insensitive comparison conforms to the foldcase'ed
 
365
comparison described in SRFI-75 and SRFI-13, although R5RS does not specify
 
366
comparison between alphabetic and non-alphabetic char.</p>
 
367
<p>See the description in operations.c for further details.</p>
 
368
<h3>2.7. Case-sensitive identifiers</h3>
 
369
<p>SigScheme does distinguish letter case in indentifiers. Although case
 
370
insensitivity is required in R5RS as follows, it is hard to accept for the
 
371
our application.</p>
 
372
<div class="listingblock">
 
373
<div class="content">
 
374
<pre><tt>  2. Lexical conventions
 
375
 
 
376
  Upper and lower case forms of a letter are never distinguished except
 
377
  within character and string constants. For example, `Foo' is the same
 
378
  identifier as `FOO', and #x1AB is the same number as #X1ab.</tt></pre>
 
379
</div></div>
 
380
<h3>2.8. Constant string</h3>
 
381
<p>SigScheme treats string literals as constant as specified in R5RS.</p>
 
382
<div class="exampleblock">
 
383
<div class="title">Example: constant string</div>
 
384
<div class="exampleblock-content">
 
385
<div class="literalblock">
 
386
<div class="content">
 
387
<pre><tt>sscm&gt; (string-set! "foo" 0 #\F)
 
388
Error: in string-set!: attempted to modify immutable string: "foo"</tt></pre>
 
389
</div></div>
 
390
<div class="literalblock">
 
391
<div class="content">
 
392
<pre><tt>sscm&gt; (string-set! (string-copy "foo") 0 #\F)
 
393
"Foo"</tt></pre>
 
394
</div></div>
 
395
</div></div>
 
396
<h3>2.9. Constant list</h3>
 
397
<p>SigScheme inhibits modification of constant list object by default as
 
398
specified in R5RS, if the storage implementation suports it. storage-fatty
 
399
supports it, but storage-compact does not due to no bit space for pair
 
400
object.</p>
 
401
<p>The behavior can be changed by <tt>SCM_CONST_LIST_LITERAL</tt>.</p>
 
402
<div class="listingblock">
 
403
<div class="content">
 
404
<pre><tt>  4.1.2 Literal expressions
 
405
 
 
406
      `(quote &lt;datum&gt;)' may be abbreviated as '&lt;datum&gt;. The two notations
 
407
      are equivalent in all respects.
 
408
 
 
409
      'a                                     ==&gt;  a
 
410
      '#(a b c)                              ==&gt;  #(a b c)
 
411
      '()                                    ==&gt;  ()
 
412
      '(+ 1 2)                               ==&gt;  (+ 1 2)
 
413
      '(quote a)                             ==&gt;  (quote a)
 
414
      ''a                                    ==&gt;  (quote a)
 
415
 
 
416
      As noted in section 3.4 Storage model, it is an error to alter a
 
417
      constant (i.e. the value of a literal expression) using a mutation
 
418
      procedure like `set-car!' or `string-set!'.
 
419
 
 
420
  6.3.2 Pairs and lists
 
421
 
 
422
  procedure: set-car! pair obj
 
423
 
 
424
      Stores obj in the car field of pair. The value returned by `set-car!'
 
425
      is unspecified.
 
426
 
 
427
      (define (g) '(constant-list))
 
428
      (set-car! (g) 3)                       ==&gt;  error</tt></pre>
 
429
</div></div>
 
430
<h3>2.10. Constant vector</h3>
 
431
<p>SigScheme inhibits modification of constant vector object by default as
 
432
specified in R5RS, if the storage implementation suports it. storage-fatty
 
433
supports it, but storage-compact is not yet.</p>
 
434
<p>The behavior can be changed by <tt>SCM_CONST_VECTOR_LITERAL</tt>.</p>
 
435
<div class="listingblock">
 
436
<div class="content">
 
437
<pre><tt>  6.3.6 Vectors
 
438
 
 
439
  procedure: vector-set! vector k obj
 
440
 
 
441
      (vector-set! '#(0 1 2) 1 "doe")
 
442
                ==&gt;  error  ; constant vector</tt></pre>
 
443
</div></div>
 
444
<h3>2.11. Quote-less null list</h3>
 
445
<p>SigScheme allows quote-less null list by default for convenience and
 
446
performance. But it can be error as specified in R5RS, when <tt>SCM_STRICT_R5RS</tt>
 
447
is enabled.</p>
 
448
<div class="exampleblock">
 
449
<div class="title">Example: SCM_STRICT_R5RS disabled</div>
 
450
<div class="exampleblock-content">
 
451
<div class="literalblock">
 
452
<div class="content">
 
453
<pre><tt>sscm&gt; (null? ())
 
454
#t</tt></pre>
 
455
</div></div>
 
456
</div></div>
 
457
<div class="exampleblock">
 
458
<div class="title">Example: SCM_STRICT_R5RS enabled</div>
 
459
<div class="exampleblock-content">
 
460
<div class="literalblock">
 
461
<div class="content">
 
462
<pre><tt>sscm&gt; (null? ())
 
463
Error: eval: () is not a valid R5RS form. use '() instead</tt></pre>
 
464
</div></div>
 
465
</div></div>
 
466
<h3>2.12. Quote-less vector literal</h3>
 
467
<p>Sigscheme inhibits quote-less vector literal by default, as specified in
 
468
R5RS.</p>
 
469
<p>The behavior can be changed by <tt>SCM_STRICT_VECTOR_FORM</tt>.</p>
 
470
<div class="listingblock">
 
471
<div class="content">
 
472
<pre><tt>  6.3.6 Vectors
 
473
 
 
474
  Vectors are written using the notation #(obj ...). For example, a vector
 
475
  of length 3 containing the number zero in element 0, the list `(2 2 2 2)'
 
476
  in element 1, and the string `"Anna"' in element 2 can be written as
 
477
  following:
 
478
 
 
479
  #(0 (2 2 2 2) "Anna")
 
480
 
 
481
  Note that this is the external representation of a vector, not an
 
482
  expression evaluating to a vector. Like list constants, vector constants
 
483
  must be quoted:
 
484
 
 
485
  '#(0 (2 2 2 2) "Anna")
 
486
            ==&gt;  #(0 (2 2 2 2) "Anna")</tt></pre>
 
487
</div></div>
 
488
<div class="exampleblock">
 
489
<div class="title">Example: vector literals</div>
 
490
<div class="exampleblock-content">
 
491
<div class="literalblock">
 
492
<div class="content">
 
493
<pre><tt>sscm&gt; #(1 2 3)
 
494
Error: eval: #() is not a valid R5RS form. use '#() instead
 
495
sscm&gt; '#(1 2 3)
 
496
#(1 2 3)</tt></pre>
 
497
</div></div>
 
498
</div></div>
 
499
<h3>2.13. Environment specifiers</h3>
 
500
<p><tt>(null-environment)</tt> and <tt>(scheme-report-environment)</tt> does not return correct
 
501
environemnt specified in R5RS. Current implementation returns same object
 
502
of <tt>(interaction-environment)</tt>.</p>
 
503
<h3>2.14. Internal definitions</h3>
 
504
<p>SigScheme strictly conforms to the <em>internal definitions</em> defined in R5RS
 
505
(cited below) if <tt>SCM_STRICT_DEFINE_PLACEMENT</tt> is enabled (default). It can be
 
506
disabled to get the syntax loosen, shrink the footprint and reduce runtime
 
507
cost.</p>
 
508
<div class="listingblock">
 
509
<div class="content">
 
510
<pre><tt>  5.2.2 Internal definitions
 
511
 
 
512
  Definitions may occur at the beginning of a &lt;body&gt; (that is, the body of a
 
513
  lambda, let, let*, letrec, let-syntax, or letrec-syntax expression or that of
 
514
  a definition of an appropriate form). Such definitions are known as internal
 
515
  definitions as opposed to the top level definitions described above.</tt></pre>
 
516
</div></div>
 
517
<h3>2.15. Superfluous arguments</h3>
 
518
<p>Superfluous or dotted arguments are strictly rejected as an error if
 
519
<tt>SCM_STRICT_ARGCHECK</tt> is enabled. Otherwise ignored. Resource-sensitive
 
520
apprication could disable it.</p>
 
521
<div class="exampleblock">
 
522
<div class="title">Example: SCM_STRICT_ARGCHECK enabled</div>
 
523
<div class="exampleblock-content">
 
524
<div class="literalblock">
 
525
<div class="content">
 
526
<pre><tt>sscm&gt; (car '(1 2) 3 4)
 
527
Error: in (function call): superfluous argument(s): (3 4)
 
528
sscm&gt; (symbol? 'foo . #t)
 
529
Error: in (function call): improper argument list terminator: #t
 
530
sscm&gt; (+ 3 4 . 5)
 
531
Error: in (reduction): improper argument list terminator: 5</tt></pre>
 
532
</div></div>
 
533
</div></div>
 
534
<div class="exampleblock">
 
535
<div class="title">Example: SCM_STRICT_ARGCHECK disabled</div>
 
536
<div class="exampleblock-content">
 
537
<div class="literalblock">
 
538
<div class="content">
 
539
<pre><tt>sscm&gt; (car '(1 2) 3 4)
 
540
1
 
541
sscm&gt; (symbol? 'foo . #t)
 
542
#t
 
543
sscm&gt; (+ 3 4 . 5)
 
544
7</tt></pre>
 
545
</div></div>
 
546
</div></div>
 
547
<h3>2.16. Syntaxes/procedures not implemented</h3>
 
548
<p>Following R5RS syntaxes and procedures are not implemented (yet).</p>
 
549
<h4>2.16.1. Numbers</h4>
 
550
<ul>
 
551
<li>
 
552
<p>
 
553
<strong>procedure:</strong> complex? obj
 
554
</p>
 
555
</li>
 
556
<li>
 
557
<p>
 
558
<strong>procedure:</strong> real? obj
 
559
</p>
 
560
</li>
 
561
<li>
 
562
<p>
 
563
<strong>procedure:</strong> rational? obj
 
564
</p>
 
565
</li>
 
566
<li>
 
567
<p>
 
568
<strong>procedure:</strong> exact? z
 
569
</p>
 
570
</li>
 
571
<li>
 
572
<p>
 
573
<strong>procedure:</strong> inexact? z
 
574
</p>
 
575
</li>
 
576
<li>
 
577
<p>
 
578
<strong>library procedure:</strong> gcd n1 &#8230;
 
579
</p>
 
580
</li>
 
581
<li>
 
582
<p>
 
583
<strong>library procedure:</strong> lcm n1 &#8230;
 
584
</p>
 
585
</li>
 
586
<li>
 
587
<p>
 
588
<strong>procedure:</strong> numerator q
 
589
</p>
 
590
</li>
 
591
<li>
 
592
<p>
 
593
<strong>procedure:</strong> denominator q
 
594
</p>
 
595
</li>
 
596
<li>
 
597
<p>
 
598
<strong>procedure:</strong> floor x
 
599
</p>
 
600
</li>
 
601
<li>
 
602
<p>
 
603
<strong>procedure:</strong> ceiling x
 
604
</p>
 
605
</li>
 
606
<li>
 
607
<p>
 
608
<strong>procedure:</strong> truncate x
 
609
</p>
 
610
</li>
 
611
<li>
 
612
<p>
 
613
<strong>procedure:</strong> round x
 
614
</p>
 
615
</li>
 
616
<li>
 
617
<p>
 
618
<strong>library procedure:</strong> rationalize x y
 
619
</p>
 
620
</li>
 
621
<li>
 
622
<p>
 
623
<strong>procedure:</strong> exp z
 
624
</p>
 
625
</li>
 
626
<li>
 
627
<p>
 
628
<strong>procedure:</strong> log z
 
629
</p>
 
630
</li>
 
631
<li>
 
632
<p>
 
633
<strong>procedure:</strong> sin z
 
634
</p>
 
635
</li>
 
636
<li>
 
637
<p>
 
638
<strong>procedure:</strong> cos z
 
639
</p>
 
640
</li>
 
641
<li>
 
642
<p>
 
643
<strong>procedure:</strong> tan z
 
644
</p>
 
645
</li>
 
646
<li>
 
647
<p>
 
648
<strong>procedure:</strong> asin z
 
649
</p>
 
650
</li>
 
651
<li>
 
652
<p>
 
653
<strong>procedure:</strong> acos z
 
654
</p>
 
655
</li>
 
656
<li>
 
657
<p>
 
658
<strong>procedure:</strong> atan z
 
659
</p>
 
660
</li>
 
661
<li>
 
662
<p>
 
663
<strong>procedure:</strong> atan y x
 
664
</p>
 
665
</li>
 
666
<li>
 
667
<p>
 
668
<strong>procedure:</strong> sqrt z
 
669
</p>
 
670
</li>
 
671
<li>
 
672
<p>
 
673
<strong>procedure:</strong> expt z1 z2
 
674
</p>
 
675
</li>
 
676
<li>
 
677
<p>
 
678
<strong>procedure:</strong> make-rectangular x1 x2
 
679
</p>
 
680
</li>
 
681
<li>
 
682
<p>
 
683
<strong>procedure:</strong> make-polar x3 x4
 
684
</p>
 
685
</li>
 
686
<li>
 
687
<p>
 
688
<strong>procedure:</strong> real-part z
 
689
</p>
 
690
</li>
 
691
<li>
 
692
<p>
 
693
<strong>procedure:</strong> imag-part z
 
694
</p>
 
695
</li>
 
696
<li>
 
697
<p>
 
698
<strong>procedure:</strong> magnitude z
 
699
</p>
 
700
</li>
 
701
<li>
 
702
<p>
 
703
<strong>procedure:</strong> angle z
 
704
</p>
 
705
</li>
 
706
<li>
 
707
<p>
 
708
<strong>procedure:</strong> exact-&gt;inexact z
 
709
</p>
 
710
</li>
 
711
<li>
 
712
<p>
 
713
<strong>procedure:</strong> inexact-&gt;exact z
 
714
</p>
 
715
</li>
 
716
</ul>
 
717
<h4>2.16.2. Promises</h4>
 
718
<ul>
 
719
<li>
 
720
<p>
 
721
<strong>library syntax:</strong> delay &lt;expression&gt;
 
722
</p>
 
723
</li>
 
724
<li>
 
725
<p>
 
726
<strong>library procedure:</strong> force promise
 
727
</p>
 
728
</li>
 
729
</ul>
 
730
<h4>2.16.3. System interface</h4>
 
731
<ul>
 
732
<li>
 
733
<p>
 
734
<strong>optional procedure:</strong> transcript-on filename
 
735
</p>
 
736
</li>
 
737
<li>
 
738
<p>
 
739
<strong>optional procedure:</strong> transcript-off
 
740
</p>
 
741
</li>
 
742
</ul>
 
743
</div>
 
744
<h2>3. SRFI conformance</h2>
 
745
<div class="sectionbody">
 
746
<h3>3.1. SRFI-1  List Library</h3>
 
747
<p>Although a C implementation <tt>module-srfi1.c</tt> is existing, it is still broken
 
748
and should not use for production codes. To get SRFI-1 working with SigScheme,
 
749
use SLIB version of the library (will be made available after some
 
750
preparations).</p>
 
751
<h3>3.2. SRFI-22 Running Scheme Scripts on Unix</h3>
 
752
<p>SigScheme only supports the prelude line interpretation. All options written in
 
753
the line are applied as same as commandline invocation of sscm. But the <tt>main</tt>
 
754
procedure invocation is not supported (yet).</p>
 
755
<div class="exampleblock">
 
756
<div class="title">Example: Prelude line is interpreted as follows</div>
 
757
<div class="exampleblock-content">
 
758
<div class="literalblock">
 
759
<div class="content">
 
760
<pre><tt>#! /usr/bin/env sscm -C UTF-8
 
761
...</tt></pre>
 
762
</div></div>
 
763
<div class="literalblock">
 
764
<div class="content">
 
765
<pre><tt>==&gt; Character encoding for the file is changed to UTF-8 temporarily.</tt></pre>
 
766
</div></div>
 
767
</div></div>
 
768
<h3>3.3. SRFI-23 Error Reporting Mechanism</h3>
 
769
<p>If srfi-34 is provided, the <tt>error</tt> procedure throws a SigScheme-specific error
 
770
object in cooperate with "SRFI-34 Exception Handling for Programs". Otherwise
 
771
it simply calls scm_fatal_error(). Since the error objects are represented as a
 
772
list, be careful on catching an exception based on its type.  If you want to
 
773
distinguish the error objects from ordinary lists, use SigScheme-specific
 
774
<tt>%%error-object?</tt> predicate.</p>
 
775
<div class="exampleblock">
 
776
<div class="title">Example: Error objects are also caught as a list</div>
 
777
<div class="exampleblock-content">
 
778
<div class="literalblock">
 
779
<div class="content">
 
780
<pre><tt>sscm&gt; (guard (obj ((pair? obj) obj)) (error "reason" 1 2 3))
 
781
#&lt;error "reason" 1 2 3&gt;</tt></pre>
 
782
</div></div>
 
783
</div></div>
 
784
<div class="exampleblock">
 
785
<div class="title">Example: Error object internal</div>
 
786
<div class="exampleblock-content">
 
787
<div class="literalblock">
 
788
<div class="content">
 
789
<pre><tt>sscm&gt; (define err (guard (err (#t err)) (error "reason" 1 2 3)))
 
790
err
 
791
sscm&gt; err
 
792
#&lt;error "reason" 1 2 3&gt;
 
793
sscm&gt; (pair? err)
 
794
#t
 
795
sscm&gt; (car err)
 
796
(#&lt;undef&gt; . #&lt;undef&gt;)
 
797
sscm&gt; (%%error-object? err)
 
798
#t</tt></pre>
 
799
</div></div>
 
800
</div></div>
 
801
<h3>3.4. SRFI-28 Basic Format Strings</h3>
 
802
<p>SigScheme fully supports SRFI-28. A directive-less tilde at end of a format
 
803
string causes an error as same as the reference implementation of SRFI-28.</p>
 
804
<div class="exampleblock">
 
805
<div class="title">Example: SigScheme</div>
 
806
<div class="exampleblock-content">
 
807
<div class="literalblock">
 
808
<div class="content">
 
809
<pre><tt>(format "~")   ==&gt; error
 
810
(format "a~")  ==&gt; error</tt></pre>
 
811
</div></div>
 
812
</div></div>
 
813
<h3>3.5. SRFI-38 External Representation for Data with Shared Structure</h3>
 
814
<p>Only <tt>write-with-shared-structure</tt> is implemented and
 
815
<tt>read-with-shared-structure</tt> is not. The optional alias <tt>write/ss</tt> described in
 
816
SRFI-38 is also defined. The optional <tt>optarg</tt> argument is simply ignored.</p>
 
817
<p>The shared index starts with #1 (not #0).</p>
 
818
<div class="exampleblock">
 
819
<div class="title">Example: Shared index starts with #1</div>
 
820
<div class="exampleblock-content">
 
821
<div class="literalblock">
 
822
<div class="content">
 
823
<pre><tt>sscm&gt; (define lst (list 'a 'b))
 
824
lst
 
825
sscm&gt; (set-cdr! lst lst)
 
826
#1=(a . #1#)
 
827
sscm&gt; lst
 
828
#1=(a . #1#)</tt></pre>
 
829
</div></div>
 
830
</div></div>
 
831
<h3>3.6. SRFI-48 Intermediate Format Strings</h3>
 
832
<p>SigScheme fully supports SRFI-48.</p>
 
833
<p>The <em>d</em> part of <em>~w,dF</em> directive is acceptable, but completely ignored on
 
834
output format. Since SigScheme only supports integer currently, number is
 
835
always formatted as integer even if the <em>d</em> part is specified.</p>
 
836
<div class="exampleblock">
 
837
<div class="title">Example: Proper behavior</div>
 
838
<div class="exampleblock-content">
 
839
<div class="literalblock">
 
840
<div class="content">
 
841
<pre><tt>(format "~3F"   3)  ==&gt; "  3"
 
842
(format "~3,2F" 3)  ==&gt; "3.00"</tt></pre>
 
843
</div></div>
 
844
</div></div>
 
845
<div class="exampleblock">
 
846
<div class="title">Example: SigScheme</div>
 
847
<div class="exampleblock-content">
 
848
<div class="literalblock">
 
849
<div class="content">
 
850
<pre><tt>(format "~3F"   3)  ==&gt; "  3"
 
851
(format "~3,2F" 3)  ==&gt; "  3"</tt></pre>
 
852
</div></div>
 
853
</div></div>
 
854
<p>Although the reference implementation of SRFI-48 allows directive-less tilde at
 
855
end of a format string, SigScheme rejects it as an error since it decreases
 
856
user-code portability, and is confusable due to that the behavior is different
 
857
to the reference implementation of SRFI-28.</p>
 
858
<div class="exampleblock">
 
859
<div class="title">Example: Reference implementation of SRFI-48</div>
 
860
<div class="exampleblock-content">
 
861
<div class="literalblock">
 
862
<div class="content">
 
863
<pre><tt>(format "~")   ==&gt; "~"
 
864
(format "a~")  ==&gt; "a~"</tt></pre>
 
865
</div></div>
 
866
</div></div>
 
867
<div class="exampleblock">
 
868
<div class="title">Example: SigScheme</div>
 
869
<div class="exampleblock-content">
 
870
<div class="literalblock">
 
871
<div class="content">
 
872
<pre><tt>(format "~")   ==&gt; error
 
873
(format "a~")  ==&gt; error</tt></pre>
 
874
</div></div>
 
875
</div></div>
 
876
<h3>3.7. SRFI-60 Integer as Bits</h3>
 
877
<p>Only following procedures are implemented.</p>
 
878
<ul>
 
879
<li>
 
880
<p>
 
881
Bitwise Operations
 
882
</p>
 
883
<ul>
 
884
<li>
 
885
<p>
 
886
<strong>procedure:</strong> logand n1 &#8230;
 
887
</p>
 
888
</li>
 
889
<li>
 
890
<p>
 
891
<strong>procedure:</strong> bitwise-and n1 &#8230;
 
892
</p>
 
893
</li>
 
894
<li>
 
895
<p>
 
896
<strong>procedure:</strong> logior n1 &#8230;
 
897
</p>
 
898
</li>
 
899
<li>
 
900
<p>
 
901
<strong>procedure:</strong> bitwise-ior n1 &#8230;
 
902
</p>
 
903
</li>
 
904
<li>
 
905
<p>
 
906
<strong>procedure:</strong> logxor n1 &#8230;
 
907
</p>
 
908
</li>
 
909
<li>
 
910
<p>
 
911
<strong>procedure:</strong> bitwise-xor n1 &#8230;
 
912
</p>
 
913
</li>
 
914
<li>
 
915
<p>
 
916
<strong>procedure:</strong> lognot n
 
917
</p>
 
918
</li>
 
919
<li>
 
920
<p>
 
921
<strong>procedure:</strong> bitwise-not n
 
922
</p>
 
923
</li>
 
924
<li>
 
925
<p>
 
926
<strong>procedure:</strong> bitwise-if mask n0 n1
 
927
</p>
 
928
</li>
 
929
<li>
 
930
<p>
 
931
<strong>procedure:</strong> bitwise-merge mask n0 n1
 
932
</p>
 
933
</li>
 
934
<li>
 
935
<p>
 
936
<strong>procedure:</strong> logtest j k
 
937
</p>
 
938
</li>
 
939
<li>
 
940
<p>
 
941
<strong>procedure:</strong> any-bits-set? j k
 
942
</p>
 
943
</li>
 
944
</ul>
 
945
</li>
 
946
</ul>
 
947
<p>And the others listed below are not.</p>
 
948
<ul>
 
949
<li>
 
950
<p>
 
951
Integer Properties
 
952
</p>
 
953
<ul>
 
954
<li>
 
955
<p>
 
956
<strong>procedure:</strong> logcount n
 
957
</p>
 
958
</li>
 
959
<li>
 
960
<p>
 
961
<strong>procedure:</strong> bit-count n
 
962
</p>
 
963
</li>
 
964
<li>
 
965
<p>
 
966
<strong>procedure:</strong> integer-length n
 
967
</p>
 
968
</li>
 
969
<li>
 
970
<p>
 
971
<strong>procedure:</strong> log2-binary-factors n
 
972
</p>
 
973
</li>
 
974
<li>
 
975
<p>
 
976
<strong>procedure:</strong> first-set-bit n
 
977
</p>
 
978
</li>
 
979
</ul>
 
980
</li>
 
981
<li>
 
982
<p>
 
983
Bit Within Word
 
984
</p>
 
985
<ul>
 
986
<li>
 
987
<p>
 
988
<strong>procedure:</strong> logbit? index n
 
989
</p>
 
990
</li>
 
991
<li>
 
992
<p>
 
993
<strong>procedure:</strong> bit-set? index n
 
994
</p>
 
995
</li>
 
996
<li>
 
997
<p>
 
998
<strong>procedure:</strong> copy-bit index from bit
 
999
</p>
 
1000
</li>
 
1001
</ul>
 
1002
</li>
 
1003
<li>
 
1004
<p>
 
1005
Field of Bits
 
1006
</p>
 
1007
<ul>
 
1008
<li>
 
1009
<p>
 
1010
<strong>procedure:</strong> bit-field n start end
 
1011
</p>
 
1012
</li>
 
1013
<li>
 
1014
<p>
 
1015
<strong>procedure:</strong> copy-bit-field to from start end
 
1016
</p>
 
1017
</li>
 
1018
<li>
 
1019
<p>
 
1020
<strong>procedure:</strong> ash n count
 
1021
</p>
 
1022
</li>
 
1023
<li>
 
1024
<p>
 
1025
<strong>procedure:</strong> arithmetic-shift n count
 
1026
</p>
 
1027
</li>
 
1028
<li>
 
1029
<p>
 
1030
<strong>procedure:</strong> rotate-bit-field n count start end
 
1031
</p>
 
1032
</li>
 
1033
<li>
 
1034
<p>
 
1035
<strong>procedure:</strong> reverse-bit-field n start end
 
1036
</p>
 
1037
</li>
 
1038
</ul>
 
1039
</li>
 
1040
<li>
 
1041
<p>
 
1042
Bits as Booleans
 
1043
</p>
 
1044
<ul>
 
1045
<li>
 
1046
<p>
 
1047
<strong>procedure:</strong> integer-&gt;list k len
 
1048
</p>
 
1049
</li>
 
1050
<li>
 
1051
<p>
 
1052
<strong>procedure:</strong> integer-&gt;list k
 
1053
</p>
 
1054
</li>
 
1055
<li>
 
1056
<p>
 
1057
<strong>procedure:</strong> list-&gt;integer list
 
1058
</p>
 
1059
</li>
 
1060
<li>
 
1061
<p>
 
1062
<strong>procedure:</strong> booleans-&gt;integer bool1 &#8230;
 
1063
</p>
 
1064
</li>
 
1065
</ul>
 
1066
</li>
 
1067
</ul>
 
1068
<h3>3.8. SRFI-75 R6RS Unicode data</h3>
 
1069
<p>SRFI-75 is partially implemented. But since SRFI-75 had already been obsoleted,
 
1070
it is not validated deeply. It will be replaced with stable R6RS implementation
 
1071
once the specifications have been stabilized</p>
 
1072
<h4>3.8.1. Current SRFI-75 status</h4>
 
1073
<ul>
 
1074
<li>
 
1075
<p>
 
1076
Supports Unicode character literals such as #\λ
 
1077
</p>
 
1078
</li>
 
1079
<li>
 
1080
<p>
 
1081
Supports #xXX, #\uXXXX and #\UXXXXXXXX literals
 
1082
</p>
 
1083
</li>
 
1084
<li>
 
1085
<p>
 
1086
Supports Unicode identifiers (lacks character category validation)
 
1087
</p>
 
1088
</li>
 
1089
<li>
 
1090
<p>
 
1091
Supports all named chars such as #\backspace, #\esc, and #\nul
 
1092
</p>
 
1093
</li>
 
1094
<li>
 
1095
<p>
 
1096
Quoted-symbol by vertical bar (such as '|-symbol|) is not supported
 
1097
</p>
 
1098
</li>
 
1099
</ul>
 
1100
<h4>3.8.2. TODOs</h4>
 
1101
<ul>
 
1102
<li>
 
1103
<p>
 
1104
Remove #\uXXXX and #\UXXXXXXXX literals
 
1105
</p>
 
1106
</li>
 
1107
<li>
 
1108
<p>
 
1109
Support variable-length #\xXX literal
 
1110
</p>
 
1111
</li>
 
1112
<li>
 
1113
<p>
 
1114
Support character category validation for identifiers
 
1115
</p>
 
1116
</li>
 
1117
<li>
 
1118
<p>
 
1119
Disable #\newline on R6RS-compatible mode
 
1120
</p>
 
1121
</li>
 
1122
<li>
 
1123
<p>
 
1124
Confirm symbol escape syntax (not defined in R6RS yet)
 
1125
</p>
 
1126
</li>
 
1127
</ul>
 
1128
</div>
 
1129
<h2>4. SIOD compatibility</h2>
 
1130
<div class="sectionbody">
 
1131
<p>FIXME: describe them.</p>
 
1132
<ul>
 
1133
<li>
 
1134
<p>
 
1135
#f and '()
 
1136
</p>
 
1137
</li>
 
1138
<li>
 
1139
<p>
 
1140
let and let* bindings
 
1141
</p>
 
1142
</li>
 
1143
<li>
 
1144
<p>
 
1145
<em>=</em> predicate
 
1146
</p>
 
1147
</li>
 
1148
</ul>
 
1149
</div>
 
1150
<div id="footer">
 
1151
<div id="footer-text">
 
1152
Last updated 15-Mar-2007 05:41:05 JST
 
1153
</div>
 
1154
</div>
 
1155
</body>
 
1156
</html>