Trying to run a code in SML - error? - emacs

I get an error when trying to run this sml-code in eMacs, and can't figure out what went wrong? Please help?
fun nearest(a,[]) = raise Empty
| nearest(a,t::[]) = route(a,t)
| nearest(a,t::s) = Real.min(route(a,t), nearest(a,s);
the error in SML:
| nearest(a,t::s) = Real.min(route(a,t), nearest(a,s);
! ^
! Syntax error.

First of all, you are missing a paren as bnbeckwith said.
Unfortunately mosml doesn't have the best errormessages.
More pedantically, Emacs doesn't "run" your code, Emacs is just your editor and you are actually using mosml to run your code. Using sml-mode you can integrate mosml into Emacs to make development easier.
But please, we have an entire forum for you at absalon, and TAs/instructors willing to help there.

It looks like Real.min is missing a closing paren.

Related

Vscode: Hypersnips excention sometimes duplicates cursor

I have the following snippet in the hypersnips extension (in vscode)
snippet txt "text in math" imA
\text{$1}
endsnippet
Usually, it works fine with me typing txt and it automatically sends me to
However, sometimes when using a snippet I get the following
After this occurs, if I delete that and try again, I get
This "bug" (?) occurs 10-20 per cent of the time and it is very annoying. Moreover, it is not unique to a specific snippet.
I have tried changing the version of vscode and of the extension but nothing has seemed to work.
Any help will be greatly appreciated.
EDIT: Screenshot to address rioV8's comment
I think that it is the bug of VSCode. When you overlap placeholders more than (about) 18 times, it occurs.
Just because HyperSnips adds too many placeholders, you noticed the bug.
Test: use VSCode keybindings to add snippet (without extensions).
ctrl+M inserts $|$ | .
Click here to view the result
However I don't know why it occurs and how to solve the problem. Sorry for that.

How do I find and edit cider-lein-parameters?

I'm new to Clojure, lein and spacemacs. I'm attempting to get the cider-jack-in repl going in spacemacs, but it's failing to load. After searching online, I think the solution to this issue is here. Specifically,
"For anyone else running into this issue, this can be fixed by setting cider-lein-parameters to "repl :headless :host localhost" (the default value is "repl :headless :host ::")"
My problem is that I have no idea where the cider-lein-parameters file is, or if it even is a file. And because I can't even locate it, I cannot edit it. I've done extensive searches on this, but haven't found anything useful. Can anyone guide me with a basic explanation of what this is and how I can edit it? Is this a spacemacs thing? Or a lein thing?
Any and all help would be greatly appreciated! Thank you!
Press M-x (Alt-x), then enter set-variable command
Select or enter cider-lein-parameters variable name
Enter its value in double quotes. e.g. "new value"

Org-mode "header-args" and padline

I'm trying to get ride of all padlines added during the Org-mode tangle for every kind of code block. So I write this on the top of my file :
#+PROPERTY: header-args :padline no
But the padlines stay there after the tangle.
Next I try this :
#+PROPERTY: header-args:sh :padline no
Guess what... it work only for sh code block.
If anyone can help me....
Thanks !
So, I finally found the solution. This was due to an out-of-date version of org-mode (I was using the version 8.2.10). In this version the padline header-args does not work (or not implemented I haven't check it). So, just update the org version (now I'm using 9.1.2) and all will be fine.

How to copy word without selection in emacs?

I looked into this page: http://emacswiki.org/emacs/CopyWithoutSelection.
I copied the exactly same code to my .emacs. Somehow, only the copy-line and copy-paragraph work. But what I really want is copy-word. Every time I ran copy-word, I got an error like: "wrong type argument: integerp, nil". The weird thing is the only difference between copy-word and copy-line is copy-thing backward-wordforward-word arg instead of beginning-of-line andend-of-line, and all of them are build-in. I was wondering why the copy-line works while the copy-word doesn't.
Can anyone help me out of this?

Emacs - help() output in web-browser

I started using Emacs (ESS) as a default R editor (yes, #Dirk, as you've said, I want ESS), and I must admit it's by far the best R editor I've been using so far. However, I cannot manage to get an output of help() function up to web browser. It keeps displaying help page in a separate R buffer, even if options(help_type = "html", browser = "firefox") are set.
How can I get help back to browser, while using Emacs/ESS?
I can reproduce this under Linux: If I run R from the terminal, setting options(htmlhelp=TRUE) brings up help in a browser, but it fails from ESS. However,
help("plot",htmlhelp=getOption("htmlhelp"))
works -- help opens in Firefox for me. I think that's an anomalous behavior -- htmlhelp=getOption("htmlhelp") is a default argument for help (see ?help). Could it be a bug?.. A possible workaround is to invoke help via help("plot",htmlhelp=T) directly, or write a wrapper like myhelp <- function(x) help(x,htmlhelp=TRUE).
EDIT: A possible solution: put this into your .emacs
(setq inferior-ess-r-help-command "help(\"%s\", htmlhelp=TRUE)\n")
as per https://stat.ethz.ch/pipermail/ess-debian/2009-October/000093.html. This refers to ESS 5.5; the current one in Ubuntu repositories is 5.4, so I can't test the fix w/o upgrading ESS.
EDIT2: I upgraded to the latest R/ESS as per Dirk's suggestion, and did the following, after launching R/ESS: M-x customize-variable inferior-ess-r-help-command and replaced help_type=text with help_type=html. That fixed things (at least for version 2.10.1/ESS 5.8).