emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jarmo Hurri <jarmo.hurri@iki.fi>
To: emacs-orgmode@gnu.org
Subject: Re: Scala problem in Babel
Date: Mon, 03 Apr 2017 11:10:28 +0300	[thread overview]
Message-ID: <87o9wdykqz.fsf@iki.fi> (raw)
In-Reply-To: 87r31bm19v.fsf@iki.fi


Jarmo Hurri <jarmo.hurri@iki.fi> 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

      reply	other threads:[~2017-04-03  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-02 12:39 Scala problem in Babel Jarmo Hurri
2017-04-03  8:10 ` Jarmo Hurri [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9wdykqz.fsf@iki.fi \
    --to=jarmo.hurri@iki.fi \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).