diff --git a/lib/std/num/ddouble.kk b/lib/std/num/ddouble.kk index 77bd16ef7..ee2dbf541 100644 --- a/lib/std/num/ddouble.kk +++ b/lib/std/num/ddouble.kk @@ -207,7 +207,7 @@ fun ddouble-int-exp( i : int, e : int ) : ddouble val py = px - 14 if py <= 0 then // if 28 or less digits we can convert with two doubles - // trace("ddouble-i: " + i.show + ", hi:" + hi.show + ", lo: " + y.show) + // trace("ddouble-i: " ++ i.show ++ ", hi:" ++ hi.show ++ ", lo: " ++ y.show) small-exp(hi, px + e) + small-exp( y, e) else @@ -215,8 +215,8 @@ fun ddouble-int-exp( i : int, e : int ) : ddouble val (mid,z) = y.cdivmod-exp10(py) val pz = py - 14 val (lo,plo) = if pz <= 0 then (z,0) else (z.cdiv-exp10(pz), pz) - //trace("ddouble-i: " + i.show + ", hi:" + hi.show + ", mid: " + mid.show + ", lo: " + lo.show) - //trace(" px: " + px.show + ", py : " + py.show + ", plo: " + plo.show + ", e: " + e.show ) + //trace("ddouble-i: " ++ i.show ++ ", hi:" ++ hi.show ++ ", mid: " ++ mid.show ++ ", lo: " ++ lo.show) + //trace(" px: " ++ px.show ++ ", py : " ++ py.show ++ ", plo: " ++ plo.show ++ ", e: " ++ e.show ) small-exp( hi, px + e) + (small-exp( mid, py + e) + small-exp( lo, plo + e)) @@ -750,7 +750,7 @@ pub fun parse-ddouble( s : string ) : maybe val w = (whole + frac).parse-int.default(0) val e = exp - frac.count val x = ddouble-int-exp(w,e) - // trace("parse: s: " + s + "\n w: " + w.show + ", e: " + e.show + "\n wx: " + w.ddouble.show-sum + ", x: " + x.show + "\n " + x.show-sum) + // trace("parse: s: " ++ s ++ "\n w: " ++ w.show ++ ", e: " ++ e.show ++ "\n wx: " ++ w.ddouble.show-sum ++ ", x: " ++ x.show ++ "\n " ++ x.show-sum) Just(x) Nothing -> match(t.find(rx-special)) @@ -799,7 +799,7 @@ fun pddouble-normal() : parse ddouble val w = ((if neg then "-" else "") ++ whole ++ frac).parse-int.default(0) val e = exp - frac.count val x = ddouble-int-exp(w,e) - // trace("parse-normal: w: " + w.show + ", e: " ++ e.show ++ "\n wx: " ++ w.ddouble.show-sum ++ ", x: " ++ x.show ++ "\n " ++ x.show-sum) + // trace("parse-normal: w: " ++ w.show ++ ", e: " ++ e.show ++ "\n wx: " ++ w.ddouble.show-sum ++ ", x: " ++ x.show ++ "\n " ++ x.show-sum) x /*------------------------------------------------------ diff --git a/lib/std/num/decimal.kk b/lib/std/num/decimal.kk index dafc1028b..63a67f62a 100644 --- a/lib/std/num/decimal.kk +++ b/lib/std/num/decimal.kk @@ -43,7 +43,7 @@ fun decimal-exp( i : int, exp : int = 0 ) : decimal // use exponents only at specific intervals to avoid too much re-scaling val x = round-exp(exp) // always x <= exp val diff = exp - x - // trace("decimal-exp: " + i.show + "e" + exp.show + ", diff: " + diff.show + ", x: " + x.show) + // trace("decimal-exp: " ++ i.show ++ "e" ++ exp.show ++ ", diff: " ++ diff.show ++ ", x: " ++ x.show) if diff.is-zero then Decimal(i,exp) else Decimal(i.mul-exp10(diff.abs),x) /* Create a decimal from a `:float64` with a specified maximal precision (=`-1`). @@ -95,7 +95,7 @@ fun pdecimal() : parse decimal val whole = digits() val frac = optional("", { char('.'); digits() }) val exp = optional(0, { one-of("eE"); pint() }) - // trace("frac:" + frac) + // trace("frac:" ++ frac) val i = decimal-exp( (whole ++ frac).parse-int-default(0), exp - frac.count ) if neg then ~i else i @@ -117,10 +117,10 @@ pub fun reduce( x : decimal ) : decimal // Add two decimals. pub fun (+)( x : decimal, y : decimal ) : decimal val e = min(x.exp,y.exp) - // trace("add: " ++ x.show-raw ++ " + " ++ y.show-raw ++ ", using exp: " ++ e.show ) + // trace("add: " ++ x.show-raw ++ " ++ " ++ y.show-raw ++ ", using exp: " ++ e.show ) val xx = x.expand(e) val yy = y.expand(e) - // trace("expanded add: " ++ xx.show-raw ++ " + " ++ yy.show-raw) + // trace("expanded add: " ++ xx.show-raw ++ " ++ " ++ yy.show-raw) Decimal(xx.num + yy.num, e) // Negate a decimal. @@ -233,7 +233,7 @@ pub fun round-to-prec( x : decimal, prec : int = 0, rnd : round = Half-even ) : Truncate -> if !q.is-neg then q else q.inc Away-from-zero -> if !q.is-pos then q else q.inc - //trace("round: " + x.showx + ", q: " + q.show + ", r: " + r.show + ", q1: " + q1.show + "e-" + prec.show ) + //trace("round: " ++ x.showx ++ ", q: " ++ q.show ++ ", r: " ++ r.show ++ ", q1: " ++ q1.show ++ "e-" ++ prec.show ) decimal-exp(q1,~prec) // Optimize: Use float64 division when within precision bounds. diff --git a/lib/std/os/env.kk b/lib/std/os/env.kk index 79fcb4626..95c6834c7 100644 --- a/lib/std/os/env.kk +++ b/lib/std/os/env.kk @@ -9,7 +9,7 @@ /* Access to the program environment and commmand line arguments. -Print the environment: `get-env().map(fn(p) { p.fst + "=" + p.snd }).join("\n").print` +Print the environment: `get-env().map(fn(p) { p.fst ++ "=" ++ p.snd }).join("\n").print` */ module std/os/env diff --git a/lib/std/time/instant.kk b/lib/std/time/instant.kk index 681a21ee1..635577ec8 100644 --- a/lib/std/time/instant.kk +++ b/lib/std/time/instant.kk @@ -104,7 +104,7 @@ fun convert( t : timestamp, from : timescale, to : timescale ) : timestamp t else // transform through TAI - // trace( "convert: " + from.name + " -> " + to.name + ", t: " + t.show ) + // trace( "convert: " ++ from.name ++ " -> " ++ to.name + ", t: " ++ t.show ) (to.from-tai)( (from.to-tai)(t) ) diff --git a/lib/std/time/parse.kk b/lib/std/time/parse.kk index ed694346d..d65e601fa 100644 --- a/lib/std/time/parse.kk +++ b/lib/std/time/parse.kk @@ -145,7 +145,7 @@ pub fun parse-iso( s : string, calendar : calendar = cal-iso ) : maybe val hours = capt.num(1) val mins = capt.num(2) - val secs = parse-ddouble(capt.groups[3] + "." + capt.groups[4]).default(zero) + val secs = parse-ddouble(capt.groups[3] ++ "." ++ capt.groups[4]).default(zero) val tzsign= if capt.groups[5]=="+" then 1 else ~1 val tzhours= capt.num(6) val tzmins = capt.num(7) diff --git a/lib/std/time/time.kk b/lib/std/time/time.kk index 795f300cf..b8e051ff6 100644 --- a/lib/std/time/time.kk +++ b/lib/std/time/time.kk @@ -90,7 +90,7 @@ pub fun round-to-prec( t : time, prec : int ) : time val c = t.clock val secs = c.seconds.round-to-prec(prec) val ri = t.instant.round-to-prec(prec) - //trace("time.round-to-prec: " + t.show-raw + ", t.seconds: " + t.seconds.show + ", secs: " + secs.show) + //trace("time.round-to-prec: " ++ t.show-raw ++ ", t.seconds: " ++ t.seconds.show ++ ", secs: " ++ secs.show) if secs.truncate == t.seconds.truncate then // whole seconds stay the same, just update with the rounded seconds and instant t(clock=c(seconds=secs), instant = ri) @@ -402,7 +402,7 @@ pub fun days-until( t1 : time, t2 : time ) : int // `time(2016,12,31,12,0,0).mjd.show(9) == "57753.499994213"` &quad; (this day has a leap second, so it is just before the real middle of the day)\ // `time(2016,12,31,12,0,0,0.5).mjd.show == "57753.5"` &quad; (real middle of the day)\ pub fun mjd( t : time ) : ddouble - //trace("offset: " + t.tzdelta.show) + //trace("offset: " ++ t.tzdelta.show) // adjust with the timezone delta so we display the mjd on the date. val i = t.instant i.mjd( i.timescale, t.tzdelta.timespan ) @@ -420,7 +420,7 @@ Takes leap seconds into account when calculating the fraction of the day, see `mjd` for examples. */ pub fun jd( t : time ) : ddouble - //trace("offset: " + t.tzdelta.show) + //trace("offset: " ++ t.tzdelta.show) // adjust with the timezone delta so we display the mjd on the date. t.mjd() + jd-epoch-delta diff --git a/lib/std/time/timezone.kk b/lib/std/time/timezone.kk index 1c33acf4c..6b19f6909 100644 --- a/lib/std/time/timezone.kk +++ b/lib/std/time/timezone.kk @@ -16,7 +16,7 @@ The latest version can be found at: ) : timezone-perio Nil -> timezone-period0 Cons(tzp,earlier) -> if (i >= tzp.start.default(i)) then - //trace("timezone: " + tzp.abbrv + ", start: " + tzp.start.default(i).time.show) + //trace("timezone: " ++ tzp.abbrv ++ ", start: " ++ tzp.start.default(i).time.show) tzp else find-offset(i,earlier) @@ -122,12 +122,12 @@ pub fun timezone( tzi : timezone-info ) : timezone // Show a time zone period. pub fun show( tzp : timezone-period) : string - tzp.abbrv.pad-right(4) + " " + tzp.offset.show-tzdelta(utc="+00:00") + " from " + tzp.start.map(fn(i){ i.time.show }).default("-infinity") + tzp.abbrv.pad-right(4) ++ " " ++ tzp.offset.show-tzdelta(utc="+00:00") ++ " from " ++ tzp.start.map(fn(i){ i.time.show }).default("-infinity") // Show time zone information. pub fun show (tzi : timezone-info, show-periods : bool = False ) : string - tzi.name + ", population: " + tzi.population.show - + (if !show-periods then "" else ":\n " + (tzi.periods)().map(show : timezone-period -> string).join("\n ")) + tzi.name ++ ", population: " ++ tzi.population.show + + (if !show-periods then "" else ":\n " ++ (tzi.periods)().map(show : timezone-period -> string).join("\n ")) /*---------------------------------------------------------------------------- @@ -145,7 +145,7 @@ pub fun parse-packed-zones( s : string ) : exn timezones val zonesarr = zonesfld.lines.map fn(line) match line.find(rxzone) - Nothing -> error("invalid timezone info:\n " + line) + Nothing -> error("invalid timezone info:\n " ++ line) Just(cap) -> cap.groups[1] val zones = zonesarr.map(parse-packed-zone) @@ -158,13 +158,13 @@ pub fun parse-packed-zones( s : string ) : exn timezones val links = linksfld.lines.map fn(line) match line.find(rxlink) - Nothing -> error("invalid timezone link:\n " + line) + Nothing -> error("invalid timezone link:\n " ++ line) Just(cap) -> (cap.groups[1],cap.groups[2]) val ldict = links.map(fn(link) val (key,other) = link match zdict[key.normalize] - Nothing -> error("invalid timezone link: unknown time zone: " + key.normalize + ", to: " + other + ", " + zdict.keys.join("\n")) + Nothing -> error("invalid timezone link: unknown time zone: " ++ key.normalize ++ ", to: " ++ other ++ ", " ++ zdict.keys.join("\n")) Just(tz) -> (other.normalize,tz(name=other,aliased=True)) ).dict @@ -177,7 +177,7 @@ val rxlinks = regex(r#""links"\s*:\s*\[([\s\S]*?)^[ \t]*\]"#, multiLine=True) val rxlink = regex(r#"^\s*"([^"\|]+)\|([^"\|]+)",?\s*$"#) fun parse-packed-zone( s : string ) : exn timezone-info - //trace("parseing: " + s) + //trace("parseing: " ++ s) val parts = s.split("|") val name = parts[0].default("") val abbrs = parts[1].default("") @@ -203,7 +203,7 @@ fun parse-packed-periods( name : string, sabbrs : string, soffsets :string, sind Nil -> (0.0,[]) Cons(start,rest) -> (start * 60.0, Cons(0.0,rest)) - if diffs.length + 1 != indices.length error("invalid timezone data:\n diffs: " + sxdiffs + "\n ind : " + sindices ) + if diffs.length + 1 != indices.length error("invalid timezone data:\n diffs: " ++ sxdiffs ++ "\n ind : " ++ sindices ) val endings = diffs.foldl((start0,[]), fn(acc:(float64,list>),diff) val iu = acc.fst + diff*60.0 val i = unix-instant(iu) @@ -216,13 +216,13 @@ fun parse-packed-periods( name : string, sabbrs : string, soffsets :string, sind periods fn(exn) - trace("invalid timezone database entry for " + name.show + ":\n " + exn.show) + trace("invalid timezone database entry for " ++ name.show ++ ":\n " ++ exn.show) [] fun parse-fixed-base60( s : string ) : exn float64 match(s.find(rxfixbase60)) - Nothing -> error("invalid fixed base60 number: " + s) + Nothing -> error("invalid fixed base60 number: " ++ s) Just(cap) -> val sign = if cap.groups[1]=="-" then ~1 else 1 val num = parse-base60(cap.groups[2]) @@ -236,7 +236,7 @@ val rxfixbase60 = regex(r"^([\-\+])?([\da-zA-X]*)(?:\.([\da-zA-X]+))?$") fun parse-base60( s : string ) : exn int if s.is-empty return 0 match(s.find(rxbase60)) - Nothing -> error("invalid base60 number: " + s) + Nothing -> error("invalid base60 number: " ++ s) Just(cap) -> val sign = if cap.groups[1]=="-" then ~1 else 1 val num = cap.groups[2].list.foldl(0) fn(n,d) @@ -250,7 +250,7 @@ fun digit60( d : char ) : exn int if d.is-digit then (d - '0').int elif d.is-lower then (d - 'a').int + 10 elif d.is-upper then (d - 'A').int + 36 - else error("invalid digit in base 60: " + d.show) + else error("invalid digit in base 60: " ++ d.show) /*---------------------------------------------------------------------------- @@ -323,7 +323,7 @@ pub fun guess-local-timezone( tzs : timezones, default : maybe = Nothi val offsets = dates.sample-offsets(tz-local()) val matches = tzs.tzones.list.map(snd).filter fn(tzi) (!tzi.aliased && dates.match-offsets(offsets,tzi.timezone)) - // trace("timezone guess matches: " + matches.show-list(fn(tzi){ tzi.show })) + // trace("timezone guess matches: " ++ matches.show-list(fn(tzi){ tzi.show })) match matches Nil -> match default Nothing -> tz-local() diff --git a/lib/std/time/ut1.kk b/lib/std/time/ut1.kk index 469ad4ae1..8ad97494b 100644 --- a/lib/std/time/ut1.kk +++ b/lib/std/time/ut1.kk @@ -104,11 +104,11 @@ pub fun load-iersA( basename : string = "finals2000A", verbose : bool = True ) : ((i:instant) -> maybe) - val fname-all = basename + ".all" + val fname-all = basename ++ ".all" val finals-all = load-iersA-all( fname-all, baseurl + fname-all, duration(download-delay.seconds * 8.ddouble), duration(download-timeout.seconds * 8.ddouble), verbose ) - val fname-daily = basename + ".daily" + val fname-daily = basename ++ ".daily" val finals-daily = load-iersA-daily( fname-daily, baseurl + fname-daily, download-delay, download-timeout, verbose ) (fn(i:instant) @@ -165,7 +165,7 @@ fun load-latest-iersA( fname : path, url : string, val xurl = if url=="auto" then usno-url + fname.basename else url val dtt = load-latest( xfname, xurl, parse-iersA, fn(dtt:dut-table){ Just(dtt.expire) }, download-timeout=download-timeout,download-delay=download-delay, - error-prefix="load IERS A data (" + fname.basename + ")", + error-prefix="load IERS A data (" ++ fname.basename ++ ")", verbose=verbose ) val ts-utc = ts-utc-load(verbose=verbose) @@ -200,10 +200,10 @@ fun dut-deltat( ts-utc : timescale, dtt : dut-table, i : instant ) : maybe dut2 && dut1 - 1.5 < dut2 then dut2 + 1.0 // a leap second was subtracted else dut1 // a jump outside a reasonable range; don't interpolate val dut = dut1 + ((dut3 - dut1) * mjd.fraction) - //val _ = trace("dut interpolate: " + dut1.show + ", and " + dut3.show + ", to " + dut.show) + //val _ = trace("dut interpolate: " ++ dut1.show ++ ", and " ++ dut3.show ++ ", to " ++ dut.show) // calculate deltaT (TT - UT1) from DUT (=UT1 - UTC) val dt = (i.timestamp-in(ts-tt) - dut.ddouble) - utci.timestamp.unsafe-timespan-withleap // include leap seconds! - //val _ = trace("dut found: mjd: " + mjd.show + ", dut: " + dut.show + ", dt: " + dt.show) + //val _ = trace("dut found: mjd: " ++ mjd.show ++ ", dut: " ++ dut.show ++ ", dt: " ++ dt.show) Just( unsafe-duration(dt) ) @@ -224,9 +224,9 @@ fun parse-iersA( s : string ) : maybe Just(cap) -> cap.groups[1].parse-float64.maybe(end - 365.0) Nothing -> end - 365.0 // guess one year early ).instant-at-mjd(ts-ti) - //trace("finals2000A expire: " + expire.time.show) - //trace("entries: " + entries.list.map(fn(d){ show(d) }).join("\n")) - //trace("finals: " + entries.length.show + ", start: " + start.show + ", end: " + end.show ) + //trace("finals2000A expire: " ++ expire.time.show) + //trace("entries: " ++ entries.list.map(fn(d){ show(d) }).join("\n")) + //trace("finals: " ++ entries.length.show ++ ", start: " ++ start.show ++ ", end: " ++ end.show ) Just(Dut-table(expire,start,end,entries)) val rx-finals-dut = regex(r"^.{57}[IP]([\-\+ ]\d+(?:\.\d+))", multiline=True) @@ -248,14 +248,14 @@ fun map-acc(xs : list, f : a -> b, acc : list = []) : list fun tai-to-ut1( tai : duration, dt-override : (i:instant) -> maybe ) : timestamp val i = tai.instant val dt = deltat(i,dt-override) - // trace("tai-to-ut: dt: " + dt.show ) + // trace("tai-to-ut: dt: " ++ dt.show ) (i - dt).timestamp-in(ts-tt) fun ut1-to-tai( t : timestamp, dt-override : (i : instant) -> maybe ) : duration val i = ts-tt.instant(t) // approximately tt val i1 = i + deltat(i,dt-override) // approximate tai val i2 = i + deltat(i1,dt-override) // improve over previous approximation - // trace("ut-to-tai: dt1: " + deltat(i0).show + ", dt2: " + deltat(i1).show) + // trace("ut-to-tai: dt1: " ++ deltat(i0).show ++ ", dt2: " ++ deltat(i1).show) i2.duration // Takes an optional `dt` parameter to calculate ΔT (=TT - UT1) @@ -341,7 +341,7 @@ pub fun deltat( i : instant, dt-override : (i : instant) -> maybe = de val y = i.time(ts=ts-tt).year-frac.float64.round-to-prec(4) deltat-builtin(y).duration - // trace("deltat: year: " + y.show-ddouble + ", dt: " + dt.show) + // trace("deltat: year: " ++ y.show-ddouble ++ ", dt: " ++ dt.show) dt fun deltat-builtin( y : float64, diff --git a/lib/std/time/utc.kk b/lib/std/time/utc.kk index 3b41e282d..b8f052f0c 100644 --- a/lib/std/time/utc.kk +++ b/lib/std/time/utc.kk @@ -867,7 +867,7 @@ fun ptaiadjust() : parse leap-adjust // round to always start on a whole second val start = ((mjd - mjd-epoch-shift)*solar-secs-per-day).round.timestamp val dstart = ((dmjd - mjd-epoch-shift)*solar-secs-per-day).round.timestamp - // trace("pre72 start=" + start.show + ", ofs: " + ofs.show + ", drift: " + drift.show ) + // trace("pre72 start=" ++ start.show ++ ", ofs: " ++ ofs.show ++ ", drift: " ++ drift.show ) Leap-adjust( start, ofs, dstart, drift ) // TAI leap second adjustments for dates before 1972-01-01Z are linear interpolations. @@ -924,7 +924,7 @@ val utc-expire = leaps.find(rxexpire).map fn(cap) val ntpex = cap.groups[1].parse-int-default(ntp2000.int) timestamp(ntpex.timespan - ntp2000) }.default(la-final.utc-start + (182*isolar-secs-per-day).timespan) // default: 6 months after last leap second - // trace("expire: " + utc-expire.ts-show) + // trace("expire: " ++ utc-expire.ts-show) ts-tai.instant( utc-expire - ntp2000 + la-final.offset ) // interpret as TAI to avoid recursion. val rxexpire = regex(r"^[ \t]*#@[ \t]*(\d+)[ \t]*(?:#.*)?$", multiLine=True) @@ -940,7 +940,7 @@ pub fun parse-leap-seconds-dat( leaps : string ) : leaps-table // round to always start on a whole second val start = ((mjd - mjd-epoch-shift)*solar-secs-per-day).round.timestamp val dstart = ((dmjd - mjd-epoch-shift)*solar-secs-per-day).round.timestamp - // trace("pre72 start=" + start.show + ", ofs: " + ofs.show + ", drift: " + drift.show ) + // trace("pre72 start=" ++ start.show ++ ", ofs: " ++ ofs.show ++ ", drift: " ++ drift.show ) Leap-adjust( start, ofs, dstart, drift ) }).reverse val expire = parse-leap-expire(leaps,adjusts) diff --git a/test/algeff/common.kk b/test/algeff/common.kk index d70381698..7a7246e3d 100644 --- a/test/algeff/common.kk +++ b/test/algeff/common.kk @@ -48,7 +48,7 @@ effect input { fun hello() { val name = getstr() - println("Hello " + name + ", " + getstr()) + println("Hello " ++ name ++ ", " ++ getstr()) } val always-there = handler { @@ -193,7 +193,7 @@ fun ask-age() { val name = readline() // asynchronous! println("and you age?") val age = readline() - println("hello " + name + ", you are " + age) + println("hello " ++ name ++ ", you are " ++ age) } @@ -202,10 +202,10 @@ fun ask-age-err() { println("what is your name?") val name = readline() raise("ouch!") - println("hello " + name) + println("hello " ++ name) } fn(err) { - println("error: " + err ) + println("error: " ++ err ) } } */ diff --git a/test/algeff/mon-amb2.kk b/test/algeff/mon-amb2.kk index cb01234fc..97a2474eb 100644 --- a/test/algeff/mon-amb2.kk +++ b/test/algeff/mon-amb2.kk @@ -197,11 +197,11 @@ fun test0() { fun show1( x : (list,int) ) { - "([" + x.fst.map(show).join(",") + "], " + x.snd.show + ")" + "([" ++ x.fst.map(show).join(",") ++ "], " ++ x.snd.show ++ ")" } fun show2( xs : list<(bool,int)> ) { - "[" + xs.map(fn(x){ "(" + x.fst.show + "," + x.snd.show + ")"}).join(",") + "]" + "[" ++ xs.map(fn(x){ "(" ++ x.fst.show ++ "," ++ x.snd.show ++ ")"}).join(",") ++ "]" } fun test1() = state_handler(amb_handler(foo()),1).pure.show1 diff --git a/test/algeff/nim1.kk b/test/algeff/nim1.kk index 8a4c6bae7..8a19b4c3d 100644 --- a/test/algeff/nim1.kk +++ b/test/algeff/nim1.kk @@ -95,8 +95,8 @@ fun show(gt :gtree) : div string { fun showGt(gt :gtree, indent:int) : _ string { val showi = (show : (int) -> string) match(gt) { - Take(p,moves) -> p.show + moves.showList(fn(x) { "\n" + string(indent,' ') + x.fst.core/show + " -> " + x.snd.showGt(indent+2) }) - Winner(p) -> p.show + " wins" + Take(p,moves) -> p.show ++ moves.showList(fn(x) { "\n" ++ string(indent,' ') + x.fst.core/show ++ " -> " ++ x.snd.showGt(indent+2) }) + Winner(p) -> p.show ++ " wins" } } @@ -115,7 +115,7 @@ effect cheating { val cheatReport = handler { return x -> x - cheat(p) -> error(p.show + " cheated!") + cheat(p) -> error(p.show ++ " cheated!") } val check = handler { @@ -228,7 +228,7 @@ val printer = handler { fun printBoard( gs : gstate ) : io () { gs.mymap( fn(ps) { - ps.fst.show + " -> " + ps.snd.show + ps.fst.show ++ " -> " ++ ps.snd.show }).join("\n").println } diff --git a/test/algeff/nim1a.kk b/test/algeff/nim1a.kk index 45f5532ee..53055df7b 100644 --- a/test/algeff/nim1a.kk +++ b/test/algeff/nim1a.kk @@ -71,5 +71,5 @@ fun testPerfect2() { } fun main() { - println( testPerfect1().show + ", " + testPerfect2().show ) + println( testPerfect1().show ++ ", " ++ testPerfect2().show ) } diff --git a/test/algeff/wrong/scoped1.kk b/test/algeff/wrong/scoped1.kk index 5450681fa..27fb0c057 100644 --- a/test/algeff/wrong/scoped1.kk +++ b/test/algeff/wrong/scoped1.kk @@ -67,7 +67,7 @@ val choices = handler { } fun show(sxss : (int,list>)) : string { - "(state=" + sxss.fst.show + ", " + sxss.snd.show + ")" + "(state=" ++ sxss.fst.show ++ ", " ++ sxss.snd.show ++ ")" } fun test2() { global(0){ choices{ knapsack(3,[3,2,1]) }} diff --git a/test/cgen/ctail1.kk b/test/cgen/ctail1.kk index 7eb3fc228..080154500 100644 --- a/test/cgen/ctail1.kk +++ b/test/cgen/ctail1.kk @@ -125,7 +125,7 @@ fun bmap( f : int -> int, t : tree) : div tree fun show(t : tree) : string { match(t) { - Bin(l,r) -> "(" + l.show + " * " + r.show + ")" + Bin(l,r) -> "(" ++ l.show ++ " * " ++ r.show ++ ")" Tip(i) -> i.show } } diff --git a/test/cgen/ctail1a.kk b/test/cgen/ctail1a.kk index cd86cf3a0..52c7163bc 100644 --- a/test/cgen/ctail1a.kk +++ b/test/cgen/ctail1a.kk @@ -195,7 +195,7 @@ fun bmap( f : int -> int, t : tree) : div tree fun show(t : tree) : string { match(t) { - Bin(l,r) -> "(" + l.show + " * " + r.show + ")" + Bin(l,r) -> "(" ++ l.show ++ " * " ++ r.show ++ ")" Tip(i) -> i.show } } diff --git a/test/finally/file1.kk b/test/finally/file1.kk index ea67bd115..fb7b9929f 100644 --- a/test/finally/file1.kk +++ b/test/finally/file1.kk @@ -19,8 +19,8 @@ fun foo() { fun open-file(fname,action) { var h := 0 // low-level file handle - with initially( fn(i){ println("initially: " + i.show + ", h: " + h.show); h := fopen(fname) } ) - with finally { println("finally, h: " + h.show); fclose(h); h := 0 } + with initially( fn(i){ println("initially: " ++ i.show ++ ", h: " ++ h.show); h := fopen(fname) } ) + with finally { println("finally, h: " ++ h.show); fclose(h); h := 0 } with f = named handler { fun write(s) { fwrite(h,s) } // files as a named instance } @@ -43,14 +43,14 @@ alias hfile = int fun fopen( fname : string ) : hfile { val f = unique() + 1 - println("open : " + f.show) + println("open : " ++ f.show) f } fun fclose( f : hfile ) { - println("close: " + f.show) + println("close: " ++ f.show) } fun fwrite( f : hfile, msg ) { - println("write: " + f.show + ": " + msg ) + println("write: " ++ f.show ++ ": " ++ msg ) } diff --git a/test/finally/file1a.kk b/test/finally/file1a.kk index b7ae9085c..4870f7780 100644 --- a/test/finally/file1a.kk +++ b/test/finally/file1a.kk @@ -39,14 +39,14 @@ alias hfile = int fun fopen( fname : string ) : hfile { val f = unique() + 1 - println("open : " + f.show) + println("open : " ++ f.show) f } fun fclose( f : hfile ) { - println("close: " + f.show) + println("close: " ++ f.show) } fun fwrite( f : hfile, msg ) { - println("write: " + f.show + ": " + msg ) + println("write: " ++ f.show ++ ": " ++ msg ) } diff --git a/test/lib/calendar.kk b/test/lib/calendar.kk index da3d3bbd0..1fd5c9ed5 100644 --- a/test/lib/calendar.kk +++ b/test/lib/calendar.kk @@ -298,9 +298,9 @@ fun julgreg-days-to-date( days : int, switch : int ) : date { // Test // ---------------------------------------------------- fun check( msg : string, expect : string, result : string ) : io () { - if (expect==result) then () // println( msg + ": ok.") + if (expect==result) then () // println( msg ++ ": ok.") else { - println(msg + ": FAILED:\n expect : " + expect + "\n result: " + result ) + println(msg ++ ": FAILED:\n expect : " ++ expect ++ "\n result: " ++ result ) error("failure") } } @@ -310,33 +310,33 @@ fun test-day-cal( day : int, cal : calendar ) : io date { val days1 = days-at-date( date1, cal ) val date2 = date-at-days( days1, cal ) val days2 = days-at-date( date2, cal ) - check( "inverse days1: " + cal.name.show + ", " + date1.show, day.show, days1.show ) - check( "inverse days2: " + day.show, day.show, days2.show ) - check( "inverse date: " + date1.show, date1.show, date2.show ) + check( "inverse days1: " ++ cal.name.show ++ ", " ++ date1.show, day.show, days1.show ) + check( "inverse days2: " ++ day.show, day.show, days2.show ) + check( "inverse date: " ++ date1.show, date1.show, date2.show ) date1 } fun test-day( day : int ) { val idate = test-day-cal( day, cal-iso ) val xidate = test-day-cal( day, xcal-iso ) - //println(" iso date: " + idate.show + ", " + xidate.show ) - check( "equal iso date: " + idate.show, idate.show, xidate.show) + //println(" iso date: " ++ idate.show ++ ", " ++ xidate.show ) + check( "equal iso date: " ++ idate.show, idate.show, xidate.show) val wdate = test-day-cal( day, cal-iso-week ) val xwdate = test-day-cal( day, xcal-iso-week ) - check( "equal iso week date: " + wdate.show, wdate.show, xwdate.show) + check( "equal iso week date: " ++ wdate.show, wdate.show, xwdate.show) val mdate = test-day-cal( day, cal-iso-month ) val xmdate = test-day-cal( day, xcal-iso-month ) - check( "equal iso month date: " + mdate.show, mdate.show, xmdate.show) + check( "equal iso month date: " ++ mdate.show, mdate.show, xmdate.show) val jdate = test-day-cal( day, cal-julian ) val xjdate = test-day-cal( day, xcal-julian ) - check( "equal julian date: " + jdate.show, jdate.show, xjdate.show) + check( "equal julian date: " ++ jdate.show, jdate.show, xjdate.show) val cdate = test-day-cal(day, cal-coptic ) val xcdate = test-day-cal(day, xcal-coptic) - // println("coptic: " + cdate.show + ", " + xcdate.show) - check("equal coptic date: " + cdate.show, cdate.show, xcdate.show ) + // println("coptic: " ++ cdate.show ++ ", " ++ xcdate.show) + check("equal coptic date: " ++ cdate.show, cdate.show, xcdate.show ) val edate = test-day-cal( day, cal-ethiopian ) val xedate = test-day-cal( day, xcal-ethiopian ) - check( "equal ethiopian date: " + edate.show, edate.show, xedate.show) + check( "equal ethiopian date: " ++ edate.show, edate.show, xedate.show) () } @@ -348,10 +348,10 @@ fun test( years : int = 500 ) { } fun for-days( ylo : int, yhi : int, action : int -> io () ) : io () { - println("days in years: " + ylo.show + " up to " + yhi.show) + println("days in years: " ++ ylo.show ++ " up to " ++ yhi.show) for(ylo,yhi) fn(y) { val base = y*366 - 730119 - println("year: " + time(2000,1,base).year.show) + println("year: " ++ time(2000,1,base).year.show) for(0,365) fn(day) { action(base + day)} } } diff --git a/test/lib/http-server1.kk b/test/lib/http-server1.kk index 0f127944f..846be4c28 100644 --- a/test/lib/http-server1.kk +++ b/test/lib/http-server1.kk @@ -18,6 +18,6 @@ fun main() : () { () } fn(exn) { - println("exn happened: " + exn.show) + println("exn happened: " ++ exn.show) } } diff --git a/test/lib/isomonth.kk b/test/lib/isomonth.kk index ce12c2f2a..727032b43 100644 --- a/test/lib/isomonth.kk +++ b/test/lib/isomonth.kk @@ -23,7 +23,7 @@ fun xdoy-of( days : int ) : (int,int) { val start = if (rem < 36225) then doe+1 else xbefore-year(approx.inc) val (yoe,doy) = if (doe < start) then (approx, doe - xbefore-year(approx)) else (approx.inc, doe - start) - // trace("doe: " + doe.show + ", approx: " + approx.show + ", start: " + start.show ) + // trace("doe: " ++ doe.show ++ ", approx: " ++ approx.show ++ ", start: " ++ start.show ) (400*era + yoe, doy) } @@ -42,9 +42,9 @@ fun xleapdays-upto(gyear : int) : int { fun test-gdays(years : int = 400) { for-days(years) fn(day) { val d = instant-at-mjd( fixed((day - gmjd-epoch-shift) - 366), ts-utc ).time.date - //xcheck("gday " + day.show + ", " + d.show, d.year.show) { gyear-of(day).show } + //xcheck("gday " ++ day.show ++ ", " ++ d.show, d.year.show) { gyear-of(day).show } val (y,_doy) = xdoy-of(day) - xcheck("xday " + day.show + ", " + d.show, d.year.show ) { y.show } + xcheck("xday " ++ day.show ++ ", " ++ d.show, d.year.show ) { y.show } () } } @@ -196,9 +196,9 @@ fun lastday(month : int ) : int { fun xcheck( msg : string, expect : string, chk :() -> io string ) : io () { val res = chk() - if (res==expect) then () // println(msg + ": " + expect + ": ok.") + if (res==expect) then () // println(msg ++ ": " ++ expect ++ ": ok.") else { - println(msg + ": FAILED!!!\n expect: " + expect + "\n got : " + res) + println(msg ++ ": FAILED!!!\n expect: " ++ expect ++ "\n got : " ++ res) error("failed") } } @@ -219,14 +219,14 @@ fun verify-id1m(years=400) { fun verify-id2w(years=400) { for-days(years) fn(days) { val d = days.isow-days-to-date - xcheck("isw-days: " + d.weekdate.show, days.show) { d.isow-date-to-days.show } + xcheck("isw-days: " ++ d.weekdate.show, days.show) { d.isow-date-to-days.show } } } fun verify-id2m(years=400) { for-days(years) fn(days) { val d = days.isom-days-to-date - xcheck("isom-days: " + d.show, days.show) { d.isom-date-to-days.show } + xcheck("isom-days: " ++ d.show, days.show) { d.isom-date-to-days.show } } } @@ -281,7 +281,7 @@ fun show( xs : list<(int,int)> ) : string { fun show( xs : list<(string,string)>, grp : int = 1 ) : string { xs.group-by(grp).map( fn(ys) { - ys.map(fn(kv) { kv.fst + "->" + kv.snd }).join(", ") + ys.map(fn(kv) { kv.fst ++ "->" ++ kv.snd }).join(", ") }).join(",\n") } @@ -294,7 +294,7 @@ fun show( xs : list<(string,string)>, grp : int = 1 ) : string { fun check(name : string, res : string, tst : () -> string ) : io () { val got = tst() - println(name + ": " + (if (got == res) then "ok: " + res else "failed!:\n expect: " + res + "\n gotten: " + got)) + println(name ++ ": " ++ (if (got == res) then "ok: " ++ res else "failed!:\n expect: " ++ res ++ "\n gotten: " ++ got)) } fun test-week-dates() { @@ -320,19 +320,19 @@ fun test-week-dates() { val ds = d.show val wds = wd.show val mds = md.show - check("date-" + ds, wds) { time(d).weekdate.show } - check("date-" + wds, ds) { time(wd).date.show } - check("date-isow-" + ds, wds) { + check("date-" ++ ds, wds) { time(d).weekdate.show } + check("date-" ++ wds, ds) { time(wd).date.show } + check("date-isow-" ++ ds, wds) { val i = instant-at(d) val id = i.time(cal=cal-iso-week).date (Weekdate(id.year,id.month,id.day.weekday)).show } - check("date-isow-" + wds, ds) { + check("date-isow-" ++ wds, ds) { val id = Date(wd.year,wd.week,wd.day.int) instant-at(id,cal=cal-iso-week).time.date.show } - check("date-isom-" + mds, mds) { instant-at(d).time(cal=cal-iso-month).date.show } - check("date-isom-" + ds, ds) { instant-at(md,cal=cal-iso-month).time.date.show } + check("date-isom-" ++ mds, mds) { instant-at(d).time(cal=cal-iso-month).date.show } + check("date-isom-" ++ ds, ds) { instant-at(md,cal=cal-iso-month).time.date.show } println("") }) } @@ -346,14 +346,14 @@ fun test-week-in-years() { ] list(2000,2399).foreach( fn(year) { val weeks = if (long-years.find(fn(y) { (2000+y)==year }).bool) then 53 else 52 - check("year-" + year.show, weeks.show) { time(year).weeks-in-year.show } + check("year-" ++ year.show, weeks.show) { time(year).weeks-in-year.show } - check("isow-" + year.show, weeks.show) { + check("isow-" ++ year.show, weeks.show) { val d = instant-at(year,12,28).time(cal=cal-iso-week).date if (d.month==53) then "53" else "52" } - check("isom-" + year.show, weeks.show) { + check("isom-" ++ year.show, weeks.show) { val d = instant-at(year,12,28).time(cal=cal-iso-month).date if (d.month==12 && d.day > 31) then "53" else "52" } @@ -365,7 +365,7 @@ fun test-day-in-year() { list(1999,2004).foreach(fn(year) { list(1,365).foreach( fn(doy) { val d = Date(year,1,doy) - check("doy-" + time(d).show, doy.show) { time(d).day-of-year.show } + check("doy-" ++ time(d).show, doy.show) { time(d).day-of-year.show } }) }) } diff --git a/test/lib/time-utc1.kk b/test/lib/time-utc1.kk index b9d3b2ca3..d9a22f37c 100644 --- a/test/lib/time-utc1.kk +++ b/test/lib/time-utc1.kk @@ -19,7 +19,7 @@ pub import std/time fun check(name : string, tst : () -> ndet bool ) : io () { - println(name + ": " + (if (tst()) then "ok" else "failed!")) + println(name ++ ": " ++ (if (tst()) then "ok" else "failed!")) } @@ -31,26 +31,26 @@ pub fun show-leap-steps(ts-utc : timescale) { val prec = 6 val diff = (ofs2 - ofs1).round-to-prec(prec) val t = ts-utc.instant(ts).time.round-to-prec(0) - val c = if (t.clock.hours != 0) then ", " + t.clock.hours.show + ":" + t.clock.minutes.show.pad-left(2,'0') else "" + val c = if (t.clock.hours != 0) then ", " ++ t.clock.hours.show ++ ":" ++ t.clock.minutes.show.pad-left(2,'0') else "" val dds = ts-utc.instant(dstart).time.date val ds = if (dds==dlast) then "&quad;&quad;\"&quad;&quad;" else dds.show dlast := dds - ( "| " + [ + ( "| " ++ [ (t.date.show + c).pad-right(17,' '), ((if (diff.neg?) then "" else "+") + (if (diff.round-to-prec(3).zero?) then "0" else diff.show(3))).pad-right(24,' '), ofs1.show(prec).pad-right(14,' '), ofs2.show(prec).pad-right(14,' '), (if (delta.zero?) then "" else - base.show(6) + "s + " + (if (dds.year >= 1959) then delta.show(7) else delta.show(8)) + "×Δ(" - + ds + ")").pad-right(47,' '), + base.show(6) ++ "s + " ++ (if (dds.year >= 1959) then delta.show(7) else delta.show(8)) ++ "×Δ(" + + ds ++ ")").pad-right(47,' '), (if (delta.zero?) then "" else - "-" + ((delta.float64 / 86400.0)*1.0e10).int.show + "×10^-10^" ).pad-right(10,' ') - ].join(" | ") + " |" + "-" ++ ((delta.float64 / 86400.0)*1.0e10).int.show ++ "×10^-10^" ).pad-right(10,' ') + ].join(" | ") ++ " |" + (if (t.date==Date(1972,1,1) || t.date==Date(1960,1,1)) then leap-steps-sep else "") ) }) println(rows.take(100).join("\n")) - val table = leap-steps-header + rows.join("\n") + leap-steps-footer + "\n" + val table = leap-steps-header + rows.join("\n") + leap-steps-footer ++ "\n" write-text-file-sync("leap-steps.txt", table) } diff --git a/test/lib/time1.kk b/test/lib/time1.kk index cb1571974..c9e78dcfe 100644 --- a/test/lib/time1.kk +++ b/test/lib/time1.kk @@ -19,9 +19,9 @@ pub import std/time/timezone fun check(name : string, res : string, tst : () -> string ) : () { val got = tst() - println(name.pad-right(14,' ') + ": " - + (if (got == res) then "ok: " + res - else "FAILED!:\n expect: " + res + "\n gotten: " + got + "\n")) + println(name.pad-right(14,' ') ++ ": " + + (if (got == res) then "ok: " ++ res + else "FAILED!:\n expect: " ++ res ++ "\n gotten: " ++ got ++ "\n")) } pub fun test-timezones() { @@ -97,12 +97,12 @@ fun test-tzs( tzs : timezones ) { pub fun test() { val ts-utc = ts-utc-load() with fun utc() { ts-utc } - println( "tz-local(): " + now().time(tz=tz-local()).show ) + println( "tz-local(): " ++ now().time(tz=tz-local()).show ) val tzs = //try(timezones-empty){ load-timezones(verbose=True) //} - println( "US/Pacific: " + now().time(tz=tzs.timezone("US/Pacific")).show ) + println( "US/Pacific: " ++ now().time(tz=tzs.timezone("US/Pacific")).show ) val zlocal = tzs.guess-local-timezone() - println( "gues local: " + now().time(tz=zlocal).show + " (" + zlocal.name + ")") + println( "gues local: " ++ now().time(tz=zlocal).show ++ " (" ++ zlocal.name ++ ")") test-tzs(tzs) } diff --git a/test/lib/time3.kk b/test/lib/time3.kk index dc1fd9bcf..7a76f94d2 100644 --- a/test/lib/time3.kk +++ b/test/lib/time3.kk @@ -20,9 +20,9 @@ pub import std/time/ut1 fun check(name : string, res : string, tst : () -> string ) : () { val got = tst() - println(name.pad-right(14,' ') + ": " - + (if (got == res) then "ok: " + res - else "FAILED!:\n expect: " + res + "\n gotten: " + got + "\n")) + println(name.pad-right(14,' ') ++ ": " + + (if (got == res) then "ok: " ++ res + else "FAILED!:\n expect: " ++ res ++ "\n gotten: " ++ got ++ "\n")) } diff --git a/test/medium/garcia-wachs-nosemi.kk b/test/medium/garcia-wachs-nosemi.kk index 43fddb705..0fb48235e 100644 --- a/test/medium/garcia-wachs-nosemi.kk +++ b/test/medium/garcia-wachs-nosemi.kk @@ -13,7 +13,7 @@ pub type tree fun show( t : tree ) : string match(t) Leaf(c) -> core/show(c) - Node(l,r) -> "Node(" + show(l) + "," + show(r) + ")" + Node(l,r) -> "Node(" ++ show(l) ++ "," ++ show(r) ++ ")" diff --git a/test/misc/ambients/acommon.kk b/test/misc/ambients/acommon.kk index 04d366876..1d57d2230 100644 --- a/test/misc/ambients/acommon.kk +++ b/test/misc/ambients/acommon.kk @@ -43,7 +43,7 @@ ambient fun input() : string fun hello() { val name = input() - println("Hello " + name + ", " + input()) + println("Hello " ++ name ++ ", " ++ input()) } fun test2() { @@ -123,7 +123,7 @@ fun test4() { fun test4b() { with return(x){ () } with amb - with foreach( fn(x:int) { if (flip()) then println(x) else println("flip false " + x.show); (x<=1) } ) + with foreach( fn(x:int) { if (flip()) then println(x) else println("flip false " ++ x.show); (x<=1) } ) [1,2,3].iterate } @@ -180,7 +180,7 @@ fun ask-age() { val name = readline() // asynchronous! println("and you age?") val age = readline() - println("hello " + name + ", you are " + age) + println("hello " ++ name ++ ", you are " ++ age) } @@ -189,10 +189,10 @@ fun ask-age-err() { println("what is your name?") val name = readline() raise("ouch!") - println("hello " + name) + println("hello " ++ name) } fn(err) { - println("error: " + err ) + println("error: " ++ err ) } } */ diff --git a/test/misc/ambients/ambient1.kk b/test/misc/ambients/ambient1.kk index 562fa3ca3..76b0db17d 100644 --- a/test/misc/ambients/ambient1.kk +++ b/test/misc/ambients/ambient1.kk @@ -8,26 +8,26 @@ fun home?() { } fun cd(path,action) { - with val cwd = cwd + path + "/" + with val cwd = cwd + path ++ "/" action() } // cd2 a, b, and c are equivalent // avoid using `mask` through the `override` keyword fun cd2a(path,action) { - with override val cwd = cwd + path + "/" + with override val cwd = cwd + path ++ "/" action() } fun cd2b(path,action) { val cur = cwd with mask - with val cwd = cur + path + "/" + with val cwd = cur + path ++ "/" action() } fun cd2c(path,action) { - with val cwd = cwd + path + "/" + with val cwd = cwd + path ++ "/" mask behind(action) } @@ -51,12 +51,12 @@ fun ex2() { ambient fun log(msg : string) : () fun log-working-dir() : () { - log("current working dir is: " + cwd) + log("current working dir is: " ++ cwd) } fun ex3() { with val cwd = "/" - with fun log(msg) { append-to-file(cwd + "log.txt", msg) } + with fun log(msg) { append-to-file(cwd ++ "log.txt", msg) } cd("var") { cd("lib") { log-working-dir() } } } @@ -81,7 +81,7 @@ fun ex4() { fun ex5() { with val cwd = "/var/lib/" - with control read-file(f) { resume("dummy contents for " + f) } + with control read-file(f) { resume("dummy contents for " ++ f) } cd("var") { cd("lib") { println(cat("file.txt")) @@ -106,11 +106,11 @@ fun is-defined?(m) { } fun append-to-file(path, content) { - println("appending to: " + path + "; content: \"" + content + "\"") + println("appending to: " ++ path ++ "; content: \"" ++ content ++ "\"") } fun read-async(filename : string, k : string -> ()) : () { - println("reading file :" + filename) + println("reading file :" ++ filename) k("contents") - println("done reading file :" + filename) + println("done reading file :" ++ filename) } diff --git a/test/misc/ambients/ambient3.kk b/test/misc/ambients/ambient3.kk index 5dae598bd..45bd0a6d3 100644 --- a/test/misc/ambients/ambient3.kk +++ b/test/misc/ambients/ambient3.kk @@ -40,7 +40,7 @@ fun pretty-emit2(action) { // with lexically scoped state fun pretty-emit(action) { var out := "" - with fun emit(s) { out := out + s + "\n" } in action() + with fun emit(s) { out := out + s ++ "\n" } in action() out } @@ -64,7 +64,7 @@ ambient fun total() : int fun emit4(action) { var out := "" with return(x) { out } - with fun emit(s) { out := out + s + "\n" } + with fun emit(s) { out := out + s ++ "\n" } with fun total() { out.count } action() } diff --git a/test/misc/ambients/anim.kk b/test/misc/ambients/anim.kk index 1925e2bdc..7b2abf4e8 100644 --- a/test/misc/ambients/anim.kk +++ b/test/misc/ambients/anim.kk @@ -98,8 +98,8 @@ fun show(gt :gtree) : div string { fun showGt(gt :gtree, indent:int) : _ string { val showi = (show : (int) -> string) match(gt) { - Take(p,moves) -> p.show + moves.show-list(fn(x) { "\n" + " ".repeat(indent) + x.fst.core/show + " -> " + x.snd.showGt(indent+2) }) - Winner(p) -> p.show + " wins" + Take(p,moves) -> p.show ++ moves.show-list(fn(x) { "\n" ++ " ".repeat(indent) + x.fst.core/show ++ " -> " ++ x.snd.showGt(indent+2) }) + Winner(p) -> p.show ++ " wins" } } @@ -115,7 +115,7 @@ fun testGt() { ambient fun cheat(player:player) : a -val cheatReport = handler fun cheat(p) { throw(p.show + " cheated!") } +val cheatReport = handler fun cheat(p) { throw(p.show ++ " cheated!") } val check = handler control move(p,n) { val m = move(p,n) @@ -234,7 +234,7 @@ val printer = handler return(x) { printBoard(get()); x } fun printBoard( gs : gstate ) : io () { gs.mymap( fn(ps) { - ps.fst.show + " -> " + ps.snd.show + ps.fst.show ++ " -> " ++ ps.snd.show }).join("\n").println } diff --git a/test/misc/ambients/context3.kk b/test/misc/ambients/context3.kk index 0c007c3f3..fb58263d5 100644 --- a/test/misc/ambients/context3.kk +++ b/test/misc/ambients/context3.kk @@ -39,7 +39,7 @@ fun pretty-emit2(action) { // with lexically scoped state fun pretty-emit(action) { var out := "" - with fun emit(s) { out := out + s + "\n" } in action() + with fun emit(s) { out := out + s ++ "\n" } in action() out } @@ -63,7 +63,7 @@ context fun total() : int fun emit4(action) { var out := "" with return(x) { out } - with fun emit(s) { out := out + s + "\n" } + with fun emit(s) { out := out + s ++ "\n" } with fun total() { out.count } action() } diff --git a/test/misc/ambients/tunnel.kk b/test/misc/ambients/tunnel.kk index 31752f798..7d9787470 100644 --- a/test/misc/ambients/tunnel.kk +++ b/test/misc/ambients/tunnel.kk @@ -131,6 +131,6 @@ fun test3b() { } fun main() { - println( ", even count a: " + test3a().show ) - println( ", even count b: " + test3b().show ) + println( ", even count a: " ++ test3a().show ) + println( ", even count b: " ++ test3b().show ) } diff --git a/test/misc/instance/namedh-named.kk b/test/misc/instance/namedh-named.kk index 540707d7b..85c086723 100644 --- a/test/misc/instance/namedh-named.kk +++ b/test/misc/instance/namedh-named.kk @@ -12,7 +12,7 @@ fun reader(init : a, action : reader -> e b) : e b { fun main() { with a = reader("hello") with b = reader("world") - println( a.ask() + " " + b.ask() ) + println( a.ask() ++ " " ++ b.ask() ) } fun escape() : reader { diff --git a/test/misc/instance/namedh-namedscoped.kk b/test/misc/instance/namedh-namedscoped.kk index ed07ebfac..7760321f6 100644 --- a/test/misc/instance/namedh-namedscoped.kk +++ b/test/misc/instance/namedh-namedscoped.kk @@ -12,7 +12,7 @@ fun reader(init : a, action : forall (reader -> e b )) : e b { // rank- fun main() { with a = reader("hello") with b = reader("world") - println( a.ask() + " " + b.ask() ) + println( a.ask() ++ " " ++ b.ask() ) } /* // rejected by the type checker as `s` escapes diff --git a/test/misc/instance/namedh-scoped.kk b/test/misc/instance/namedh-scoped.kk index b9421df48..405e7373b 100644 --- a/test/misc/instance/namedh-scoped.kk +++ b/test/misc/instance/namedh-scoped.kk @@ -17,7 +17,7 @@ fun vec(action : forall () -> |e> a ) : e a { // rank-2 signature req fun main() { with vec val ix = push("hello") - println( lookup(ix) + " world" ) + println( lookup(ix) ++ " world" ) } /* // rejected by the type checker as the index escapes the scope of vec @@ -29,6 +29,6 @@ fun escape() { fun wrong() { with vec val ix = escape() - println( lookup(ix) + " world") + println( lookup(ix) ++ " world") } */ diff --git a/test/parc/hqueens.kk b/test/parc/hqueens.kk index ab9aa154a..37baa33c2 100644 --- a/test/parc/hqueens.kk +++ b/test/parc/hqueens.kk @@ -5,9 +5,9 @@ alias solution = list -fun safe?( queen : int, xs : solution, diag : int = 1 ) : bool { +fun safe( queen : int, xs : solution, diag : int = 1 ) : bool { match(xs) { - Cons(q,qs) -> (queen != q && queen != (q+diag) && queen != (q - diag) && queen.safe?(qs,diag+1)) + Cons(q,qs) -> (queen != q && queen != (q+diag) && queen != (q - diag) && queen.safe(qs,diag+1)) _ -> True } } @@ -19,9 +19,9 @@ fun safe?( queen : int, xs : solution, diag : int = 1 ) : bool { alias solutions = list> fun append-safe( queen : int, xs : solution, xss : solutions ) : div solutions { - if (queen <= 0) xss + if (queen <= 0) then xss else { - if (queen.safe?(xs)) + if (queen.safe(xs)) then append-safe( queen - 1, xs, Cons(Cons(queen,xs),xss) ) else append-safe( queen - 1, xs, xss ) } @@ -35,9 +35,9 @@ fun extend(queen : int, acc : solutions, xss : solutions ) : div solutions { } fun find-solutions( n : int, i : int ) : div solutions { - if (i == 0) + if (i == 0) then [[]] - else extend(n, [], find-solutions(n, i - 1)) + else extend(n, [], find-solutions(n, i - 1)) } pub fun queens( n : int ) : div solutions { @@ -49,15 +49,15 @@ pub fun queens( n : int ) : div solutions { // ----------------------------------------------------------------- effect choose { - fun pick(n : int) : int - fun fail() : b + ctl pick(n : int) : int + ctl fail() : b } fun choose-all( action ) { handle(action){ - return x -> [x] - pick(n) -> list(1,n,resume).concat - fail -> [] + return(x) -> [x] + ctl pick(n) -> list(1,n,resume).concat + final ctl fail -> [] } } @@ -65,7 +65,7 @@ fun find-solution( n : int, col : int ) : solution { if (col==0) then return [] val sol = find-solution(n, col - 1) val queen = pick(n) - if (queen.safe?(sol)) then Cons(queen,sol) else fail() + if (queen.safe(sol)) then Cons(queen,sol) else fail() } fun queens-choose(n : int ) : div solutions { @@ -90,6 +90,6 @@ fun main() { fun show-solutions( xss : solutions ) : io () { println(xss.length.show) xss.foreach fn(xs) { - println(" " + xs.show) + println(" " ++ xs.show) } }