Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Length of reverse #8

Open
837951602 opened this issue Aug 13, 2024 · 6 comments
Open

Length of reverse #8

837951602 opened this issue Aug 13, 2024 · 6 comments

Comments

@837951602
Copy link

, \ <list>(db) means len(reverse(<list>)) which can be just len(<list>). Should it be extension?

@darrenks
Copy link
Owner

It could be an extension except that there are already other extensions that start with hex code b, so for example if it were length of chunkby that would be valid. It would be ambiguous which extension to apply.

@837951602
Copy link
Author

837951602 commented Aug 13, 2024

Same applies to reverse(reverse(. Starting with b should be b9(chunk by) and bc(group by) colliding 9(filter) and c(map), so need function that only one make sense for both and db9(count f(i)!=f(i+1)) and dbc(count different f(x)) may be used, so db filter and db map need avoided

@837951602
Copy link
Author

837951602 commented Aug 13, 2024

What about ,* <int> <vec> (len(vec.map(t=>t*int)))? da3 seems no ambigious with type
+ * <int> <vec> shares meaning * <int> + <vec>

@darrenks
Copy link
Owner

Same applies to reverse(reverse(. Starting with b should be b9(chunk by) and bc(group by) colliding 9(filter) and c(map), so need function that only one make sense for both and db9(count f(i)!=f(i+1)) and dbc(count different f(x)) may be used, so db filter and db map need avoided

I'm not sure I follow, are you just saying that reverse reverse would be a possible extension but has the same problem?

What about ,* <int> <vec> (len(vec.map(t=>t*int)))? da3 seems no ambigious with type

I agree that length or reverse of + or * on a list would be a valid extension. I think these are unused because there wasn't much need for more functions of type int <a>, a <a> would be more useful. Although overlapping slices of size n sounds pretty useful and has that type (although maybe a bit too specialized).

It could be good to keep a list of possible extensions along with most desired ops. Here is a list I have in my old notes:

anytime expect a constant (like justify, hashmod, etc) could have it be an overload of something that takes a FN (constant is good since doesn't increment used debruijn indices)

if there is no good fn for something like str,int, just make it be a str function and use hex 1 to specify it. (useful for strip)

available
append append

list available
------------
filter filter
map map
length take n a = min n (length a)
take x drop y = drop y take x
reverse replicate = replicate reverse

diff a reverse b = diff a b
reverse .+ (etc) = .+ reverse
length .+ etc = length
map replicate = replicate map
map step = step map
map take = take map
map drop = drop map
subscript map = ; subscript
length replicate = * length
index replicate = index
replicate .* = .* replicate (but its 3 arg, need to work for other types too then it can be remapped to 2 arg, there's more like this)
rep rep = rep *
diff diff = diff :

num
====
+- = -+
// = */
** = * ... *
same for ++/min/etc

Note that some of those ideas may be invalid / outdated.

I personally will likely not be adding more features to Nibbles. But I welcome contributions from others if you'd like to contribute. Just know that part of the philosophy is to keep things simple, not to fill every possible byte sequence with meaning. So worth discussing new features first before implementing them! I am sure there are some simple powerful ops that I have overlooked.

Also btw if you didn't know about this page already it could be useful for finding extensions: fullref (since the quickref hides some things that are abstracted away as implementation detail)

@837951602
Copy link
Author

I meant e.g. introducing some 3-nibble instructions to mean db x and dbx still mean d bx for specified bx seems worth.

@837951602
Copy link
Author

- + $ @ _ equals + - $ _ @. Not sure if some op(int,int,int) is helpful and if this affect compability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants