Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
previously, neither
pair?
norlist?
would return true for this form:so this changes
pair?
to also return true forCons
values (square brackets).admittedly, the naming with list/cons/pair is awfully inconsistent between Go and Bass right now.
in Bass, a
list?
value must be a linked list - aList
whose second value is another List. both Cons and Pair can satisfy this.in Go,
List
is the interface implemented byCons
andPair
, but it doesn't ensure that the second value is a list, so it's not always alist?
.in Bass, a
pair?
value used to be ONLY thePair
type. now it will betrue
ofCons
as well.here's the old truth table:
here's the new truth table:
there is no
cons?
- just as there is nokeyword?
, but there issymbol?
. there may be a good reason to add both in the future, but I'm waiting for it to arrive.an alternative approach here might be to have
Cons
support decoding intoPair
, but that may be the path to darkness.Value.Decode
explicitly calls out that it shouldn't be used for converting betweenValue
types, though I don't remember if that's coming from a footgun or if it's speculative.