How to open kotlin repl using kotlin-native-linux? - kotlin

I just downloaded kotlin compiler kotlin-native-linux-1.3.61.tar.gz
from here: https://github.com/JetBrains/kotlin/releases/tag/v1.3.61
But when I try to open the repl, as proposed in the documentation, running:
/opt/kotlin-native-linux-1.3.61/bin/kotlinc
I get:
error: you have not specified any compilation arguments. No output has been produced.
The documentation says: "We can run the compiler without parameters to have an interactive shell"
How can I open the kotlin repl?

repl is available in kotlin-compiler-1.3.61.zip.
kotlin-native is for compiling Kotlin code to native binaries, which can run without a virtual machine.
Probably there is no reason to add repl and -script support on kotlinc of kotlin-native package.

Related

importing one ml file into another

I have an interpreter.ml file that contains an interpreter and some type definitions.
I've developed some test batteries to check if the interpreter works well or not.
When I put the functions I use to test the behaviour of the interpreter in the same file of the interpreter all works well, but if I try to use a different file for the tests (let's say tests.ml) it did not load the interpreter functions and definitions.
the interpreter.ml and tests.ml are in the same folder
I tried both with open Interpreter and #use "./interpreter.ml" from inside tests.ml but it wont compile nor shut down the warnings in the IDE (kind of...I'm using Visual Studio Code on MacOs )
I've already tried to follow the official documentation but it won't compile with ocamlopt -c tests.ml
As a result of discussions, the executable is obtained by compiling the 2 files test.ml & interpreter.ml in the right order (test.ml relies on objects defined in interpreter.ml; as a consequence test.ml has to reference to interpreter objects either via the clause open Interpreter or by prefixing all relevant items with Interpreter ):
ocamlc -o exec interpreter.ml test.ml
ocamlbuild is easier as it resolves by itself the dependencies:
The following command:
ocamlbuild test.native
will produce the executable.

How can I get the Frege compiler to see Android API classes when using Gradle?

I am attempting to write an Android app using the Frege language. Unfortunately, I'm not aware of any examples of how to do this.
So, I'm using Gradle as my build system, with the Android Gradle plugin. Then to get the Frege code to be compiled, I'm using a javaexec to call the frege compiler before the Java files get compiled, as suggested in this post.
I was successful in building an Android application with Frege code that gets called by Java code, as shown here.
However, the Frege code can only call standard Java APIs. It can't call any of the Android APIs.
I'd like to be able to call Android APIs from Frege. There is a nice repo here that has Frege wrappers for the Android APIs. Unfortunately, it has no build system or instructions.
I believe I've successfully set up my build.gradle to build the FregeAndroid wrappers along with my project's code. The Frege compiler is indeed attempting to build them.
However, the FregeAndroid code fails to compile, because it can't see the Android API classes. I assume I need to somehow find where the Android API classes are, and then add that to the Frege compiler's classpath, so it can see those classes. Unfortunately, this is where I'm stuck. I'm a newbie at Gradle, and can't figure out how to do this.
Here is my project which I have so far, which fails to build, in the following way:
:compileDebugJavaWithJavac
Frege compiler args: "-inline -d src/frege -make -fp /Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar -sp /Users/ppelleti/programming/android/frege-on-android/FregeAndroid/src /Users/ppelleti/programming/android/frege-on-android/FregeAndroid/src/frege/android/animation/TimeInterpolator.fr"
calling: javac -cp /Users/ppelleti/.gradle/caches/modules-2/files-2.1/org.frege-lang/frege/3.23.401-g7c45277/716990197271fdc15917b4f8d023d63009ba6e39/frege-3.23.401-g7c45277.jar:/Users/ppelleti/Library/Android/sdk/extras/android/m2repository/com/android/support/multidex/1.0.0/multidex-1.0.0.aar:src/frege:/Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar -d src/frege -sourcepath /Users/ppelleti/programming/android/frege-on-android/FregeAndroid/src -encoding UTF-8 src/frege/frege/android/animation/TimeInterpolator.java
runtime 4.282 wallclock seconds.
Frege compiler args: "-inline -d src/frege -make -fp /Users/ppelleti/Library/Android/sdk/platforms/android-21/android.jar -sp /Users/ppelleti/programming/android/frege-on-android/FregeAndroid/src /Users/ppelleti/programming/android/frege-on-android/FregeAndroid/src/frege/android/app/Activity.fr"
Android.app.TaskStackBuilder: build failed because module is not on class path
Android.app.Fragment: build failed because module is not on class path
Android.app.LoaderManager: build failed because module is not on class path
[... omitted a bunch of similar lines ...]
Any ideas would be much appreciated!
It turns out that there were several problems, including problems with both the source path and the classpath. I've updated my repository to fix these problems.
However, ultimately the build fails because there are files missing from the FregeAndroid repo. So to get my example to build, it would be necessary to fix the FregeAndroid wrappers or write new wrappers.

How to use vtk's tcl wrapper on win7?

I have downloaded and built the vtk libraries (with tcl wrapper) with cmake (and have checked vtk_bin to see that they were there. I'm having a hard time finding out how to actually use a tcl script that requires vtk, I receive error messages for vtk functions when I run the script.
Was calling it wrong, the scripts can be called vtk blah.tcl, and I made sure the RelWithDebInfo directory was targeted/full

How to build zeromq with MinGW?

I've tried official howto but failed. I got error:
"The procedure entry point InterlockedCompareExchange#12 could not be located in the dynamic link library libstdc++-6.dll"
The problem was due the old gcc compiler, bundled with DevKit from rubyinstaller.org (4.5 vs 4.8 on my PC). Use MSYS instead. Assume we have zeromq source inside D:\libs\zeromq, then the procedure is:
Download GUI MinGW installer.
Install base and MSYS (if you already have working gcc compiler you probably only need MSYS).
Launch MSYS environment by executing C:\MinGW\msys\1.0\msys.bat.
Follow Using MSYS with MinGW section:
mount c:/mingw /mingw
cd /d/libs/zeromq
./configure --prefix=/mingw
make
Copy /d/libs/zeromq/src/.libs/libzmq.dll to your desired place.
In fact I needed to use ZeroMQ with C++, so I downloaded zmq.hpp, moved it to include directory, and compiled hwserver.cpp to test it:
C:\MinGW\bin\g++.exe -o hwserver hwserver.cpp -L. -lzmq -ID:\libs\zeromq\include
It worked, but when I launch it I got:
Assertion failed!
Program: D:\tmp\zmq\hwserver.exe
File: D:\libs\zeromq\include/zmq.hpp, Line 280
Expression: rc == 0
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I've managed to get rid of this failure by commenting lines 279, 280. Similar issue

#load "unix.cma" causes syntax error

I'm trying to compile / run in interpreter a program written by another programmer. This program uses this construct:
#load "unix.cma"
which I haven't encountered before. I've found this page: http://ocamlunix.forge.ocamlcore.org/generalities.html which mentions it, but typing this code into interpreter results in syntax error. Same thing happens when I run the file with this instruction through ocamlc. What am I missing?
ocamlc -v
The Objective Caml compiler, version 3.12.1
Standard library directory: /usr/lib64/ocaml
#load is a toplevel directive, which is not available in ocamlc nor ocamlopt compilers but only in OCaml toplevel (REPL) ocaml. See http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html#toc91. Use the toplevel to run the program:
ocaml blahblah.ml