aboutsummaryrefslogtreecommitdiff
path: root/packages.lisp
AgeCommit message (Collapse)Author
2025-02-14Deck and joker constructorAryadev Chavali
Joker constructor takes a rank for uniqueness - rank doesn't really change anything in terms of the "power" of a joker but helps with ensuring jokers are unique in a deck. Deck constructor takes an optional argument for the number of decks. A deck includes two jokers, so n decks include 2n jokers.
2025-02-14Some serialisers to make pretty outputsAryadev Chavali
I can now use this package for a console application since we can pretty print cards.
2025-02-14Implement comparator functions for ranks, suits and cards.Aryadev Chavali
2025-02-14Implement some simple converters for custom types to/from integersAryadev Chavali
Given n in 0..51, certainly there exists r, s s.t. `n = 13s + r` where r in 0..12 and s in 0..3. `r` is the rank, and `s` is the suit. ranks are ordered Ace, 2, 3, ..., Queen, King and suits are ordered Diamond, Club, Heart, Spade. Therefore there is a 1-1 correspondence between 0..51 and any card in the deck. Jokers are a bit less straightforward; for now I'll define them as an outlier which doesn't exist in the same bounds (which is why they're the default return for suit in int->suit). Likely I'll go for -1 representing a Joker.
2025-02-14Add a package for modelling cardsAryadev Chavali
Time to do the fun non-yakshaving part. I'll start out by writing some custom types for the objects of concern: ranks, suits, cards and sets of cards.
2025-02-14Rewrote --> to take a placeholder symbol as first argumentAryadev Chavali
Instead of exporting cantedraw.lib.macro._ and making anyone who wants to use the --> macro _require_ importing that specific symbol, let's just make it so the user has to supply a placeholder name before they do anything. This means each package provides its own placeholder symbol which lowers coupling.
2025-02-14Prefix all packages with `cantedraw`Aryadev Chavali
This is mostly a sanity check in-case anyone else decides to load this system for use in their own package - don't want to conflict with their names.
2025-02-14cantedraw.lisp -> main.lispAryadev Chavali
2025-02-11odraw -> cantedrawAryadev Chavali
Why name it something unique when this is what I'm going to be making at the end of it all? Just makes it more confusing for the end user.
2025-02-11main -> odrawAryadev Chavali
2025-02-11Import lib.functions in mainAryadev Chavali
2025-02-11rev-map functionAryadev Chavali
Given an indicator function (A->B) and a list of items of A, return an association list associating B to the elements that map to it; essentially the inverse map of the indicator.
2025-02-11Macro (alist-val) to access the actual value of a key in an alistAryadev Chavali
2025-02-11Implement `split` function.Aryadev Chavali
Given a list and index into that list, return a cons where the car is all elements up to that index (exclusive) and the cdr is the rest of the list.
2025-02-11Implement a "take" function to read subsequences of a listAryadev Chavali
Basically a wrapper over subseq but for when using `->>` as the list is the last parameter.
2025-02-11Implement `$` operator, second class version of the applicative operatorAryadev Chavali
The `$` operator takes a sequence of FORMS and returns a unary function which applies the input through that sequence via the `->>` operator. For example, consider the predicate "not null". `null` is built into Common Lisp but "not null" requires writing a function (lambda (x) (not (null x))). Now, using this operator, you can write ($ not null) which returns the same lambda as above while being more concise.
2025-02-11Introduce lib.functions which includes helper functionsAryadev Chavali
Splitting macros and functions into different packages and source code makes it easier to look at. Functions currently implemented: - range: like Python's range - parse-integer*: parse-integer but junk-allowed is set to t.
2025-02-11Add type alias for function and macro for defining functions with type specifierAryadev Chavali
`fn' is a convenience macro for defining functions with a type specifier. Only really matters for `sbcl` and other hard-optimising Lisp interpreters which actually take these seriously.
2025-02-11Implement a `while' macro.Aryadev Chavali
2025-02-11Implement threading macros and make package lib.macros to hold them.Aryadev Chavali
2025-02-11Initial commit.Aryadev Chavali
Setup boilerplate for system/package management. In particular, setup an entry-point and Shinmera's "deploy" to build executables. Also write some scripts to easily load or build the project without Emacs - just `sbcl --load <x>.lisp`.