Scala in SMC?

67 views
Skip to first unread message

Hal Snyder

unread,
Sep 17, 2014, 1:44:50 AM9/17/14
to sage-...@googlegroups.com
I see .scala is a supported file format for editing: What can SageMathCloud (SMC) do? Will Scala be added? Or is it there already and I'm not seeing it?

.sagews worksheets are a big win for online study, and this class just started: Functional Programming Principles in Scala, from Martin Odersky, creator of Scala.

Harald Schilly

unread,
Sep 17, 2014, 5:25:47 AM9/17/14
to sage-...@googlegroups.com
Good idea, thank you. William has to install the "scala" package
everywhere. After that, I don't know if working in an sagews would
work at all. Maybe just for small examples …

-- h
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/b66d1bcd-9ecb-4c84-98b2-d5b0a91bf76e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

William A Stein

unread,
Sep 17, 2014, 10:35:18 AM9/17/14
to sage-cloud
On Wed, Sep 17, 2014 at 2:25 AM, Harald Schilly
<harald....@gmail.com> wrote:
> Good idea, thank you. William has to install the "scala" package
> everywhere. After that, I don't know if working in an sagews would
> work at all. Maybe just for small examples …

I've installed scala everywhere, so now people can type "scala" in a
terminal, and they get scala. They can also edit scala code in a
file.

I haven't written a new %scala mode for Sage, partly because
I don't know scala at all...

William

>
> -- h
>
> On Wed, Sep 17, 2014 at 7:44 AM, Hal Snyder <drx...@gmail.com> wrote:
>> I see .scala is a supported file format for editing: What can SageMathCloud
>> (SMC) do? Will Scala be added? Or is it there already and I'm not seeing it?
>>
>> .sagews worksheets are a big win for online study, and this class just
>> started: Functional Programming Principles in Scala, from Martin Odersky,
>> creator of Scala.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-cloud" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-cloud+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-cloud/b66d1bcd-9ecb-4c84-98b2-d5b0a91bf76e%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB5s0Nnbkm8SbtmTcVJ5hmWv%3Duxqv7v3WdqF4Nm-tH7Asg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
wst...@uw.edu

Hal Snyder

unread,
Sep 17, 2014, 11:13:14 AM9/17/14
to sage-...@googlegroups.com
Thanks! I had just installed scala as user and updated my path...

Is there a way to run a subshell in a %python or other mode inside SMC and keep state from one cell to the next? That might be a work-around, pending availability of %scala.

Or is there something else I can do to help?

Harald Schilly

unread,
Sep 17, 2014, 11:22:36 AM9/17/14
to sage-...@googlegroups.com
On Wed, Sep 17, 2014 at 5:13 PM, Hal Snyder <drx...@gmail.com> wrote:
> Or is there something else I can do to help?


Could you point us to some copy/paste ready scala examples?
Is this representative?
https://www.cs.helsinki.fi/u/wikla/OTS/Sisalto/examples/html/ch16.html

I think the first step is to have small code pieces working, then
being able to edit the source files with syntax highlighting (i.e.
associating *.scala files with the editor), and only then and if it is
feasible, to also thinking about integrating it into the sagews via
such a magic command.

Another question is, if there is an existing program for interactive
scala programming (like ipython for python)

-- h

William A Stein

unread,
Sep 17, 2014, 11:27:48 AM9/17/14
to sage-cloud
On Wed, Sep 17, 2014 at 8:22 AM, Harald Schilly
<harald....@gmail.com> wrote:
> On Wed, Sep 17, 2014 at 5:13 PM, Hal Snyder <drx...@gmail.com> wrote:
>> Or is there something else I can do to help?
>
>
> Could you point us to some copy/paste ready scala examples?
> Is this representative?
> https://www.cs.helsinki.fi/u/wikla/OTS/Sisalto/examples/html/ch16.html

I copied/pasted the linked to Misc.scala into a file Misc.scala:

https://www.cs.helsinki.fi/u/wikla/OTS/Sisalto/examples/lists/Misc.scala

and edited it in SMC. Proper syntax highlighting is already supported.

In a terminal, I then did

scala Misc.scala

and it ran and output stuff:

~$ scala Misc.scala
assoc [true]
msort((x: Int, y: Int) => x < y)(List(5, 7, 1, 3)) [List(1, 3, 5, 7)]
forList [List((2,1), (3,1), (3,2), (4,1), (4,2), (4,3))]

>
> I think the first step is to have small code pieces working, then
> being able to edit the source files with syntax highlighting (i.e.
> associating *.scala files with the editor), and only then and if it is
> feasible, to also thinking about integrating it into the sagews via
> such a magic command.
>
> Another question is, if there is an existing program for interactive
> scala programming (like ipython for python)
>
> -- h
>
> --
> You received this message because you are subscribed to the Google Groups "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB4OcBwMJX0G3yKKLDpHTD096u7guHCU1yupg-f8anN-ew%40mail.gmail.com.
Message has been deleted

Samuel Lelièvre

unread,
Sep 20, 2014, 12:53:29 PM9/20/14
to sage-...@googlegroups.com

2014-09-17 17:22:36 UTC+2, Harald Schilly:


Another question is, if there is an existing program for interactive
scala programming (like ipython for python)

There is IScala, installing it is now ticket #169:
https://github.com/sagemath/cloud/issues/169

Hal Snyder

unread,
Sep 20, 2014, 7:22:12 PM9/20/14
to sage-...@googlegroups.com
This looks very interesting.

I wonder if there can't be a generic solution for background processes in a .sagews worksheet, so that a new solution does not have to be hand-coded every time an interpreter is added. It would also be nice to have a stateful sh or irb session that can be visited across cells in a sheet. I can think of a few others, too: erlang, groovy(sh), even bc and awk.
Reply all
Reply to author
Forward
0 new messages