Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 30 2019 14:37
    bhaskarmelkani starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 29 2019 04:27
    JYInMyHeart starred lihaoyi/Ammonite
  • Jan 28 2019 15:07
    ishubelko starred lihaoyi/Ammonite
  • Jan 25 2019 22:38
    borissmidt starred lihaoyi/Ammonite
  • Jan 25 2019 17:12

    alexarchambault on 1.6.3

    (compare)

  • Jan 25 2019 17:11

    alexarchambault on master

    1.6.3 (compare)

  • Jan 25 2019 15:48
    alexarchambault commented #923
  • Jan 25 2019 01:15

    lihaoyi on gh-pages

    5ad9ae5538f23cab92ccd8c6b1617d8… (compare)

  • Jan 25 2019 00:50

    alexarchambault on master

    Partly revert 84d48542 (#923) … (compare)

  • Jan 25 2019 00:50
    alexarchambault closed #923
  • Jan 25 2019 00:50
    alexarchambault closed #920
  • Jan 25 2019 00:50
    alexarchambault closed #922
  • Jan 24 2019 23:13
    lihaoyi commented #923
  • Jan 24 2019 22:39
    alexarchambault closed #921
  • Jan 24 2019 22:39
    alexarchambault commented #921
  • Jan 24 2019 22:39
    alexarchambault edited #923
  • Jan 24 2019 22:38
    alexarchambault opened #923
  • Jan 24 2019 22:37
    david-bouyssie commented #919
  • Jan 24 2019 21:33
    nksureshkumar commented #922
Olivier Mélois
@Baccata
@gernot-ohner, ammonite embeds os-lib : https://github.com/com-lihaoyi/os-lib, so you can do os.list(os.pwd / "abc-def")
1 reply
Daniel Sebban
@dsebban_twitter
I am wondering, is there a way to get tab autocompletion for flags in scala-scripts ? zsh gives auto completion for all commands like grep is there a way to get the same behaviour for my .sc ?
Jesse Atkinson
@jsatk
Hello. How do I include cats into ammonite? Everything i see references ivy but I'm on SBT 1.4.7 which uses coursier.
Jesse Atkinson
@jsatk
nevermind. I see that ammoite just works with ivy
@import $ivy.`org.typelevel::cats-core:2.1.1`, cats._, cats.data._, cats.implicits._
import $ivy.$                               , cats._, cats.data._, cats.implicits._
@ val x = List(Some(1))
x: List[Some[Int]] = List(Some(1))
@ x.seq
sequence   sequence_
@ x.sequence
cmd2.sc:1: Could not find an instance of Applicative for G
val res2 = x.sequence
             ^
Compilation Failed
Any idea why I can't sequence here?
Sakib Hadžiavdić
@sake92
@jsatk you need val x: List[Option[Int]] = List(Some(1))
there's no implicits defined for Some, only for Option AFAIK
in cats
Brian Maso
@bmaso
Is there a way to control the Scala version used by Ammonite? I want to use 2.12 for a project I'm on, but the latest release of Ammonite seems to strongly prefer/require 2.13
Li Haoyi
@lihaoyi
download the binary for that scala version, or if you're using Ammonite via ivy then you can choose the version there
Brian Maso
@bmaso
TY -- found this (a little difficult to suss out) on the Ammonite site just now: http://ammonite.io/#OlderScalaVersions
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Also consider using coursier to launch ammonite (if that's an option):
cs launch ammonite --scala-version 2.13.4
Hans de Jong
@hansdejong
Hi all. In Ammonite.io/embedding it says":
"You can configure the instantiated REPL by passing in arguments to the Main() call, e.g. to redirect the input/output streams or to run a predef to configure it further."
I've no idea what to redirect to what kind of argument. I'm embedding the repl from scala-swing (also in ammonite, embedding works) and I want the IO from and to two TextFields. Are there any suggestions?
Erik Vesterlund
@erikv85
Bump:
.
Sakib Hadžiavdić
@sake92
@erikv85 I think you need os.pwd
eslo
@eslo:hacklab.fi
[m]
Hi! I would like to visualize some of the stuff I did in ammonite. Does anybody have suggestions on what would be the easiest way to get drawings done?
I tried an example with java.awt , but nothing seems to happen. I think I might need to make a window for the drawing somehow.
eslo
@eslo:hacklab.fi
[m]

Ok. I think I want to try processing library for drawing.
For some reason I can't get ammonite to import it though.
import $ivy.org.processing::core:3.3.6
seems to search maven for
.../org/processing/core_2.13/3.3.6/...
instead of the address where things seem to actually exist:
.../org/processing/core/3.3.6/...

Can I get this right somehow?
Or does this just mean my scala version is not supported.

Or do I just have to load it manually?
Apparently this should work with sbt
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
:: adds the scala version prefix, for java libraries you need to use :
sbt will have the same problem if %% was used on this artifact instead of %
eslo
@eslo:hacklab.fi
[m]
Ok great! Now it works! 👍️ I hope my questions aren't too stupid.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
they aren't :) everyone gets bitten by this at some point (or several times)
eslo
@eslo:hacklab.fi
[m]
I managed to get the processing library drawing some lines in an sbt project, but I can't seem to do that inside ammonite. It just compiles and then does nothing. I can import the defined things to ammonite repls, but they don't do much. I guess I have to figure a way to run this thing.
I think this part is the problem:
object ProcessingTest extends App {
PApplet.main("ProcessingTest")
}
I think sbt just runs that as the main somehow. just setting that as @main didn't seem to help alone
eslo
@eslo:hacklab.fi
[m]
It seems to me right now that the problem might be in that "ProcessingTest" is not actually the name of the class when running inside ammonite for some reason.
eslo
@eslo:hacklab.fi
[m]
I just don't know how to provide it correctly for PApplet.main()
eslo
@eslo:hacklab.fi
[m]
Ok I can' t get this thing to work. I'm altering between getting a ClassCastException and something about my class being private.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
when you extend App it uses a crusty old feature called DelayedInit to capture the body of the object and create a main method out of it
eslo
@eslo:hacklab.fi
[m]
I think I understand that much. I just have no clue how to provide the class as a fitting parameter to the PApplet.main. it just appears to have no access to it in the context of ammonite.
eslo
@eslo:hacklab.fi
[m]
Haa I figured it out ... Kind of at least.
Apparently if I just use MyClass.getClass.getName it gives one extra dollar sign at the end of the string which breaks things.
Otherwise I could use the format it produces.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
yeah, objects have $ in their classname (I think in bytecode they're just classes with all static fields)
eslo
@eslo:hacklab.fi
[m]
The working end result was "ammonite.predef.FilePredef$MyClass"
It still has one dollar sign, but the last one was apparently too much.
eslo
@eslo:hacklab.fi
[m]
Red a bit online and now I think I understand what is going on here. The trailing dollar is a scala thing and java interop does not want them.
George K. Thiruvathukal
@gkthiruvathukal
Does anyone know if Ammonite can be installed without root?
1 reply
All of the Linux instructions only show sudo, so I thought I would check.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
@gkthiruvathukal: Echoing what crater2150 said, I can add that I manage ammonite using Coursier, and it uses a local folder that I added to the PATH
Erik Vesterlund
@erikv85

@sake92

@erikv85 I think you need os.pwd

What is that, a command to type, or what? With backticks doesn't work, and without prints my working directory, ~.

This is in regards to how to get :type to work in ammonite.

George K. Thiruvathukal
@gkthiruvathukal
@velvetbaldmime:matrix.org , thank you!
And thanks to @crater2150:qwertyuiop.de as well.
LingarajVB
@LingarajVB
I have a constants.scala file where there are hundreds of hardcoded string vals like below:
val dataInput = "raw.inputPath"
I want all of them to be able to use inside Ammonite REPL, how can I import it ? Please help!
LingarajVB
@LingarajVB
Got it! no worries.
Stephen Duncan Jr
@jrduncans
What should I be checking if running ammonite repl shows Scala 2.13.6 when started, but then attempts to use things seems to be referencing Scala3 library files and failing?
> amm
Loading...
Welcome to the Ammonite Repl 2.3.8-124-2da846d2 (Scala 2.13.6 Java 11.0.10)
@ import scala.util.Random
error while loading NotGiven, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in <path>/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)', required by <path>/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.0.0/scala3-library_3-3.0.0.jar(scala/util/NotGiven.class)…