Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 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


  • 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
Peter Aaser
Seeing as I don't really understand how the makefile is structured I'm not going to tackle that right away
but I'm pretty sure I can figure it out from here, thanks for the help <3 @lihaoyi
Peter Aaser
One thing that would help, is there a way to "print" what a subproccess is set up to do?
  val cflags = "PORT_CFLAGS=\"-mllvm --aptos-placement=fluid -mllvm --aptos-generate-stats-file -O3 -mllvm --aptos-cp-window-size=20\""
  val make = s"make -j8 PORT_DIR=aptos ITERATIONS=1000 $cflags clean compile link".split(' ')
  println(make.mkString(" "))
make -j8 PORT_DIR=aptos ITERATIONS=1000 PORT_CFLAGS="-mllvm --aptos-placement=fluid -mllvm --aptos-generate-stats-file -O3 -mllvm --aptos-cp-window-size=20" clean compile link
which is the exact string I use in the shell
but the result is
make: unrecognized option '--aptos-placement=fluid'
make: unrecognized option '--aptos-generate-stats-file'
make: unrecognized option '--aptos-cp-window-size=20"'
Usage: make [options] [target] ...
now I realize this isn't ammonite specific, I just find it helps to rubberduck and maybe someone else will stumble upon this
Oh, actually that shouldn't come as a suprise since I'm interpolating and then splitting
Li Haoyi
Hi. Is there a way to read a single character from the user, without requiring pressing enter? Like read -n 1 in bash or read -q in zsh?
Siddhant Sanyam
@alexarchambault Thanks for your work on the --class-based mode. I also saw your repo for AmmoniteSpark.
I tried Ammonite (without the --class-based mode and it doesn't work with RDDs which takes lambdas. With --class-based mode it works. So I was wondering, what additional capabilities does AmmoniteSpark enables that aren't possible with vanilla --class-based mode.
2 replies
Naftoli Gugenheim
What's the best CSV library to use in ammonite repl?
Am not a regular Ammonite user, so if these are RTFM let me know.
  1. Is it possible to customize the Ammonite prompt (@) ?
  2. If one has developed a command-line app and it is in a Jar, what is the recommended way to fuse it with ammonite? The idea being that ammonite is like UI for this app (besides the standard ammonite functionality).
I was trying to set up amm for somebody (since it's awesome) but just trying to run the curl, etc command that downloads and starts it, it dumps stack and the terminal kind of goes insane. I suppose it's getting confused and choking the terminal on a bunch of binary crud somehow. Is this something you've seen before?
I moved a jdk over using jar. Maybe I needed to use tar
Simon Parten
@implisci see docs... https://ammonite.io/#Configuration try repl.promt() in your predef
Eitan Adler
I have this code in my application ammonite.Main().run( ) and when I run it I see Compiling (synthetic)/ammonite/predef/ArgsPredef.sc and then it immediately exits
how do I get this to actually drop into a repl?
James Kyle

in my predef.sc, I can use interp.load.cp to load a local jar. However, I can't import and use that jar in the predef.sc itself, only in the repl.

e.g. if I load a jar with classpath, com.safegraph.foo.bar and try to import and use it in predef.sc I get a predef.sc:20: object safegraph is not a member of package com and failed repl startup.

If I load, but not import, I can import and use in the repl

Hello, I'm starting with Ammonite and I'm experimenting the same issue posted in [this] (https://stackoverflow.com/questions/66290176/re-import-a-script-in-ammonite-scala
) stackoverflow question:

import $exec.experiment
hello() //Works
//change script experiment
import $exec.experiment
hello() //fails

it fails with the error:

java.lang.NoClassDefFoundError: ammonite/$sess/experiment$
java.lang.ClassNotFoundException: ammonite.$sess.experiment$
Grégory Weinbach
Is It possible to use most Ammonite features but customize read/eval/print loop (REPL ;-) ) to use an internal DSL ? An example would be welcome :-)
1 reply
Li Haoyi
you can pass in variable bindings to .run, and you can set custom imports in your predef
that should be enough to get the values and methods you want into your REPL
Grégory Weinbach
Thanks for your quick answer.
I actually managed to import the DSL through custom imports but I don't understand how variable bindings will help me change the evalpart (I understand this is the what is under responsibility of the Repl#action()method).
has anybody been able to successfully use a import $plugin.$ivy... statement (such as importing kind-projector) from within a myfilename.worksheet.sc file in VS code?
it works fine in the ammonite REPL itself, but in the worksheet it seems to not be able to fine $plugin so VS Code must be doing something special/non-standard I suppose
Tobias Roeser
In mill we use currently ammonite 2.3.8-4-88785969. Simple forward upgrades didn't succeed because of refactoring in ammonite. Is there any documentation about these changes or can you provide a guide how to migrate?
Alex Fox Gill
hey, how do i insert a tab character in the repl? pressing the tab key just prompts autocomplete
1 reply
Li Haoyi
@lefou @alexarchambault did the refactoring. Mill integrates with Ammonite more deeply than most things, so we'll probably have to dig through the code. It's probably mostly renamings...
3 replies
Tobias Roeser
Any plans to support Scala 2.13.5 ?
I would like to embed an Ammonite REPL inside a Scala/Swing application. (Two text areas, one for output, one for input). Is there sample/example code for doing this?
Daniel Schoepe

I'm trying to add ammonite as a dependency to an SBT project by adding libraryDependencies += "com.lihaoyi" % "ammonite" % "2.3.8" cross CrossVersion.full but I'm getting the following error on sbt compile (using sbt 1.4.7 and Scala 2.12.13):

[info] Updating 
[info] Resolved  dependencies
[warn]  Note: Unresolved dependencies path:
[error] stack trace is suppressed; run last update for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.lihaoyi:ammonite_2.12.13:2.3.8
[error]   Not found
[error]   Not found
[error]   not found: /Users/schoeped/.ivy2/localcom.lihaoyi/ammonite_2.12.13/2.3.8/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/lihaoyi/ammonite_2.12.13/2.3.8/ammonite_2.12.13-2.3.8.pom

Did anyone else ever run into a similar issue?

@dschoepe : I thought it was % for Java packages and %% for Scala packages -- does this matter for Ammonite ?
1 reply
Tobias Roeser
Have you checked that ammonite is published for Scala 2.12.13 ?
Doesn't look like
2.12.9 and 2.13.4 are the latest supported scala 2.x versions
Daniel Schoepe
@lefou Thanks, I indeed hadn't checked that. I assumed 2.12.13 was supported based on the version matrix on mvnrepository: https://mvnrepository.com/artifact/com.lihaoyi/ammonite
Tobias Roeser
@dschoepe The latest snapshot release is available for Scala 2.12.13: 2.3.8-36-1cce53f3

Hello: There are some problems with documentation after switching to com_lihaoyi. Here is what I've found:

on github readme of particular projects:
Ammonite -> there is lot of links to https://lihaoyi.github.io/Ammonite -> (404) //should be?: https://com-lihaoyi.github.io/ or directly https://ammonite.io/
fansi -> wrong redirection to scaladocs (0.2.0) and wrong link to ammonite (same as above)
utest -> there is 1 link that does not work 'Fansi'
sourcecode -> wrong (very old?) link to PPrint (https://www.lihaoyi.com/upickle-pprint/pprint) FastParse (http://lihaoyi.github.io/fastparse/) and Scalatags (http://lihaoyi.github.io/scalatags/#CSSStylesheets)
cask -> link to documentation does not work (https://www.lihaoyi.com/cask/)
requests-scala -> all links in sentence "such as ujson.Values, uPickle's upickle.default.writable values, or Scalatags's Tags" are dead (https://www.lihaoyi.com/upickle, https://www.lihaoyi.com/scalatags/) and other references to uJson

Those seams to works:
upickle, acyclic, FastParse, scalatags

Tobias Roeser
There is already a PR fixing some of the links in documentation.
Dominik Dorn
Hi! Is anyone here? I'm having trouble running a very simple ammonite script that uses zio, hope someone has a clue?
import $ivy.`dev.zio::zio:1.0.4`
import zio._

val program = for {
  _ <- zio.console.putStrLn("starting zio program")
} yield ()

println("should run program now")
zio.Runtime.default.unsafeRun(program.provideLayer(zio.ZEnv.live)) // here it just blocks and does nothing!
println("should have run program now")
Anton Sviridov
First thing I'd suggest to try is putting the unsafeRun part into an Ammonite's @main method, instead of script's body.
I often encounter this problem with things like CE/fs2.
Dominik Dorn
this seems to do the trick, thanks!
Dominik Dorn
hmm.. is it known that the links in the docs to upickle are dead/wrong ?
oh, @scalway just posted the same.