JCumin/Brachylog

Subscripts for h and t

Closed this issue · 5 comments

h and t should have subscripts such that e.g. h₃ are the first 3 elements of its input, and t₆ are the last 6 elements of its input (similar behavior to those of b and k).

The behaviours are not similar, since h returns a number while h₃ would return an array. What should h₁ return?

@kckennylau h₃ on 12345 would yield 123, so still a number. Just like h₃ on "12345" would yield "123" and on [1,2,3,4,5] we would get [1,2,3].

h₁ would work just like h, that is the default subscript for h is 1.

I mean, h on [1,2,3,4,5] would return 1 instead of [1], right?

@kckennylau Right. So maybe h would give 1 and h₁ would give [1].

After more than 2 years, I finally implemented it in this commit. @kckennylau Patience!