What is Clojure CLI tools "edn string" as arg? - clojure

I'm trying to pass ClojureScript compile options, specifically :asset-path.
clj --main cljs.main --help says I should pass it on the command line as "an edn string".
What exactly is an edn string in this context?
(i.e. i'm failing to successfully guess what exactly I should enter in the terminal).

Found it, this works:
--compile-opts "{:asset-path \"/js/compiled/out\"}"

Related

What is lldb's equivalent one of gdb's start command?

I heavily used gdb before, and now give lldb a shot. I like gdb's start command very much, but I can't find the equivalent one from lldb's manual. Now I can only use "b main" followed by run compound instead. So just curious whether there is an equivalent one in lldb? Or I can only use the compound of "b main" and run commands as a work-around.
You are correct, lldb doesn't have a dedicated start command. The stated motivation for that command is that gdb supports lots of runtimes that don't use a "main" symbol. That makes determining where user code begins non-trivial, and it's useful to have a command that figures that out for you. We haven't had a need for that in lldb yet.
If you always use start to run programs in gdb, then you can just set a breakpoint on main in your ~/.lldbinit file. That will get copied to any new targets that get made in your lldb session, and run will behave exactly like start (for runtimes that use a main symbol).
If it's something you would use a lot but not always, you could make your own version fairly easily using the python extension point in the command interpreter:
https://lldb.llvm.org/use/python-reference.html#create-a-new-lldb-command-using-a-python-function
Also, feel free to file an Enhancement Request with http://bugs.llvm.org.

How can I activate ceedling trace?

I am using ceedling for unit testing in a firmware I am working on.
I would like to see all command line option ceedling uses when invoking the compiler.
I tried to use the option --trace, but so for I have not found any difference.
ceedling test:all --trace
try:
ceedling verbosity[4] test:all
If you are on a Windows machine, the command line args can be intercepted like this:
Create a little command line tool ShowArgs.exe that displays the given command line args in a message box.
Create a registry key in SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Foo.exe whereas Foo.exe is the name of the compiler without the path.
Add a value with name debugger and value "" including the quotation marks, e.g.
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Foo.exe\debugger="C:\Temp\ShowArgs.exe"
Now ShowArgs.exe acts as the debugger for Foo.exe and is called instead. The first argument is the path to Foo.exe, all other arguments are the ones you are interested in.

Compile C/C++ with gVim 8.1 in Windows 10 (MinGW)

Since everything is 32-bit, I used :set makeprg=mingw32-make, and then tried compiling via :!make, which gave the following error message:
'make' is not recognized as an internal or external command, operable program or batch file.
shell returned 1
I tried the basic "Goodbye World" stuff:
#include <iostream>
int main() {
std::cout << "Goodbye World";
return 0;
}
What am I doing wrong? Other than being a noob.
:!make doesn't run 'makeprg'. It runs make. Since you are specifically trying to run mingw32-make.exe, presumably you don't have an executable named make.exe. (See :help :!)
:make runs 'makeprg'. (See :help :make, :help 'makeprg')
my goal is to see the "Goodbye World" either in console or terminal or any observable way. Would this require additional tinkering to the _vimrc file?
You would rather want to do it by tinkering with your makefile. Any arguments to :make will be passed to 'makeprg'. If you defined targets clean (to remove the Make artefacts) or run (to execute the product of your Make), you will be able to write :mak clean or :mak run in Vim to run those targets. Obviously, you can create your own commands and/or mappings to make those :make commands faster.
Note (and I completely overlooked this myself, silly me) that when you run a simple code, such as the one above, that does not need extensive file managements and Makefiles, all you need to go is :!gcc % for C and :!g++ % for C++. I believe (and I may be wrong, but this is a simple observation) that in Vim, :! indicates the following commands are to be executed in the system Command Prompt, and gcc/g++ is the command to invoke the GNU Compiler for C and C++ respectively. Finally, % is used to indicate the current filename, with all extensions intact. This is extremely useful in cases of keymapping, as I have done via the following:
nnoremap <F5> :!g++ %<CR>|"Press Func.5 to Compile via GNU Comp.

Different slurp behavior with "lein run" and running the uberjar file

I am currently trying to learn Clojure and as part of my practical training, I am
implementing the very basic behavior of some of the well known Unix tools like grep,
cat, ls and so on.
While implementing cat, I stumbled upon some seemingly strange behavior of
slurp. When I run the following code with lein run some-file.txt while some-file.txt
lies within the current directory, the content is printed to STDOUT as expected.
(ns cat.core
(:gen-class))
(defn -main
"Reads the content of its arguments representing filenames and outputs the
content in succession."
[& filenames]
(doseq [filename filenames]
(println "Reading" filename) ; Just for debugging purposes
(print (slurp filename))))
However, if I uberjar the project with
lein compile
lein uberjar
and then cd to target/uberjar to run the standalone JAR with
java -jar cat-0.1.0-SNAPSHOT-standalone.jar some-file.txt (with the text file present in that directory),
nothing but my debug message gets printed. What I find so strange is that there is no error
message being shown, so it seems to me that the file can be found. If I run the
JAR with a file that does not exist as parameter, I get an exeption that the specified
file cannot be found (as expected).
Because I am working on a Windows machine, a colleague suggested that perhaps Windows
shadow files might be a problem. So I tested the program under Linux again and the
same behavior occured. So this seems to be a "problem" with my Clojure understanding / my project
settings.
My question is: Why is slurp's (or the program's) behavior different when running
with lein run and when running the standalone JAR with java -jar cat-0.1.0-SNAPSHOT-standalone.jar and what can I do to solve this?
As the file parameter is not a resource that is compiled into the JAR, there is no
need for (slurp (clojure.java.io/resource filename)) if I am not mistaken.
print does not flush the output buffer. You need to use flush after your print statement, or use another println, which flushes on newline:
(defn -main
"Reads the content of its arguments representing filenames and outputs the
content in succession."
[& filenames]
(doseq [filename filenames]
(print (slurp filename))
(flush)))

How to load ocamlmktop result in aquamacs?

I am basically executing:
ocamlmktop -o mytoplevel 1.cmo 2.cmo
and I get by an executable toplevel. The question is how do I make aquamacs run that toplevel?
It depends of the Emacs mode that you use to develop in OCaml under Aquamacs. As tuareg-mode is by far the most popular choice, I consider this case.
You usually start an OCaml toplevel with the command M-x tuareg-run-ocaml which prompts for a toplevel to start. You can here enter the path to your custom toplevel.
The toplevel proposed by tuareg-run-ocaml is actually the value of the variable tuareg-interactive-program, you can take advantage of this to define a custom tuareg-run-mytoplevel function with:
(defun tuareg-run-mytoplevel ()
(interactive)
(let ((tuareg-interactive-program "/path/to/mytoplevel"))
(tuareg-run-ocaml)))
If you put this definition in your ~/.emacs, you can then use the command M-x tuareg-run-mytoplevel to start your own toplevel.