From 6eb9cf17f161522d4eddf6783284952f8a84f099 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 15 Apr 2018 02:24:27 -0400 Subject: - Fixes for R back-end. --- .../luxc/lang/translation/r/procedure/common.jvm.lux | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index 1bcd560e9..bc2289f6a 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -165,7 +165,7 @@ (do-template [ ] [(def: ( [subjectO paramO]) Binary - ( paramO subjectO))] + ( (runtimeT.int64-low paramO) subjectO))] [bit//shift-left runtimeT.bit//shift-left] [bit//signed-shift-right runtimeT.bit//signed-shift-right] @@ -312,6 +312,8 @@ (function (_ value) (r.apply (list value) func))) +(def: nat//char (|>> runtimeT.int64-low (apply1 (r.global "intToUtf8")))) + (def: nat-procs Bundle (<| (prefix "nat") @@ -326,7 +328,7 @@ (install "min" (nullary nat//min)) (install "max" (nullary nat//max)) (install "to-int" (unary id)) - (install "char" (unary (apply1 (r.global "intToUtf8"))))))) + (install "char" (unary nat//char))))) (def: int-procs Bundle @@ -459,17 +461,21 @@ ## [[IO]] (def: (io//exit input) - (-> Expression Expression) + Unary (r.apply-kw (list) (list ["status" (runtimeT.int//to-float input)]) (r.global "quit"))) +(def: (void code) + (-> Expression Expression) + (r.block (r.then code runtimeT.unit))) + (def: io-procs Bundle (<| (prefix "io") (|> (dict.new text.Hash) - (install "log" (unary (apply1 (r.global "print")))) - (install "error" (unary (apply1 (r.global "stop")))) + (install "log" (unary (|>> r.print ..void))) + (install "error" (unary r.stop)) (install "exit" (unary io//exit)) (install "current-time" (nullary (function (_ _) (runtimeT.io//current-time! runtimeT.unit))))))) -- cgit v1.2.3