by

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
Armin Keyvanloo
@arminio
Any idea why ammonite is published like this? and any nice solutions to this issue?

(btw, I already have the following crappy solution:

val SCALA_VERSION = "2.12.8"
ThisBuild / scalaVersion := SCALA_VERSION
...
"com.lihaoyi" % s"ammonite_$SCALA_VERSION"  % "2.1.4",
....

)

Armin Keyvanloo
@arminio
It seems that the issue was between the chair and the keyboard!
Found this (solution) in the ammonite doco:
"com.lihaoyi" % "ammonite" % "2.1.4" cross CrossVersion.full
Nathaniel Fischer
@kag0
is it possible to import a mill module into an ammonite script?
such that the script could use some sources in the module?
Pavels Sisojevs
@psisoyev

hi, running chain of IO monads with ammonite fails with stackoverflow. eg:
https://gist.github.com/psisoyev/c93a9d3a3778d05912bf8e121a8c8452

is there anything Im doing wrong?

Li Haoyi
@lihaoyi
@/all my book Hands-on Scala Programming is out https://www.handsonscala.com/, which uses Ammonite heavily throughout the book to do cool things. If you like using Ammonite, you should definitely check it out :)
Agam Brahma
@agam

I'm sure I'm missing something here, but ... why would Ammonite be interpreting List as being java.util.List ?

Here's what I'm seeing:

@ List(1,2,3,4)
cmd91.sc:1: class java.util.List is not a value
val res91 = List(1,2,3,4)
            ^
Compilation Failed

and more simply

@ List()
cmd91.sc:1: class java.util.List is not a value
val res91 = List()
            ^
Compilation Failed
Li Haoyi
@lihaoyi
@agam you must have import java.util._ somewhere?
Agam Brahma
@agam
You're right, that must have happened somehow. Restarted the Repl, all good now. Thanks!
acse-fk4517
@acse-fk4517

Hello, I am new to Ammonite and trying to download the following dependency:

The way I attempted to do it was as follows:

  • import $ivy. org.apache:poi:4.1.2

However this does not work, could someone please kindly explain how I can get this depdendency?

Soren
@srnb_gitlab
@acse-fk4517 try org.apache.poi:poi instead of org.apache:poi maybe? I think apache added an extra poi in there for some reason
Ghost
@ghost~5b100290d73408ce4f9b6711
Why does the same code take 50x more time when run as a script from the terminal vs. pasting it in the REPL? Pointers appreciated.
/** testTime.sc
  * Pasting below code into Ammonite REPL takes 0.5 seconds for the 1 to 10M loop in the println
  * Running same code from terminal "$ amm testTime.sc" takes 28 seconds
  * This is more than a 50x difference in run time
 **/
scala.util.Random.setSeed(1234567L)
val bigSet = collection.mutable.Set[Int]().addAll((1 to 10000000).map(_ => scala.util.Random.nextInt))
println(time { (1 to 10000000).filter(bigSet.contains(_)) }._2.toMillis / 1e3)
Ghost
@ghost~5b100290d73408ce4f9b6711
for comparison: This loop takes less than 0.5 seconds on scala REPL (like ammonite REPL), compiled code, or when run as a scala shell script. Outlier is amm script runner.
acse-fk4517
@acse-fk4517
@srnb_gitlab thanks, that did the trick!!
oybek
@oybek
Hello guys!
I'm searching how to send string to ammonite (so it compiles and saves result)
repl is embedded to my program, but sometimes I want to derive implicitly some
classes and automatically add them to repl
3 replies
how can I do this?
Yilin Wei
@yilinwei
@oybek Can't you just send the derivation to the repl?
James Riordan
@jamesosaurus_gitlab
Is it possible to import a .class file from a directory (e.g. it has not been packaged into a jar)?
David Hoyt
@davidhoyt

Is it possible to alter the coursier version conflict management? have a conflict like:

Conflicting dependencies:
io.netty:netty-codec-http2:4.1.43.Final or [4.1.38.Final]

I'd like it to choose 4.1.38.Final but ammonite (or coursier) exits.

sbt v1.3.12 doesn't seem to have the same problem
Simão Martins
@Lasering
Hi!
is there anyway to turn off showing the unicode code point instead of the character?
Welcome to the Ammonite Repl 2.1.4 (Scala 2.13.2 Java 14.0.1)
@ "Simão" 
res0: String = "Sim\u00e3o"
Olivier Mélois
@Baccata
@lihaoyi @alexarchambault : hey guys :wave: , the publishing of artifacts failed on the latest master : https://travis-ci.org/github/lihaoyi/Ammonite/builds/696389945. Any chance these could be retriggered ?
Li Haoyi
@lihaoyi
i clicked the retry button
Olivier Mélois
@Baccata
many thanks :)
Krister Svanlund
@kofish-sl
Hey, is it possible to have an ammonite script terminate with a non-zero exit code?
Krister Svanlund
@kofish-sl
Without having it print a massive spam-stacktrace that is
Damian Reeves
@DamianReeves
Hi, is there some sort of trick to get code-completion working on ivy dependencies either in VS Code or IntelliJ?
Wojtek Pituła
@Krever
Hey, I've hit classpath issue when using os-lib in jupyter. My guess is that is because of embedded os-lib instance. Is there a way to hide it? Or at least check what version comes as embedded?
Damian Reeves
@DamianReeves
Is there a jar that exists on maven that I can use as the startup for ammonite?
Anton Sviridov
@keynmol
@kofish-sl sys.exit(1) should still work in the script
@DamianReeves do you mean the code from dependencies themselves or autocompleting the $ivy.... blocks with actual suggestions from coursier?
Damian Reeves
@DamianReeves
Code from dependencies themselves
Anton Sviridov
@keynmol

Actually just recently ammonite script support in metals got merged and it's quite good.

The kicker is that it's not actually released yet, but you can make VS Code to use Metals' snapshot version: https://scalameta.org/metals/docs/editors/vscode.html#using-latest-metals-snapshot

I have this override in all of my of my projects and overall the support for Ammonite scripts is quite impressive. It takes a few Metals: Restart server to get it to pick up new dependencies, but the experience of editing an individual ammonite script in VS code with IDE features is quite incredible :)
Damian Reeves
@DamianReeves
thanks
Nitay Kufert
@nitayk

Hello, I need some help after I broke ammonite when trying to use https://github.com/mmolimar/kukulcan.
(I had to install java11, reinstall ammonite etc)

The current situation is when I try to launch ammonite I get:

 ~  amm
Loading...
Compiling /Users/nitaykufert/.ammonite/predef.sc
Compiling /Users/nitaykufert/.ammonite/predef.sc #2
predef.sc:11: object PathConvertible is not a member of package ammonite.ops
  import ammonite.ops.PathConvertible._
                      ^
predef.sc:12: not found: value cwd
  val p = ammoniteModules.orElse(scala.sys.env.get("AMMONITE_MODULES").map(s => Path(s))).getOrElse(cwd)
                                                                                                    ^
predef.sc:13: not found: value cwd
  val c = cwd
          ^
Compilation Failed
Olivier Mélois
@Baccata
@nitayk try to replace cwd by os.pwd
also remove the ammonite.ops import and use os.Path instead
Nitay Kufert
@nitayk
Thanks for the response.
I'll try it soon.
I got the predef file both under .ammonite & also in the ammonite-modules (with export AMMONITE_MODULES="/Users/nitaykufert/Supersonic/ammonite-modules";)
I can see the code is different - The error is thrown from .ammonite
Any idea of how I got to this situation?
Olivier Mélois
@Baccata
a quick googling led me to https://github.com/yeghishe/ammonite-modules which I assume is what you're referring to ... a wild guess would be that it ain't up to date with the latest ammonite, can't say for sure
Nitay Kufert
@nitayk
Thanks! for some reason I missed the fact that this is unrelated to the original repo :/
This fixed it for me: curl https://raw.githubusercontent.com/yeghishe/ammonite-modules/master/predef.sc > ~/.ammonite/predef.sc
(I belive your guess was right, as part of my efforts I've updated that repo but didn't override the predef file)
Thanks for the help and sorry for the google-quest, I just missed that in my searches
Oron Port
@soronpo
Hi all. Are you aware that Scala 3 will not support symbol literals (e.g. val target = root/'target/'file will not be possible). Do you have opinion on that? I did not see any discussion on this.
Li Haoyi
@lihaoyi
you can use strings in your path segments
it’s one more character but nbd