Commit cbe28657 authored by Per Bothner's avatar Per Bothner

Define and use 'istring' type for some return types.

* LispLanguage.java (getTypeMap): Add mapping for 'istring'.
* kawa/istrings.scm: Use 'istring' for appropriate return types.
parent 4d81b889
Pipeline #125509998 failed with stage
in 5 minutes and 33 seconds
2020-03-11 Per Bothner <per@bothner.com>
* LispLanguage.java (getTypeMap): Add mapping for 'istring'.
2019-12-24 Per Bothner <per@bothner.com>
* LangObjType.java(coercionMethod, coercionOrNullMethod): For gvector.
......
......@@ -271,6 +271,7 @@ public abstract class LispLanguage extends Language
types.put("abstract-string", ClassType.make("gnu.lists.CharSeq"));
types.put("vector", LangObjType.vectorType);
types.put("gvector", LangObjType.gvectorType);
types.put("istring", LangObjType.istringType);
types.put("string", LangObjType.stringType);
types.put("empty-list", ClassType.make("gnu.lists.EmptyList"));
types.put("sequence", LangObjType.sequenceType);
......
2020-03-11 Per Bothner <per@bothner.com>
* kawa/istrings.scm: Use 'istring' for appropriate return types.
2019-07-19 Per Bothner <per@bothner.com>
* arrays.scm (->shape): New procedure.
......
......@@ -23,10 +23,10 @@
#!optional (start ::int 0) (end ::int (vec:size)))
(gnu.lists.IString (vector->mstring vec start end)))
(define (list->string (lst ::list)) ::string
(define (list->string (lst ::list)) ::istring
(gnu.lists.IString ((list->mstring lst):toString)))
(define (string-append #!rest (args :: java.lang.CharSequence[])) :: gnu.lists.IString
(define (string-append #!rest (args :: java.lang.CharSequence[])) :: istring
(let* ((buf (java.lang.StringBuilder))
(n args:length))
(let loop ((i::int 0))
......@@ -36,20 +36,20 @@
(gnu.lists.IString buf)))
(define (substring str::string start::int end::int)
:: <string>
:: istring
(gnu.lists.IString:valueOf str start (- end start)))
(define (string-map proc str1::string #!rest rst::string[])::string
(gnu.lists.IString (mstring-map proc str1 @rst)))
(define (string-upcase (str :: string)) :: string
(define (string-upcase (str :: string)) :: istring
(gnu.lists.IString ((str:toString):toUpperCase java.util.Locale:ENGLISH)))
(define (string-downcase (str :: string)) :: string
(define (string-downcase (str :: string)) :: istring
(gnu.lists.IString ((str:toString):toLowerCase java.util.Locale:ENGLISH)))
(define (string-titlecase (str :: string)) :: string
(define (string-titlecase (str :: string)) :: istring
(gnu.lists.IString (gnu.kawa.functions.UnicodeUtils:capitalize str)))
(define (string-foldcase (str :: string)) :: string
(define (string-foldcase (str :: string)) :: istring
(gnu.lists.IString (gnu.kawa.functions.UnicodeUtils:foldCase str)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment