Skip to content

Commit

Permalink
Updating: very very minorly
Browse files Browse the repository at this point in the history
  • Loading branch information
githwxi committed Sep 6, 2024
1 parent a36f7cf commit f3396f7
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 130 deletions.
71 changes: 69 additions & 2 deletions prelude/TEST/CATS/JS/test04_strn000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ For testing prelude/JS!
*)
(* ****** ****** *)
(* ****** ****** *)
#staload UN =
"prelude/SATS/unsfx00.sats"
(* ****** ****** *)
(* ****** ****** *)
#staload _ =
"prelude/DATS/gdbg000.dats"
(* ****** ****** *)
Expand Down Expand Up @@ -38,14 +42,77 @@ val () = prints("AB = ", AB, "\n")
val BA = strn_reverse(AB)
val () = prints("BA = ", BA, "\n")
//
val ABAB = appends(AB, AB)
val
ABAB = appends(AB, AB)
val () = prints("ABAB = ", ABAB, "\n")
val ABBA = appends(AB, BA)
val
ABBA = appends(AB, BA)
val () = prints("ABBA = ", ABBA, "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
val
rABAB = strn$rconcat(@(AB, AB))
val () = prints("rABAB = ", rABAB, "\n")
//
val
ABABAB = strn$concat(@(AB, AB, AB))
val () = prints("ABABAB = ", ABABAB, "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
val wrd0 = "hello"
val wrds =
list_fmake_fwork<strn>
(
lam(work) =>
GASZ(wrd0).iforitm(
lam(i, ci) => GASZ(26).foritm
(
lam(j) =>
let
val cj = 'a'+j
in
if ci = cj
then () else work
($UN.strn_fset$at$raw(wrd0, i, cj))
end
)
)
)
//
val ( ) = prints("wrds = ", wrds, "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
val wrds =
list_fmake_fwork<strn>
(
lam(work) =>
GSEQ(wrd0).iforitm
(
lam(i, ci) => GASZ(26).foritm
(
lam(j) =>
let
val cj = 'a'+j
in
if ci = cj
then () else work
($UN.strn_fset$at$raw(wrd0, i, cj))
end
)
)
)
//
val ( ) = prints("wrds = ", wrds, "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
val () = prints
("prefix(\"abcde\", 3)=", prefix("abcde", 3), "\n")
val () = prints
Expand Down
18 changes: 18 additions & 0 deletions xatslib/githwxi/TEST/CATS/JS/Makefile_jsemit
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ test01_range00.dats; \
$(NODE) --stack-size=4096 $(SRCGEN2_XATS2JS) $< >> $@_out.js
########################################################################
########################################################################
test02:: ; \
echo "//" `date` > $@_out.js
############
test02:: ; \
$(CAT) $(SRCGEN2_XSHARED)/xats2js_js1emit.js >> $@_out.js
test02:: ; \
$(CAT) $(SRCGEN2_XSHARED)/xats2js_prelude.js >> $@_out.js
test02:: ; \
$(CAT) $(SRCGEN2_XSHARED)/xats2js_xatslib.js >> $@_out.js
############
test02:: ; \
$(CAT) $(XATSHOME)/prelude/DATS/CATS/JS/NODE/node000.cats >> $@_out.js
############
test02:: \
test02_qlist00.dats; \
$(NODE) --stack-size=4096 $(SRCGEN2_XATS2JS) $< >> $@_out.js
########################################################################
########################################################################
test99:: ; \
echo "//" `date` > $@_out.js
############
Expand Down
63 changes: 63 additions & 0 deletions xatslib/githwxi/TEST/CATS/JS/test02_qlist00.dats
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
(* ****** ****** *)
(* ****** ****** *)
(*
HX-2024-09-05:
Thu 05 Sep 2024 05:36:54 PM EDT
*)
(* ****** ****** *)
(* ****** ****** *)
#staload UN =
"prelude/SATS/unsfx00.sats"
(* ****** ****** *)
(* ****** ****** *)
#staload _ =
"prelude/DATS/gdbg000.dats"
(* ****** ****** *)
(* ****** ****** *)
#include
"srcgen2\
/prelude/HATS/prelude_dats.hats"
#include
"xatslib\
/githwxi/HATS/githwxi_dats.hats"
//
(* ****** ****** *)
(* ****** ****** *)
#include
"srcgen2\
/prelude/HATS/prelude_JS_dats.hats"
#include
"xatslib/HATS/xatslib_JS_dats.hats"
//
(* ****** ****** *)
(* ****** ****** *)
//
#include
"srcgen2\
/prelude/HATS/prelude_NODE_dats.hats"
//
(* ****** ****** *)
(* ****** ****** *)
//
val xs =
GSEQ(list@(1,2,3,4,5)).folditm
( qlist_nil()
, lam(r0, x0) => qlist_snoc(r0, x0))
//
val () =
prints("xs(type) = ", type(xs), "\n")
//
val () = prints("xs(value) = ", xs, "\n")
//
val () = prints("sum(xs) = ", sum(GSEQ(xs)), "\n")
val () = prints("prod(xs) = ", prod(GSEQ(xs)), "\n")
val () = print1s("listize(xs) = ", listize(GSEQ(xs)), "\n")
val () = print1s("rlistize(xs) = ", rlistize(GSEQ(xs)), "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)

(* end of [ATS3/XANADU_xatslib_JS_githwxi_TEST_test01_qlist00.dats] *)
131 changes: 3 additions & 128 deletions xatslib/githwxi/TEST/CATS/JS/test99_mydiary.dats
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ Sat 03 Aug 2024 03:08:26 PM EDT
(* ****** ****** *)
(* ****** ****** *)
//
val
rABAB =
strn$rconcat(@(AB, AB))
val () =
prints("rABAB = ", rABAB, "\n")
//
val
ABABAB =
strn$concat(@(AB, AB, AB))
val () =
prints("ABABAB = ", ABABAB, "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
(*
fun
<a:t0>
Expand Down Expand Up @@ -86,56 +71,6 @@ end//let
*)
//
(* ****** ****** *)
(* ****** ****** *)
////
(* ****** ****** *)
//
val wrd0 = "hello"
val wrds =
list_fmake_fwork<strn>
(
lam(work) =>
GASZ(wrd0).iforitm(
lam(i, ci) => GASZ(26).foritm
(
lam(j) =>
let
val cj = 'a'+j
in
if ci = cj
then () else work
($UN.strn_fset$at$raw(wrd0, i, cj))
end
)
)
)
//
val ( ) = prints("wrds = ", wrds, "\n")
//
////
val wrds =
list_fmake_fwork<strn>
(
lam(work) =>
GSEQ(wrd0).iforitm
(
lam(i, ci) => GASZ(26).foritm
(
lam(j) =>
let
val cj = 'a'+j
in
if ci = cj
then () else work
($UN.strn_fset$at$raw(wrd0, i, cj))
end
)
)
)
//
val ( ) = prints("wrds = ", wrds, "\n")
//
(* ****** ****** *)
////
(* ****** ****** *)
//
Expand All @@ -157,78 +92,18 @@ val b0 =
GASZ("abcde").exists(lam(c)=>c='f')
*)
(* ****** ****** *)
//
//
(* ****** ****** *)
//
val word = "hello"
val ( ) =
GSEQ(26).foritm(
lam(i) =>
GSEQ(word).iforitm(
lam(j, cj) =>
let
val ci = 'a'+i
in
if ci = cj then ()
else prints("ci = ", ci, ";", "cj = ", cj, "\n")
end
)
)
//
(* ****** ****** *)
(*
GSEQ(26).foritm(
lam(i) =>
GSEQ(length(word)).iforitm(
lam(j, c) => if word[i] != c then work(word.fset_at(i, c))
)
)
*)
(* ****** ****** *)
////
(* ****** ****** *)
val b0 =
GASZ(10).forall(lam(x)=>x<10)
val () = prints("b0 = ", b0, "\n")
(* ****** ****** *)
val xs =
list(1,2,3,4)
val xss = list(xs)
val ( ) =
prints
("type(xs) = ", type(xs), "\n")
val ( ) =
prints
("type(xss) = ", type(xss), "\n")
//
(* ****** ****** *)
(* ****** ****** *)
//
val xs =
GSEQ(list(1,2,3)).folditm
( qlist_nil()
, lam(r0, x0) => qlist_snoc(r0, x0))
//
val ( ) =
prints
("xs(type) = ", type(xs), "\n")
val () =
prints("xs(value) = ", xs, "\n")
//
val () = prints("sum(xs) = ", sum(GSEQ(xs)), "\n")
val () = prints("prod(xs) = ", prod(GSEQ(xs)), "\n")
val () = print1s("listize(xs) = ", listize(GSEQ(xs)), "\n")
val () = print1s("rlistize(xs) = ", rlistize(GSEQ(xs)), "\n")
//
(* ****** ****** *)
//
val () =
irforitm
( GSEQ(ys)
, lam(i, y) => prints("(i, x) = (", i, ",", y, ")"))
, lam(i, y) =>
prints("(i, x) = (", i, ",", y, ")"))
val () = prints("\n")
////
//
val rys = rlistize(GSEQ(ys))
val ( ) = print1s("rys = ", rys, "\n")
////
Expand Down

0 comments on commit f3396f7

Please sign in to comment.