-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fun, simple, examples for common scripts and stuff! #5
Comments
“Hands On Scala” (Haoyi's book) is a good source to raid for ideas on this, IMO |
Is this gist of mine a good idea? I felt the urge of being able to do $ echo -e "foo\nbar" | mkString --prefix '{' --suffix '}' --delimiter "~"
{foo~bar} with huge files, so I leveraged fs2 and ScalaNative to overkill the task 😇 |
had a quick go at the virtuslab example for the fun of it: |
Thanks @Koroeskohr! I'll create an examples folder and add it. I have some troubles running it though, I'm getting this 👇 running it with "3.2.2". Is it just me? 🤔
|
Alternatively, let's consider setting up a website with mdoc-checked examples. It will be easier to browse maybe? Edit: and also enables us to add exposition. |
Yep, I was just thinking that having a site might be ideal |
@TonioGela i copied the virtuslab one-for-one that doesn't work either, I can polish it so that it's runnable, probably better |
@TonioGela updated it |
Thanks @Koroeskohr, I'll add it to the site once published :) |
@TonioGela continueing here about the Pokemon example:
I think this is good! I should probably have it's separate page because it'll be a "big" example, but honestly it showcases some cool stuff. |
is this one good enough as an example: lichess-org/scalachess#352 (comment)? This was used to convert a text file in one format to another format. We use the result for testing in scalachess. |
It's short and pleasant, very task focused, and I like it. def raw2Perft(id: Long, raw: String): String =
val list = raw.split(";").zipWithIndex.map {
case (epd, 0) => s"epd ${epd}"
case (s, i) => s"perft $i ${s.split(" ")(1)}"
}
list.mkString(s"id $id\n", "\n", "") If you open a PR to add the example may I ask you to add the Scala 2 version too? :) |
@TonioGela thanks for your feedback and suggestion. I will open a pull request this week (with Scala 2 version ;) of course). |
Sounds fun! I can do it, it sounds good for practising some Scala. Edit: Oh, this API is a bit complex to process. :( |
you might enjoy or be inspired by looking at what we're doing at scalacenter/docs.scala-lang#7 — we're still making adjustments to the texts of the sections, but the table of contents isn't likely to change much further before initial publication |
The most interesting part is that it advertises tests too, and atm we don't showcase any example that contains tests. It may be worth investing time in showing people how fun is to write them with munit-effect 🤔 |
I use scala-cli for testing (with cats-effect) now, but I use weaver not munit-effect 😂 |
I'm 100% down to make an example about unit testing with munit-effect (tho I have more experience with weaver), but I've thought about it for a while now and can't figure out any compelling problem/example that shows it off lol. Maybe something like an EDIT: might also be a cool way to show off |
The famous Pokemon example that I suggested to you some time ago had a bonus point section that asked to reduce the usage of the external APIs caching them. |
The Toolkit section in the Scala documentation has finally landed here. It will be great to port it using the typelevel toolkit creating a whole new section on the site! |
@TonioGela continueing the JSON derived example discussion here, how about:
|
I have few lichess related examples, one is simpler than the other:
But I'm not sure we want to flood our examples with lichess 😂 |
Here's the one posed by Virtus Lab:
Scala Toolkit is getting a bunch of tutorials / examples, we can cheat by copying those and then slapping on a
parTraverse
😝The text was updated successfully, but these errors were encountered: