diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/runtime/RT.cs | 10 | ||||
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs index 431185d6..ef30e8f2 100644 --- a/src/cli/runtime/RT.cs +++ b/src/cli/runtime/RT.cs @@ -596,7 +596,7 @@ static public Object format(Object o, String s, params Object[] args) { return null;
}
-static public void doFormat(TextWriter w, String s, ISeq args) {
+static public ISeq doFormat(TextWriter w, String s, ISeq args) {
for (int i = 0; i < s.Length;)
{
char c = s[i++];
@@ -629,13 +629,14 @@ static public void doFormat(TextWriter w, String s, ISeq args) { if(j == -1)
throw new Exception("Missing ~}");
String subs = s.Substring(i, j-i);
- format(w, subs, RT.seq(RT.first(args)));
- args = RT.rest(args);
+ for (ISeq sargs = RT.seq(RT.first(args)); sargs != null; )
+ sargs = doFormat(w, subs, sargs);
+ args = RT.rest(args);
i = j+2; //skip ~}
break;
case '^':
if(args == null)
- return;
+ return null;
break;
case '~':
w.Write('~');
@@ -650,6 +651,7 @@ static public void doFormat(TextWriter w, String s, ISeq args) { break;
}
}
+ return args;
}
/*-------------------------------- values --------------*/
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index bdc56434..037d8ca1 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -591,7 +591,7 @@ static public Object format(Object o, String s, Object... args) throws Exception return null; } -static public void doFormat(Writer w, String s, ISeq args) throws Exception { +static public ISeq doFormat(Writer w, String s, ISeq args) throws Exception { for (int i = 0; i < s.length();) { char c = s.charAt(i++); @@ -624,13 +624,14 @@ static public void doFormat(Writer w, String s, ISeq args) throws Exception { if(j == -1) throw new IllegalArgumentException("Missing ~}"); String subs = s.substring(i, j); - format(w, subs, RT.seq(RT.first(args))); + for(ISeq sargs = RT.seq(RT.first(args));sargs != null;) + sargs = doFormat(w, subs, sargs); args = RT.rest(args); i = j+2; //skip ~} break; case '^': if(args == null) - return; + return null; break; case '~': w.write('~'); @@ -643,6 +644,7 @@ static public void doFormat(Writer w, String s, ISeq args) throws Exception { w.write(c); } } + return args; } ///////////////////////////////// values ////////////////////////// |