Commit Graph

78 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire a4a7d7c8ab
Feature: Insert at (#23)
* niknaks.arrays

- Work-in-progress: Adding an insertAt(T)(T[], size_t, T)` method

* niknaks.arrays

- Work-in-progress: Adding an insertAt(T)(T[], size_t, T)` method

* niknaks.arrays

- Work-in-progress: Adding an insertAt(T)(T[], size_t, T)` method

* niknaks.arrays

- New feature added
2024-05-10 15:31:55 +02:00
Tristan B. Velloza Kildaire 1a754cf7e6
Feature: Generic tree and visitation framework (#17)
* Tree

- WIP

* Tree

- Added initial dfs

* Tree

- By default use the `always` strat

* Tree

- Added a TODO

* Tree

- Added ability to append

Tree (unittests)

- Updated unittests to test appending

* InclusionStratergy

- Now uses the `TreeNode!(T)` instead of the `T` itself

* VisitationTree

- Working on a visitation tree implementation

* Tree

- Pass in, explcitly, the touch startergy

* Tree

- Correct visitation stratergy

* VisitationTree (unittests)

- Added missing assertions

* Tree (unittests)

- Added missing assertions

* Methods

- Added rightward shifting mechanism

* Methods

- Added leftwards shifting mechanism

* TreeNode

- Added removal
- Added indexing support

* Tree

- Reworking opSlicwe

* Tree

- opSlice done

* Tree

- Added normal opSlice as well

* Tree (unittests)

- Updated test for parametwerized opSlice

* Tree

- Added opIndex

* Tree

- Cleaned up
- Removed `getValue()`

Tree (unittests)

- Added test for `removeNode(Tree!(T))`

* Containers

- Added `shiftIntoLeftwards` and `shiftIntoRightwards`

* Containers (unittests)

- Use new methods

* Containers

- Cleaned up

* InclusionStratergy

- Documented

TouchStratergy

- Documented

* Containers

- Documented method

* niknaks.arrays

- Moved here

niknaks.containers

- Moved here

* niknaks.arrays

- Updated unittestesd (test shrinking)
- Added docs

* niknaks.arrays

- Refactored

* niknaks.arrays

- Added this

* VisitationTree

- Documented

* VisitationTree

- Documented

* Tree (unittests)

- Added docs

* Tree (unittests)

- Moved import

* Tree

- Added some docs

* Tree

- CLeaned up

* Tree

- Documented

* Tree

- Documented

* Tree

- Documented
- Cleaned

* Always(T)

- Documented

* Tree

- Added `opDollar()` and `@property`'d `length()`

* Tree

- Adde doc

* Tree

- Renamed `Tree!(T)` to `Graph!(T)`

* Graph

- Typo fix

* Graph

- Clean up

* Graph

- Renamed

* Graph

- Documented helper methods

* Graph

- Typo fix

* graph

-  Documented `dfs(...)`

* Graph

-  Documented `toString()`

* Graph (unittests)

- Added tests for `opIndex(size_t)`

* Graph

- Implemented `getValue()`

Graph (unittests)

- Added tests for `getValue()`

* Graph (unittests)

- Added test for `opDollar()`

* README

- Updated docs
2024-05-04 10:51:31 +02:00
Tristan B. Velloza Kildaire b6106883da ConfigEntry
- Space fix
2024-05-02 08:32:38 +02:00
Tristan B. Velloza Kildaire 29064908e7 niknaks.functional
- Cleaned up
2024-05-02 08:15:00 +02:00
Tristan B. Velloza Kildaire e0e082dd69 niknaks.arrays
- Added uniqueness  method
2024-04-28 15:25:40 +02:00
Tristan B. Velloza Kildaire 3e9bc5341d PromptException
- Removed unused type
2024-04-28 15:01:25 +02:00
Tristan B. Velloza Kildaire e879124f7b Prompter
- Updates
2024-04-28 14:56:40 +02:00
Tristan B. Velloza Kildaire 92b12b1abd Prompter
- Detected EOF signal
2024-04-28 14:52:15 +02:00
Tristan B. Velloza Kildaire 30fc922f5b
Feature: Improved prompting framework (#21)
* Prompt

- Allow multiple values

Prompt (unittest)

- Updated to use the new `Prompt` API

* Prompter

- Added multi-answer and empty support

* Prompter

- Cleaned up

* Prompter

- Various fixes

Prompting (unittests)

- Added unittest for single-val;ues that CANNOT be empty and for multi-value prompts
2024-04-28 14:40:00 +02:00
Tristan B. Velloza Kildaire c7825c5821 niknaks.arrays (unittest)
- Added a unittest
2024-04-27 16:49:57 +02:00
Tristan B. Velloza Kildaire 6b12529ec3
niknaks.arrays (#20)
- Added array stuff
2024-04-27 15:48:39 +02:00
Tristan B. Velloza Kildaire 6e11752590 ConfigType
- Documented enum members
2024-04-27 13:48:41 +02:00
Tristan B. Velloza Kildaire 46eeaa4430 README
- Updated
2024-04-27 13:46:41 +02:00
Tristan B. Velloza Kildaire 0d2742260b
CacheMap (#19)
- Added `opIndex(K)` support

CacheMap (unittests)

- Make use of the newly added `opIndex(K)` support
2024-04-27 13:45:04 +02:00
Tristan B. Velloza Kildaire 72671804a1
Feature: Generic configuration mechanism (#18)
* Config

- Added initial types

* ConfigEntry

- Added `getType()`

* ConfigENtry

- Implemented `opCast(TypeTo)()` for all the types.
- It will ALSO throw a compile-time false assertion if an unsupported to-type `TypeTo` is specified

* ConfigEntry

- Removed a TODO

* Registry

- Added initial registry implementation

* ConfigEntry

- Added ensure-set stuff

Registry

- Added `opIndex(string)`

* ConfigEntry (unittests)

- Test the ensure set stuff

* Registry

- Refatcored `newEntry(..., ..., ...)` to alow for parameterizing over-writing allowance
- Implemented `opIndexAssign`

* Registry

- Toggle set-on-creation (i.e. setting something if it never existed)
- `opIndexAssign` allows setting-on-creation (i.e. creation of an otherwise non-existent node)

* Registry (unittest)

- Try get more coverage by testing certain case

* Registry (unittest)

- Try get more coverage by testing ANOTHER case

* RegistryEntry

- Added

* Registry

- Implemented `getEntries()`

* Registry

- Implemented `opSlice()`

* Registry (unittests)

- Test the `opSlice()` and hence `getEntries()` method
2024-04-27 13:44:12 +02:00
Tristan B. Velloza Kildaire 0e232822fa
Feature: Prompting framework (#16)
* Prompter

- Added

Prompt

- Added

* Prompter

- Fixed source `File` check

Prompter (unittests)

- Added a unittest

* Prompter

- Fixed `prompt()`

Prompter (unittests)

- `flush()` pipe write end

* Prompter (unittests)

- Cleaned up

* Prompter (unittests)

- Cleaned up

* Prompter (unittests)

- Fixed missing import

* Prompter

- Added more docs

* Prompter

- Added more docs

* Prompt

- Documented

* Prompter

- Cleand up

* Prompter (unittests)

- Removed unittest

* README

- Updated
2024-04-15 10:45:16 +02:00
Tristan B. Velloza Kildaire d0ef9bc9cf
Feature: niknaks.mechanisms (#15)
* Mechanisms

- Added `Delay`
- Added tests for `Delay`

* DelayTimeoutException

- Added new exception type

Delay

- Now uses `DelayTimeoutException`

* Delay (unittests)

- Test out function to delegate conversion

* Delay

- Stop and reset internal timer once `go()` goes out of scope
- this allows for re-use

* Delay

- Fixed calling of `stop()` on a non-running `StopWatch`

* Delay

- Fully documented

* Delay (unittests)

- Documented

* Mechanisms

- CLeaned up

* Delay

- Documented
2024-04-08 11:57:04 +02:00
Tristan B. Velloza Kildaire 3545501653 Documentation
- Added authors
2024-04-08 08:40:16 +02:00
Tristan B. Velloza Kildaire df208e10be
niknaks.arrays (#14)
* niknaks.arrays

- Added filtering

* niknaks.arrays

- Use `ref`

* niknaks.arrays

- Documented

* niknaks.arrays

- Use `vewrsion(unittesd)`
2024-03-12 20:50:17 +02:00
Tristan B. Velloza Kildaire 7d7ab493bd Revert "niknaks.debuiging"
This reverts commit 5134bf1750.
2024-03-06 21:18:15 +02:00
Tristan B. Velloza Kildaire 5134bf1750 niknaks.debuiging
- No need for this to be public
2024-03-06 21:15:41 +02:00
Tristan B. Velloza Kildaire 125c9bfd07 niknaks.debugging
- Try this rather
2024-03-05 20:31:43 +02:00
Tristan B. Velloza Kildaire 6bd9e0cbe9 niknaks.debugging
- Fixed import
2024-03-05 20:09:24 +02:00
Tristan B. Velloza Kildaire 156a9e1cad niknaks.debugging
- We must add an import.
- The mixin dumps parameter-filled code verbatim and hence the scope is not the same as you would think. Everything we need must be present.
2024-03-05 20:08:23 +02:00
Tristan B. Velloza Kildaire acfc94aeb0 niknaks.debugging
- We must add an import.
- The mixin dumps parameter-filled code verbatim and hence the scope is not the same as you would think. Everything we need must be present.
2024-03-05 20:06:46 +02:00
Tristan B. Velloza Kildaire 90e52b042b niknaks.debugging
- Made `FuncDebugBase` mixin template public
2024-03-05 20:02:54 +02:00
Tristan B. Velloza Kildaire 17dd5c65c2
Feature: Function debugging (#13)
* niknaks.debugging

- Initial features

* niknaks.debugging

- Removed methods `outt(string msg)` and `outtBad()`

* niknaks.debugging

- Support both `delegate` and `function`-based writers

* niknaks.debugging (unittests)

- We now test out the `FuncDebugBase`

* niknaks.debugging

- Removed unneeeded imports
- Removed zero-arity `FuncDebug` mixin template

* README

- Updated

* niknaks.debugging

- Documented `writerButStringOnly(string msg)`

* niknaks.debugging

- Cleaned up imports

* niknaks.debugging

- Not sure that is needed

* niknaks.debugging (unittests)

- Updated unittests
- Added documentation to unittests
2024-03-02 11:25:46 +02:00
Tristan B. Velloza Kildaire 98a7e3681c README
- Added information about the `niknaks.containers` module
2023-12-04 10:46:16 +02:00
Tristan B. Velloza Kildaire bdcbb1b55b
Feature: CacheMap (#11)
* Containers

- Created module

* ExpirationStrategy

- Added new enum with members `LIVE` and `ON_ACCESS`

* Entry

- Added entry

* CacheMap

- Added initial implementation

CacheMap (unitests)

- Added a unittest

* CacheList

- Added a stub `CacheList` container type

* CacheMap

- Implement the static ifdefs to set
- Use the hitcount method

* CacheMap

- Disbale hitcount for now

* CacheMap

- Added `ReplacementFunction`

* CacheMap

- Implemented `updateKey(K key)`

* CacheMap

- Implemented `expirationCheck(K key)`

* CacheMao

- Updated `get(K key)` to use the new `K` key-based exipiration check

* CacheMap

- The method `updateKey(K key)` now returns the value refreshed
- `get(K key)` now refrehses on unfound key

* CacheMap

- Implemented `makeKey(K key)`
- Busy reworking, still broken

* CacheMap

- Fixed errors with compilation in `makeKey(K key)`

* CacheMap

- Fixed `expirationCheck(K key)` by using `makeKey(K key)` whenever the key does not yet exist

* CacheMap (unittests)

- Fixed unit test

* CacheMap

- Removed `put(K, V)` method

* CacheMap

- Removed traversal version `expirationCheck()`

* CacheMap

- Force compilation failure when `get()` is called for LIVE strat
- Added proper `~this()` implementation for LIVE strat

* CacheMap

- Documented methods

* CacheMap

- Updated `get(K)`

* CacheMap

- Either a function or delegate may now be used

* CacheMap

- Removed nop

* CacheMap

- Always use a thread that wakes up at expirary time to clean up
- Added destructor (that won't seg) as it wits for the cleanup to happen then exits (allowing destruction AFTER the fact)

* CacheMap

- Added some documentation

* CacheMap

- Cleaned up

* CacheList

- Removed `CacheList`

* Containers

- Moved inside of unittest

* Containers (unittest)

- Documented
- Removed unused unittest

* ExpirationStrategy

- Removed this enum

* Entry

- Documented

* CacheMap

- Documented `get(Key)`

* CacheMap

- Documented `checkerFunc()`

* CacheMap

- Documented `doLiveCheck()` and `~this()`

* niknaks.containers

- Documented module

* niknaks (package)

- Added import

* CacheMap

- Implemented `removeKey(K key)`

* CacheMap

- Documented `removeKey(K)`

* CacheMap (unittest)

- Explcitiyl set time

* CacheMap (unittest)

- Added a test ofkey removal (explicit)

* CacheMap (unittest)

- Destroy map

* CacheMap (unittest)

- Added missing documentation

* CacheMap (unittest)

- Removed old code

* CacheMap (unittests)

- Cleaned up

* CacheMap

- Fixed the constructor which takes in a `ReplacementFunction` to pass in the default arguments as well
- The `checkerFunc` now uses the `sweepInterval`
- Added support for a `sweepInterval` which the checker runs at now (seperate to the `expirationTime`)

CacheMap (unittest)

- Documented more unittests
- Added a unit test for on-access stratergy testing

* niknaks.containers

- Cleaned up imports
2023-12-04 10:44:45 +02:00
Tristan B. Velloza Kildaire e9198ad03c
Array dumping updates (#10)
* niknaks.debugging

- `dumpArray` will not expand strings anymore

* niknaks.debugging

- Working prototype (potentially) for a fix

* niknaks.debugging

- Updated the unittests to use the new version

* niknaks.debugging

- Added missing docs

* niknaks.debugging

- Made this method internal

* niknas.debugging

- Renamed `dumpArray2` to `dumpArray`
- Removed old `dumpArray_internal(T)(T[] array)`

* niknaks.debugging

- Documented

* niknaks.debugging

- Moved unittest

* niknaks.debugging

- Moved unittests near template (all of them) to allow for them to appear in documentation

* niknaks.debugging

- Remove pragmas
- Documented internals

* niknaks.debugging

- Rmeoved
2023-11-03 14:07:52 +02:00
Tristan B. Velloza Kildaire 20a8510993 niknaks.debugging
- Moved import here
2023-11-03 14:05:02 +02:00
Tristan B. Velloza Kildaire 85919dce7e niknaks.debugging
- Documented `genTabs(size_t count)`
2023-11-03 14:03:35 +02:00
Tristan B. Velloza Kildaire 2fc4eb4a7b niknaks.debuggng
- Added unitttest for `genX(size_t count, string pattern)`
2023-11-03 14:02:53 +02:00
Tristan B. Velloza Kildaire 52dc41ae71
niknaks.debugging (#9)
* niknaks.debugging

- Added initial `dumpArray(T)(T[])` and `dumpArray(T)(T[], size_t, size_t)`
- Added a unit test

* niknaks.debugging

- Added `isWriteStrat(alias T)(T)`

* niknaks.debugging

- Updated unit tests to test all variations

* niknaks.debugging

- Added `genTabs(ubyte count)`
- Working on making `dumpArray` support compile-time recursion on the array types to generate the correct functions nedded for arrays-of-arrays-of-arrays-of yadada you get it

* niknaks.debugging

- `genTabls(size_t)` now takes in `size_t` instead of `ubyte`
- `depth` is now `size_t`
- Increment the depth argument by 1 prior to call
- Add tabbing for call to indent when array of arrays
- Added unit tests for recursive meta programming code generation

* niknaks.debugging

- Indent only when the `depth` is non-zero for both array of arrays case entry and singular array case entry

* niknaks.debugging

- Documented unittests

* niknaks.debugging

- Documented `genTabs(size_t count)`

* niknaks.debugging

- Added `genX(size_t count, string pattern)`
- `genTabs(size_t)` now uses `genX(size_t, string)`

* niknaks.debugging

- Documented last few methods

* niknaks.debugging

- Neatened up

* niknaks.debugging

- Now returns a `string`

* niknaks.debugging

- Don't use `writeln`, use `write` for unit tests
- Cleaned up imports

* niknaks.debugging

- Removed dead and old code
- Cleaned up unused imports

* Package

- Added missing import

* niknaks.debugging

- CHanged module comment

* README

- Added information about the `niknaks.debugging` module
2023-10-30 20:11:29 +02:00
Tristan B. Velloza Kildaire a0e6f93743 niknaks.functional
- Documented internal function
2023-10-15 16:45:24 +02:00
Tristan B. Velloza Kildaire a21968c3b8 niknaks.functional
- Made `predicateParameterType` private
- Made `params` private
2023-10-15 16:42:32 +02:00
Tristan B. Velloza Kildaire df3d30ac02 niknaks.functional
- Try make `del` private
2023-10-15 16:40:23 +02:00
Tristan B. Velloza Kildaire b25834a323
(PR) Predicates with delegate support (#6)
* niknaks.functional

- This is eh, I should just use `std.functional.toDelegate`

* niknaks.functional

- Updated template `Predicate!(T)` to now refer to `bool delegate(T)`
- Added template function `predicateOf(alias f)` where the alias is the function's symbol name. It can be either delegate or functin but must be callkable, then we convert a fucntion to a delegate if need be

* niknaks.functional

- Don't allow any callable, ONLY delegates or functions as the referred-to entity of the alias/symbol

* niknaks.function

- Added some documentation

* niknaks.functional

- `predicateOf!(alias)` now ensurs that the delegate or function has a return type of bool and that it has a single arity

* niknaks.functional

- Removed commented-out old code

* niknaks.functional

- Added missing `isDelegate` import
- Updated unittests

* niknaks.functional

- Remove testing code for a unit test
2023-10-15 16:37:48 +02:00
Tristan B. Velloza Kildaire ee460fcef0
Improved findNextFree (#8)
* niknaks.arrays

- Added a new implementation of `findNextFree!(T)(T[], ref T)` which now returns a boolean and ref's the found value
- Fixes a bug whereby infite loop COULD occur
- The new function is also `@nogc`

* niknaks.arrays

- Added a unittest to test out the new method

* niknaks.arrays

- Removed now-completed TODO

* niknaks.arrays

- Cleaned up comments for unit tests
- Added missing unit test comments

* niknaks.arrays

- Fixed unittest to be nicer

* niknaks.arrays

- Fixed unittest to be nicer

* niknaks.arrays

- Added a unit test to test a missing case of an empty array
2023-10-15 13:27:44 +02:00
Tristan B. Velloza Kildaire bc11dfa4c7 Pipelines
- Added `sudo apt update` to attempt to fix issue with Ubuntu container image
2023-10-15 13:19:18 +02:00
Tristan B. Velloza Kildaire f3fa6d2176
Bits: Add fromBytes (#7)
* niknaks.bits

- Added `fromBytes`

* niknaks.bits

- Renamed `fromBytes` to `bytesToIntegral`

* niknaks.bits

- `bytesToIntegral` is documented
- `bytesToIntegral` now has a runtime length check

* niknaks.bits

- Dicumented example

* niknaks.-bits

- Added unit test

* niknaks.bits

- Fixed unittest

* niknaks.bits

- Return `T.init` when runtime range check fails

* niknaks.bits

- Made `bytesToIntegral(T)(ubyte[] bytes)` not use any stack space

* niknaks.bits

- Fixed unittest
2023-10-01 18:44:10 +02:00
Tristan B. Velloza Kildaire 9bf31a4aef Merge branch 'master' of github.com:deavmi/niknaks 2023-10-01 18:00:15 +02:00
Tristan B. Velloza Kildaire 68612f586d Dub
- Updated copyright
2023-10-01 17:59:17 +02:00
Tristan B. Velloza Kildaire d2de82ff8f niknaks.functional
- Documented struct
2023-10-01 12:44:23 +02:00
Tristan B. Velloza Kildaire 978f66097d
Optionals (#1)
* niknaks.functional

- Initial support for optionals added

* README

- Added Optionals to list of supported things in `niknaks.functional`

* niknaks.optional

- Split up positive and negative test cases

* niknaks.functional

- Documented template and the struct within

* niknaks.functional

- Documented template and the struct within

* niknaks.functional

- Documented `OptionalException`

* niknaks.functional

- Cleaned up imports
2023-10-01 12:38:36 +02:00
Tristan B. Velloza Kildaire e3968f2b9c niknaks.arrays
- Added TODO for #4
2023-09-30 20:20:12 +02:00
Tristan B. Velloza Kildaire bb0b63175c niknaks.arrays
- Added another unit test
2023-09-30 20:17:05 +02:00
Tristan B. Velloza Kildaire 3a491d5e50
Merge pull request #3 from deavmi/feature/arrays
Array routines
2023-09-30 20:14:47 +02:00
Tristan B. Velloza Kildaire 7b926e0d2f niknaks.arrays
- Added new unit test
2023-09-30 20:13:45 +02:00
Tristan B. Velloza Kildaire 1283dc2ab9 Merge branch 'master' into feature/arrays 2023-09-30 19:41:21 +02:00