Giter Club home page Giter Club logo

advent-of-cljc's Introduction

Advent of CLJC

CircleCI

Cross platform Clojure Advent of Code solutions.

scores

Contribute

What's in it for you?

  • Most of all, you will be encouraged to write portable Clojure code: a solution that runs on the JVM via Clojure and on Node via ClojureScript.
  • Your Advent of Code solutions will be checked against the same input as others. This diminishes the possibility that your solution only works for your specific input.
  • The performance of your solution can be compared with others via CircleCI (see Scores).

What's in it for the Clojure community?

  • You are helping advance the speculative project, a collection of core specs.
  • You are helping to build a large Clojure corpus for various purposes (see the Rationale for coal-mine).

PRs welcome. Make a new solution file with the new script:

script/new 2017 1 username

where username is your Github or Bitbucket username. Then fill in the solution in the file. If the input and answers are still empty you will have to provide it in data.cljc.

This repo will not accept multiple inputs and answers (see this issue for details).

Dev

Read here how to get an nREPL for this project.

Tests

Make sure the tests for your solution pass with the test-one script.

Please do not run calculations outside the tests. Memoized functions are permitted. Top-level lazy sequences are fine as long as they are not realized outside the tests.

CircleCI runs tests for changed namespaces with the .circle/test-diff script.

Tests support the following metadata:

  • :skip-cljs: used for skipping Node tests. Used in .circle/test-diff, script/test and script/test-one.
  • :skip: used for skipping tests in script/test.

Run all tests:

script/test

Run one test:

script/test-one 2017 1 username

Run with instrumentation:

INSTRUMENT=true script/test
INSTRUMENT=true script/test-one aoc.y2017.d01.username

Skip Clojure or ClojureScript:

SKIP_CLJ=true script/test
SKIP_CLJS=true script/test

Scores

To view a time comparison of your solutions to others, go to CircleCI, open "Test changed namespaces" and scroll to the end.

The entire list of scores can be viewed and downloaded in CSV format here.

advent-of-cljc's People

Contributors

adamruzicka avatar akmiller78 avatar bgrabow avatar borkdude avatar clashthebunny avatar dandorman avatar dfornika avatar dfuenzalida avatar ericstewart avatar genmeblog avatar gklijs avatar iamdrowsy avatar jreighley avatar leourbina avatar mfikes avatar mrmcc3 avatar namenu avatar orestis avatar transducer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

advent-of-cljc's Issues

Please don't create a database of inputs (and other issues)

I'm the creator of Advent of Code. A system similar to this one was recently proposed on Reddit; it makes me nervous for a few reasons which I listed in a reply:

https://www.reddit.com/r/adventofcode/comments/9yylms/advent_of_code_where_submitted_code_is_tested_on/ea5ck28/?context=3

Please don't create a database of inputs. Doing this would make it easy for someone to rip and re-host my work.

Doing a beauty contest, size comparison, etc don't require a common runtime; you can already compare the code of many solutions on the megathreads or even GitHub.

Some puzzles (intentionally) use a lot of CPU or memory, which could make hosting this service expensive.

Without having a human check the submitted source code, there's not a good way to verify that the program doesn't simply print the answer and immediately exit.

Do not duplicate the puzzle descriptions on such a site. Doing so could remove adventofcode.com entirely from users' workflows and effectively steal my work and use it to also steal my traffic. (In fact, I'm already nervous about this even without duplicating puzzle descriptions.)

Basically: I spend hundreds and hundreds of hours building this stuff. Please be careful not to ruin it.

Accumulation of memory usage in tests

Most namespaces use lazy seq and delays or memoized functions at the top level. This accumulates used memory and eventually causes problems for the later tests.

One approach to solve this could be: delete the namespace after the last test using a global fixture.

Port bash scripts to tools.deps main scripts.

@mfikes said:

An aside on the script topic: Previously coal-mine used bash scripts. At some point I converted it to simply use Clojure that is in the source tree (the coal-mine.script namespace). For me this had two benefits:

  1. I actually found it easier to deal with logic in the "script" when written instead in Clojure
  2. This made it so that you can run coal-mine as a GitDep. In other words, there is no need to even manually clone it. (This capability is, for example, used in speculative.)

This, and this commit to Tubular by David mfikes/tubular@e8b5691
really solidified my thinking that having a -main for logic in a codebase, driven by deps aliases, is really a great way to arrange things.

I think that's a good idea!

Can't define protocols in test namespaces

If you run

script/test-one 2017 1 borkdude

everything will be fine. But then add the following

(defprotocol IFoo)

as the first form in the aoc.y2017.d01.borkdude namespace (after the ns form).

This will result in

WARNING - incomplete alias created for namespace aoc.y2017.d01.borkdude

where otherwise everything else works.

In the end, this is likely going to be an issue in the ClojureScript compiler itself (presuming we can come up with a minimal repro), but logging it here as it may be occuring due to some arrangement in the Advent of CLJC project.

Run all solutions for committed days in diff

Currently only different namespaces compared to master are tested on CI.
The time comparison compared to others for the same day is now missing.

TODO:

  • discover which days have been committed.
  • run tests for all of these days regardless of user

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.