From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarmo Hurri Subject: Re: Scala problem in Babel Date: Mon, 03 Apr 2017 11:10:28 +0300 Message-ID: <87o9wdykqz.fsf@iki.fi> References: <87r31bm19v.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cux4T-0002MY-Ba for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 04:10:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cux4P-0003DX-17 for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 04:10:41 -0400 Received: from [195.159.176.226] (port=51601 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cux4O-0003DT-Po for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 04:10:36 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cux4G-0003I3-8C for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 10:10:28 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Jarmo Hurri writes: > 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? Ok, got it by taking a closer look at ob-scala.el. In Babel scala code isn't compiled and executed, it is run in interactive mode (shell). The following works as expected (just as an example; you can also do this without the Fibonacci class). #+BEGIN_SRC scala :exports both :results output object Fibonacci { def fib (n : Int) : Int = { if (n == 1 || n == 2) n - 1 else fib (n - 1) + fib (n - 2) } } println (Fibonacci.fib (7)) #+END_SRC #+RESULTS: : 8 Jarmo