From 7db6413ad1d17e7ce4fea3a64f5de435039ad9a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Mon, 18 Sep 2017 14:23:53 +0300 Subject: [PATCH] (refs #7489) Added replicate function to Prelude Also removed a debug print from OpenDeclaration. Change-Id: I9fff24e82183dfee46354800f277ab1987bb5d09 --- bundles/org.simantics.scl.runtime/scl/Prelude.scl | 9 +++++++++ .../org/simantics/scl/ui/editor2/OpenDeclaration.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index f0eca0eb2..83d84ccf2 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -1065,6 +1065,15 @@ mapEither f list = runProc do Right v -> addArrayList r v) (Java.unsafeCoerce l, Java.unsafeCoerce r) +"`replicate n v` returns a list of length `n` such that each element is a copy of `v`." +@inline +replicate :: Integer -> a -> [a] +replicate n v = build (\empty cons -> + let aux 0 l = l + aux i l = aux (i-1) (cons l v) + in aux n empty + ) + /// FunctorM /// class (Functor f) => FunctorM f where diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenDeclaration.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenDeclaration.java index 378840397..878d8e24f 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenDeclaration.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenDeclaration.java @@ -107,7 +107,7 @@ public class OpenDeclaration extends AbstractHandler { SCLTextEditorEnvironment editorEnvironment = moduleEditor.getSCLTextEditorEnvironment(); editorEnvironment.updateEnvironment(moduleEditor.getDocument()); SCLValue value = editorEnvironment.getValue(identifierAtCaret); - System.out.println("identifierAtCaret = " + identifierAtCaret + " [" + Locations.beginOf(value.definitionLocation) + ", " + Locations.endOf(value.definitionLocation) + "]"); + //System.out.println("identifierAtCaret = " + identifierAtCaret + " [" + Locations.beginOf(value.definitionLocation) + ", " + Locations.endOf(value.definitionLocation) + "]"); if(value != null) OpenSCLDefinition.openDefinition(value); } -- 2.43.2