Laythe-lang / Laythe

A gradually typed language originally based on the crafting interpreters series
MIT License
65 stars 4 forks source link

Shorthand for .iter() and .into(<Class>.collect) #76

Open jonnyboyC opened 2 years ago

jonnyboyC commented 2 years ago

Problem

While working on advent of code 2021 I've noticed there is a quite a bit of boilerplate with both .iter() and .into(<Class>.collect). Essentially converting a container too and from an iterator. I'd like to consider add some sort of sugar make this explicit still but shorter.

let a = [1,2, 3]$.map(|x| x).toList()
jonnyboyC commented 2 years ago

I currently have implemented .list() and .tuple(). I should probably a .hash() method.