Closed mathiasverraes closed 9 years ago
Very nice :clap:
These are the main differences between tuples
and lists
as far as I know:
tuples
are fixed-length, lists
are nottuple
can hold values of different types, the values in a list
should all have the same typeCan you elaborate on "lists are just linked pairs"?
just a test, for lists: https://gist.github.com/turanct/e381b0bff7f29a67355c
Can you elaborate on "lists are just linked pairs"?
I see now... list(a, b, c) == tuple(a, tuple(b, tuple(c)))
there's one more problem. list()
is a php language construct, so we can't use list(a, b, c)
notation. what do you suggest?
btw: i'll be adding to this pull request :-) it's in the making
what do you suggest?
- [ ]
lst()
- [ ]
l()
- [ ]
lyst()
- [ ]
ιiςͳ()
I like l()
turns out that changing a datastructure is not as simple as it looks :-)
i'm almost there. status:
@λ_list
l(a, b, c)
is syntactic sugar for pair(a, pair(b, pair(c, @λ_list)));
arrayl([a, b, c])
, so that we can use ...$arguments
in function definitions, and use lambdalicious functions with those arguments by casting them to a listif you want to check my progress, here: https://github.com/turanct/lambdalicious/compare/mathiasverraes:data-is-just-functions...lists-are-just-functions?expand=1
note to self:
islist()
: replace === @λ_list
in there with === l()
, simplify, use lambdalicious code stylearrayl()
with al()
? We can then also have the opposite la()
func_get_args()
with al(func_get_args())
so we have lambdalistjes everywhereEverything is functions now! i just need to clean up some docblocks, i'll do that tonight, then i'll add to this pull request. yay! :rocket:
lambdalistjes are pull requsted! https://github.com/mathiasverraes/lambdalicious/pull/18
@turanct Please add yourself as author to composer.json
Reimplemented
pair()
and friends using nothing but functions. Dropped tuples for now.