Greetings. I am illustrating some basic syntactic differences between programming languages to some people. In order to do this I embedded a small Scala program into an Org file
#+BEGIN_SRC scala :exports both object Fibonacci extends App { def fib (n : Int) : Int = { if (n == 1 || n == 2) n - 1 else fib (n - 1) + fib (n - 2) } println (fib (7)) } #+END_SRC This isn't in any way a correctly efficient way to (recursively) calculate numbers from the sequence, but this is only about syntactics for beginners, so I need to keep it very simple. Anyway, when I compile and run this code in Scala it works just fine: ------------------ [jarmo@localhost tmp]$ scalac test.scala [jarmo@localhost tmp]$ scala Fibonacci 8 ------------------ But C-c C-c in Org mode gives me a warning and no result: #+RESULTS: : /tmp/babel-6890GcO/scala-6890K2a:6: warning: Fibonacci$2 has a main method with parameter type Array[String], but Main.$anon$2.$anonfun$1.Fibonacci$2 will not be a runnable program. : Reason: companion contains its own main method, which means no static forwarder can be generated. : : object Fibonacci extends App : ^ : one warning found : () When I look at the temporary file I see that the code has been embedded in a wrapper defined in ob-scala.el. I guess it's the wrapper that messes up the execution of the code. What is the wrapper for? How am I supposed to use it? Jarmo