uiua-lang / uiua

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

any way to combine two lines of codes with some separator? #62

Closed goyalyashpal closed 10 months ago

goyalyashpal commented 10 months ago

hi! thanks for such a wonderful language & project

# Sharing in names as the symbols may change
intd = flip dip mod floor divide over over  # intd ← ∶ →◿ ⌊÷ ,,
div = max * +1 range                        # div ← ↥ × +1 ⇡

# TESTS
intd2 +1 range6                             # intd2 +1 ⇡6   # [0 1 1 2 2 3] [1 0 1 0 1 0]
div 6                                       # div 6         # [1 1 3 2 5 3]

I was thinking something like any of these:

(div 6) (intd2 +1 ⇡6) # [1 1 3 2 5 3]
div 6; intd2 +1 ⇡6 # [1 1 3 2 5 3]

so, like here,

and: the rest others here can be commented out or even deleted as they are all same, but this outlier has to be there

a screenshot took midway during cleanup of brainstorming done on the smartphone

kaikalii commented 10 months ago

Sorry, it is unclear to me what you are asking. Is the code behaving in a way that is unexpected? Is there some way you would like to organize your code that you cannot?

goyalyashpal commented 10 months ago

Is the code behaving in a way that is unexpected?

y-s, cod- is working fin-; no probl-m with cod-

Is there some way you would like to organize your code that you cannot?

yep

so, in c for example, if you hav- two lin-s of cod- and you want to mak- th-m on sam- lin-, it's no issu- as -v-ry lin- -nds with a s-micolon.

i was looking for som-thing similar so that i can m-rg- two lin-s of uiua cod- just pr-s-ntation wis- without alt-ring th-ir functionality

(k-yboard's '-' k-y is not functioning prop-rly, so, i hav- add-d dash-s th-r- ; hop- it's not too annoying)

kaikalii commented 10 months ago

Can't you just put them on the same line?

intd ← ∶ →◿ ⌊÷ ,,
div ← ↥ × +1 ⇡

intd 2 +1 ⇡6
div 6

div 6 intd 2 +1 ⇡6

Output:

[1 1 3 2 5 3]
[1 1 3 2 5 3]
goyalyashpal commented 10 months ago

i tried last time - but it showed error; it's working fine now

might be due to smth else which i conflated with merging lines 😵😵