uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.59k stars 116 forks source link

copy last n values of stack #136

Closed goyalyashpal closed 1 year ago

goyalyashpal commented 1 year ago

Examples: coming soon

kaikalii commented 1 year ago

Parametric stack copying is not something I'd like to encourage. If you want to copy stack values, you should know exactly how many there are at the time you write your program. I think ,, is a fine idiom. Fork more than 2, fork is adequate.

goyalyashpal commented 1 year ago

Parametric stack copying is not something I'd like to encourage.

yeah, makes sense. so, how about it allow only literal value? similar to how if used to take only 0|1 literal in v0.0.17

I think ,, is a fine idiom.

yep, no prob with it; the issue is that there's no way to do for more than 2

Fork more than 2, fork is adequate.

umh, sorry?

kaikalii commented 1 year ago

But with if, you can pass it a value that is the result of a another computation. No Uiua functions currently require that their arguments are known at compile time.

kaikalii commented 1 year ago

For more than 2.