scittle 2022-12-02

@raymcdermott What are the troubles you have with Github pages? There is also an #adventofcode channel where you can share / discuss solutions

๐Ÿ‘๐Ÿผ 1

do you have a CLJ code-formatter for scittle?

@raymcdermott you can just code in a file and then refer to that file from a script tag

I don't understand yet ... I see the page but don't see how to make the page

I have a function like this:

(defn content
  [day#]
  (let [elves (->> @data
                   str/split-lines
                   (map js/parseInt)
                   (partition-by js/isNaN)
                   (keep (fn [xs]
                           (when-not (js/isNaN (first xs))
                             (reduce + xs)))))]
    [:div
     [:a {:href (str "" day#)}
      "Link to AOC Challenge for day " day#]
     [:br]
     [:br]
     [:h3 "Calorie counting for " (count elves) " elves. They each have this many calories..."]
     [elf-table elves]
     [:br]
     [parts elves]]))

And I want a way to show that function, or a part of that function

not the whole file cos that's cluttered with CSS / html elements

ok, you want to show a code sample. Take a look at the scittle README where this is also done

not the readme but the http://github.io docs thing

seems like it the same page ๐Ÿ›ž

This is the page with the docs: https://babashka.org/scittle/ It is not the README.md of the scittle github repo

and those docs show code snippets, which is what you were asking about

I'm probably asking it wrong but I don't how that page is made so that it shows the text snippets. I want to make the snippets available dynamically not hard-coded.

@raymcdermott you can just look at the source of this page. there is no build process, view source shows it like it was done. I did hardcode the snippets I wanted to show, but I think you could make that dynamic. I see your need for a formatter here. I also have a playground that I pre-populated with some code - again, no build process, everything is loaded directly from jsdeliver / npm https://babashka.org/scittle/codemirror.html

ok - gotcha. Thanks

What are my options if I want to use a library like https://github.com/philoskim/debux? I can either try to build the library and put js files on a cdn or try and fetch the clj source from github and eval it. Have you done anything like that yet?

@rgkirch I think it's likely you'll bump into some incompatibility if you load it from source (I see cljs.analyzer.api is used for example), but you might be able to simplify this lib to evaluate it with scittle directly. If you're going to include as a compiled lib, you have the challenge that this library consists of macros and those macros have to exist at run time in SCI - which basically means copying them as regular functions (see sci.configs for promesa for example).

Thanks. It looks like nothing in debux would work without changes. The other library that I always reach for is meander. I think Iโ€™ll start by cloning it into my project, reference it from script tags, and find out if itโ€™s incompatible. I guess Iโ€™d have to have a script tag for each source file. And order probably matters. That sounds like a pain. You havenโ€™t done anything in that direction yet?

That's how it currently works. meander does work with babashka, but I'd be surprised if it currently worked with scittle. I haven't tried it in #nbb. It's easier to try it out with that, by adding the lib to nbb.edn and then requiring it

Ok, thanks for that advice!

still trying to get GH pages working (some screwed up custom domain troubles)

a work in progress with ideas welcome

It demonstrates multiple CLJS source files and fetch

also that the javascript variants of parse-long are not as nice ๐Ÿ™‚

so it would be nice to have those here ๐Ÿ™๐Ÿผ

some ideas: I want to highlight the "winning" numbers when revealing the answers. I could also make the table a bit more snazzy.

Advent of Code in Scittle, amazing @raymcdermott !

Feel free to make issues / PRs for missing stuff, I will support this effort by making more frequent releases for AoC :)

๐Ÿ‘๐Ÿผ 1