James Shubin
97c7d176f0
lang: funcs: Use constants for arg names
2023-06-29 14:59:05 -04:00
James Shubin
f966b1ae6a
lang: funcs: simplepoly: Fix copy pasta error
...
Print the actual result.
2023-06-27 18:49:00 -04:00
James Shubin
8bc08d7716
lang: unification: Add a test for different func arg names
...
It's important that during unification that function types can unify
even if their arg names are different. (Their actual unnamed types must
be identical of course.) This adds a test to make sure we preserve this
behaviour.
2023-06-27 16:37:14 -04:00
James Shubin
ef4c0f961d
lang: unification: Improve simple solver
...
This adds a new interpretation of the EqualityWrapFuncInvariant that can
combine two into one if their Expr1 fields are the same. We might know
different partial aspects of multiple functions. This also includes a
test. The test does not pass before this commit which adds it.
2023-06-27 16:37:14 -04:00
James Shubin
42840827f8
lang: unification: Add bare solver tests
...
This adds some simple test infra to test the solver directly without an
AST.
2023-06-27 16:37:14 -04:00
James Shubin
13b6b9de60
lang: types: Print the full function args
...
This makes it easier to see logs, but more importantly copy (well the
copy hack) doesn't erase arg names anymore.
2023-06-25 12:25:44 -04:00
James Shubin
74a21bab1a
test: Update rule configuration
...
We got a warning about this.
2023-06-25 02:11:01 -04:00
James Shubin
d1c7770949
lang: parser, funcs, core, iter: Rename xmap to map
...
The map function previously existed as "xmap" because this was a
reserved word in the parser. This now adds a special case for this
identifier name.
2023-06-01 18:08:37 -04:00
James Shubin
66edf22ea3
lang: Port TestAstFunc1 to txtar format
2023-06-01 16:56:44 -04:00
James Shubin
8fffd10280
lang: Port TestAstFunc2 to txtar format
...
This ports TestAstFunc2 from our home-grown content storage system to
the txtar package. Since a single file can be used to represent the
entire folder hierarchy, this makes it much easier to see and edit
tests.
2023-06-01 16:56:44 -04:00
James Shubin
446dbde836
util: Add new blocked timer utility
...
This adds a new *BlockedTimer struct which can be used to run a function
or a printf after a short duration. It can be cancelled early. A short
blog post about the topic is available here:
https://purpleidea.com/blog/2023/05/26/blocked-select-logging-in-golang/
2023-05-26 01:19:13 -04:00
James Shubin
ef84a5a76a
test: Rename var
...
Copy pasted from old script.
2023-05-12 12:10:46 -04:00
Kaushal
25a63956f3
test: Add golangci-lint test
2023-05-12 12:07:52 -04:00
Ofek Atar
eddd16283d
engine: util: Add test for StructKindToFieldNameTypeMap function
2023-05-12 14:45:42 +03:00
James Shubin
c5efe7a17b
lang, engine: Remove unneeded error wrapping
...
These situations basically never fail, and if they do, we certainly
don't need more context. This simplifies things a bit.
0.0.23
2023-04-20 18:02:40 -04:00
James Shubin
7075b8b973
pgraph: Add LookupEdge function
...
The new LookupEdge function lets you find which vertices are associated
with a particular edge, if any.
2023-04-20 15:45:46 -04:00
James Shubin
3f5957d30e
docs: readme: Add new talk and clarify README
...
This should make it more obvious how to reach this content as it might
not have been particularly clear to new users where to find this
information.
2023-04-07 11:51:43 -04:00
James Shubin
bc29957d1e
lang: Add a useful debug message to tests
...
When running this test a lot in series, it helps to have more obvious
debug output.
2023-03-31 19:29:52 -04:00
James Shubin
289835039a
lang: Remove SetValue from the engine
...
This removes the calling of SetValue from the engine, and instead
replaces it with the Table() API. The downside is that this is likely
slower, and the current API with locking being exposed publicly is kind
of ugly. The upside is that this might make building the new engine
easier.
Future versions might remove locking from the API if we can avoid making
any accesses to expressions. Currently this happens within Logf/SafeLogf
which is our main (only?) usage at the moment. Logging could become
smarter perhaps. Alternatively, we might pass in a "setter" function
that gets called safely from within the engine. This could wrap SetValue
and the locking functions wouldn't be part of the public API.
2023-03-31 19:29:52 -04:00
James Shubin
b1e08ef231
util: deadline: Add a simple test for deadline and testing
...
This is a simple test/example placeholder if we want to remember how to
run deadlines with contexts for testing.
2023-03-24 16:53:42 -04:00
James Shubin
8a463767bf
lang: funcs: Make printable function names more unique
...
This helps a lot with debugging.
2023-03-24 16:50:01 -04:00
James Shubin
c598e4d289
engine, etcd: Update code for latest gofmt fixes
...
Latest version of golang broken gofmt again...
2023-03-14 16:43:08 -04:00
James Shubin
a7624a2bf9
legal: Happy 2023 everyone...
...
Done with:
ack '2022+' -l | xargs sed -i -e 's/2022+/2023+/g'
Checked manually with:
git add -p
Hello to future James from 2024, and Happy Hacking!
2023-03-05 18:31:52 -05:00
James Shubin
d20fcbd845
lang: Fixup tests that broke
...
I should not have changed the error string when I unified the pgraph
library.
2023-03-03 14:47:30 -05:00
James Shubin
5d664855de
lang: interfaces, funcs: Implement fmt.Stringer for functions
...
This adds the requirement that all function implementations provider a
String() string method so that these can be used as vertices in the
pgraph library. If we eventually move to generics for the pgraph DAG,
then this might not matter, but it's not bad that these have names
either.
2023-03-03 14:12:09 -05:00
James Shubin
8366cf0873
pgraph: Add a named error for detected cycles
...
This makes it useful to find when a topological sort failed.
2023-02-25 23:20:05 -05:00
James Shubin
a41789a746
examples, lang: funcs: core: example: Update vumeter
...
This patch moves to use the sox package instead of arecord for getting
microphone data, and it also validates that both sox and rec and
installed. We also add a standalone example.
2023-02-08 12:14:11 -05:00
James Shubin
cde3251dd8
test: shell: Disable flaky network test
2022-11-11 22:42:29 -05:00
James Shubin
7c394bf735
lang: Move the Edge struct into the interfaces package
...
This makes it consumable from more than one package and avoids future
cycles.
2022-11-11 20:28:22 -05:00
James Shubin
76e0345609
pgraph: Make some functions variadic for consistency
...
This will make it more useful when consuming these functions in a Txn
API which might be more convenient as a big one-liner.
2022-11-11 20:20:14 -05:00
James Shubin
d8820fa185
make: Improve crossbuild docs
2022-10-24 02:38:38 -04:00
James Shubin
b6502693e4
make, golang: Work around new go.mod issues
...
This updates the versions of virtually all our deps. Ever since golang
switched to go.mod we were unable to do so due to blockages with the
retract mechanism that one dep had used. Here's what seems like a
workaround for now. Suggestions from expert welcome.
2022-10-17 19:36:12 -04:00
James Shubin
f7e5402966
make: Remove missing clean target
...
This is no longer present.
2022-09-12 14:27:39 -04:00
James Shubin
1e6a825412
lang: funcs: Add cancel methods in a different way
...
Previously go vet found:
"this return statement may be reached without using the cancel var
defined on line..."
2022-09-12 14:11:25 -04:00
Samuel Gélineau
c23065aacd
lang: funcs: Add SystemFunc
...
Runs a string as a shell command, then produces each line from stdout.
2022-09-11 21:58:39 -04:00
James Shubin
04f5ba67a2
lang: Small build fixes
2022-09-11 21:43:57 -04:00
James Shubin
b87fa6715b
misc: Exclude more directories from ack matching
...
This is almost always what we want.
2022-09-11 20:55:37 -04:00
James Shubin
f6f3298e03
misc: Use go install instead of go get for build binaries
2022-09-11 20:55:37 -04:00
James Shubin
6bfd781947
lang: Replace the go-bindata usage with embed
...
This doesn't let us have nested mcl at the moment, but we could improve
on this with an embed API for each package. For now this makes building
the project easier.
2022-09-11 20:55:37 -04:00
James Shubin
aff6331211
misc, docs: Move to golang 1.18
...
Hopefully this fixes some yucky things.
2022-09-11 20:55:37 -04:00
James Shubin
d547c39a16
misc, docs: Move to golang 1.17
...
There are a few small source fixes and other tidbits to move past 1.16,
but we can do those later.
2022-08-16 19:30:20 -04:00
James Shubin
3cea422365
legal: Happy 2022 everyone...
...
Done with:
ack '2021+' -l | xargs sed -i -e 's/2021+/2022+/g'
Checked manually with:
git add -p
Hello to future James from 2023, and Happy Hacking!
2022-08-05 23:06:27 -04:00
James Shubin
ac39606386
lang: Misc changes from an old feature branch
2022-08-04 14:49:24 -04:00
James Shubin
12ae44d563
lang: funcs: core: fmt: Add important comment to printf
2022-08-04 14:36:56 -04:00
James Shubin
57b37d9005
pgraph: Misc cleanups and additions that I had kicking around
...
These changes had been sitting in a feature branch for a while. Push
them up.
2022-08-04 14:36:56 -04:00
James Shubin
9d5cc07567
lang: funcs: core: iter: Add map iterator function part3
...
This flattens the type unification of the map function so that the
solver has more to work with. It's possible that some scenarios might
solve faster, or without recursion, after this improvement.
2022-08-04 14:24:38 -04:00
James Shubin
75d4d767c6
lang: funcs: core: iter: Add map iterator function part2
...
This adds the Unify method to our map function and also switches the arg
order because I decided it would look nicer. Completely untested.
2022-08-04 14:24:05 -04:00
James Shubin
0be4b86230
lang: funcs: core: iter: Add map iterator function
...
Sadly this doesn't all work yet, but the tests and xmap function are
approximately correct. Eventually we add filter and reduce too!
2022-08-04 14:23:16 -04:00
James Shubin
784d15b012
all: Misc housekeeping for new golang versions
2022-08-04 14:16:33 -04:00
James Shubin
00f6045b12
util: safepath: Add a new Dir method and tests
...
This adds a new helper method. It should be considered for other types
as well.
2022-05-10 23:44:48 -04:00