I have an idea for manipulation of lists. Criticism is appreciated

I would add one symbol '@' that "unravels" a list into it's contents in order to manipulate it as if it was a single instance

numbers = [1, 2, 3]
@doubled = @numbers * 2
doubled = [2, 4, 6]

So this allows mapping. Filtering can also be done similarly by taking advantage of the logical aspect

numbers = [-1, 0, 1, 2, 3]
@result = :[
r = n * 2
n > 0
]~[n = @numbers].r
result = [2, 4, 6]

@kyle I like the symbol choice... rolling up the at symbol is fun to imagine

@whtrbt thanks haha, that was pretty much the sole motivation for using that symbol, it looks like a loop

@kyle my feedback is you should just provide a map function and a lightweight lambda syntax so that people can read it :\
You've got to have those functions. They're important.

doubled = map(numbers (n)-> n*2)

Sometimes I see
doubled = map(numbers _*2)

(the underscore makes the expression its part of into a function that takes one parameter... I don't know how it decides how much of the expression it's inside it encompasses, though. It's a bit of a screwy gimmick I guess)

@faun thanks for the suggestions. I agree it's probably a lost cause to go for the unwrap syntax. I don't think there's much I can do to get away from a function syntax, I'm better off embrace ing it

This project was burning me out because I had way too many far out ideas that weren't entirely based in reality. It was fun while it it lasted though

@kyle I wonder how many of my programming languages are still impractical. I can imagine jonathan blow chiding me.
"If you need a language server to infer things, and dialogue with you, and give you realtime analysis feedback, maybe you're just not a very good programmer"

"What, your compiler takes more than a second to build your game? That means you're programming it wrong."

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.