aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/algebra/stream.spad.pamphlet32
-rw-r--r--src/interp/g-opt.boot2
-rw-r--r--src/interp/i-syscmd.boot14
-rw-r--r--src/lisp/core.lisp.in8
5 files changed, 34 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ae7612c9..9710f49f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2011-10-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * algebra/stream.spad.pamphlet (Stream): Tidy accessors.
+
+2011-10-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
Support use of any natural number literal as constant name.
* interp/postpar.boot (postNormalizeName): Remove.
(postLhsOfDefinition): New.
diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet
index 8be08ff7..b7fe4421 100644
--- a/src/algebra/stream.spad.pamphlet
+++ b/src/algebra/stream.spad.pamphlet
@@ -649,20 +649,22 @@ Stream(S): Exports == Implementation where
--% representation
- -- The Rep is a pair of one of three forms:
- -- [value: S, rest: %]
- -- [nullstream: Magic, NIL ]
- -- [nonnullstream: Magic, fun: () -> %]
+ -- The Rep is a pair of one of three kinds:
+ -- [value: S, rest: %]
+ -- [%nullStream: Magic, %nil ]
+ -- [%nonNullStream: Magic, fun: () -> %]
-- Could use a record of unions if we could guarantee no tags.
- macro NullStream == _$NullStream$Foreign(Builtin)
- macro NonNullStream == _$NonNullStream$Foreign(Builtin)
+ import %nil: % from Foreign Builtin -- to indicate nil stream
+ import %nullStream: S from Foreign Builtin -- end-of-stream token
+ import %nonNullStream: S from Foreign Builtin -- plentyfull stream token
- import %head: % -> S from Foreign Builtin
- import %tail: % -> % from Foreign Builtin
+ import %head: % -> S from Foreign Builtin
+ import %tail: % -> % from Foreign Builtin
+ import %pair: (S,%) -> % from Foreign Builtin
- explicitlyEmpty? x == %peq(frst x,NullStream)$Foreign(Builtin)
- lazy? x == %peq(frst x,NonNullStream)$Foreign(Builtin)
+ explicitlyEmpty? x == %peq(frst x,%nullStream)$Foreign(Builtin)
+ lazy? x == %peq(frst x,%nonNullStream)$Foreign(Builtin)
--% signatures of local functions
@@ -683,8 +685,8 @@ Stream(S): Exports == Implementation where
-- destructively changes x to a null stream
setToNil!(x: %): % ==
- setfrst!(x,NullStream)
- setrst!(x,%nil$Foreign(Builtin))
+ setfrst!(x,%nullStream)
+ setrst!(x,%nil)
x
--% SETCAT functions
@@ -914,7 +916,7 @@ Stream(S): Exports == Implementation where
--% RCAGG functions
empty() ==
- %pair(NullStream,%nil$Foreign(Builtin))$Foreign(Builtin)
+ %pair(%nullStream,%nil)
lazyEval(x: %): % ==
(rst(x):(()-> %)) ()
@@ -949,7 +951,7 @@ Stream(S): Exports == Implementation where
(concat(frst x, first(rst x,(n-1) :: NNI)))
concat(s:S,x:%) ==
- %pair(s,x)$Foreign(Builtin)
+ %pair(s,x)
cons(s,x) == concat(s,x)
@@ -1070,7 +1072,7 @@ Stream(S): Exports == Implementation where
[true, npp, periode]
delay(fs:()->%) ==
- %pair(NonNullStream,fs)$Foreign(Builtin)
+ %pair(%nonNullStream,fs : %)
explicitEntries? x ==
not explicitlyEmpty? x and not lazy? x
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index f044b7a2..a4561beb 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -422,7 +422,7 @@ optSuchthat [.,:u] == ["SUCHTHAT",:u]
++ List of VM side effect free operators.
$VMsideEffectFreeOperators ==
- '(SPADfirst ASH FLOAT FLOAT_-SIGN %function
+ '(SPADfirst ASH FLOAT FLOAT_-SIGN %function %nullStream %nonNullStream
%funcall %nothing %when %false %true %otherwise %2bit %2bool
%and %or %not %peq %ieq %ilt %ile %igt %ige %head %tail %integer?
%beq %blt %ble %bgt %bge %bitand %bitior %bitxor %bitnot %bcompl
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 311db253..a6483122 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -46,12 +46,6 @@ $existingFiles := hashTable "EQUAL"
$SYSCOMMANDS := [first x for x in $systemCommands]
-$NonNullStream ==
- '"NonNullStream"
-
-$NullStream ==
- '"NullStream"
-
$whatOptions := '( _
operations _
categories _
@@ -1832,8 +1826,8 @@ writify ob ==
THROW('writifyTag, 'writifyFailed)
-- Default case: return the object itself.
string? ob =>
- sameObject?(ob, $NullStream) => ['WRITIFIED!!, 'NULLSTREAM]
- sameObject?(ob, $NonNullStream) => ['WRITIFIED!!, 'NONNULLSTREAM]
+ sameObject?(ob, %nullStream) => ['WRITIFIED!!, 'NULLSTREAM]
+ sameObject?(ob, %nonNullStream) => ['WRITIFIED!!, 'NONNULLSTREAM]
ob
FLOATP ob =>
ob = READ_-FROM_-STRING STRINGIMAGE ob => ob
@@ -1920,8 +1914,8 @@ dewritify ob ==
nob
type is 'READTABLE =>
error '"Cannot de-writify a read table."
- type is 'NULLSTREAM => $NullStream
- type is 'NONNULLSTREAM => $NonNullStream
+ type is 'NULLSTREAM => %nullStream
+ type is 'NONNULLSTREAM => %nonNullStream
type is 'FLOAT =>
[fval, signif, expon, sign] := CDDR ob
fval := SCALE_-FLOAT( FLOAT(signif, fval), expon)
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index adcf7233..0b939ed6 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -157,6 +157,8 @@
"%basicSystemIsComplete"
"%algebraSystemIsComplete"
"%nothing"
+ "%nullStream"
+ "%nonNullStream"
"%escapeSequenceAverseHost?"
"%defaultReadAndLoadSettings"
@@ -454,6 +456,12 @@
;; This is also the bottom value of the Maybe domain.
(defconstant |%nothing| :|OpenAxiomNoValue|)
+;; Token expression to indicate the end of a stream of values.
+(defconstant |%nullStream| :|OpenAxiomNullStream|)
+
+;; Token expression to indicate there are move to come in a stream of values.
+(defconstant |%nonNullStream| :|OpenAxiomNonNullStream|)
+
;; Base name of the native core runtime library
(defconstant |$CoreLibName|
"open-axiom-core")