Open avelino opened 6 years ago
In the lisp way the right is: (zip '(1 2 3) '(4 5 6) '(7 8 9)) ;;=> ((1 4 7) (2 5 8) (3 6 9)) (zip '(1 2 3) '(4 5 6)) ;;=> ((1 4) (2 5) (3 6))
Or can be like Clojure: (zip [1 2 3] [4 5 6] [7 8 9]) ;;=> [[1 4 7] [2 5 8] [3 6 9]] (zip [1 2 3] [4 5 6]) ;;=> [[1 4] [2 5] [3 6]]
That is needed for the language decide when evaluate a parameter as a function call or as an simple data list. In your example: (1 2 3) is an list or the funcion "1" applied on parameters 2 and 3? And how does works an form like (get-data "sample 1" 300) used as an zip function parameter?
Another solution is always use an function as list constructor when an list is needed. Like: (zip (list 1 2 3) (list 4 5 6) (list 7 8 9)) ;;=> ((1 4 7) (2 5 8) (3 6 9)) (zip (list 1 2 3) (list 4 5 6)) ;;=> ((1 4) (2 5) (3 6))
The "list" word/function can be replaced by "array".
About lists, if the first element is not a function or lambda we can assume that it is just a list.
Example:
((1 4 7) (2 5 8) (3 6 9))
it is a list of lists.
(print "test")
it is a function with a parameter
(array (print "test"))
or (list (print "test"))
it is a list, function print
is te element 0 anda the string "test"
is the element 1
'(print "test")
is the same as the previous... although I do not like this version
()
and finally this is an empty list, if used in an if or for is the same as false.
I believe that in this way we leave the use of lists very simple and intuitive.
So it will be impossible to declare one list of functions or lambdas?
We will follow the same run of Go, array serves for both approach (Array and list)
@trumae I do not know if I understood correctly, but to declare an array of functions just put the word "array" at the beginning.
That solution is good. But the (zip (array 1 2) (array 3 4)) is different of avelino's examples. My problem is with the solution using inference to decide between data list or function call.
Regards, Vinicius
2018-02-13 23:20 GMT-02:00 Cesar Gimenes notifications@github.com:
@trumae https://github.com/trumae I do not know if I understood correctly, but to declare an array of functions just put the word "array" at the beginning.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rumlang/rum/issues/127#issuecomment-365463577, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHgFsX_OS7WaNcDvU8PaXwwpIsnrTbWks5tUjTLgaJpZM4SDzfw .
--
/ __ ___ / float e,a,b,c,d;main(i){for(;b<4;b+=.1){for(a=0; /\ \ / /\ \ / /| \/ |/ a<4;a+=.06){c=d=0;for(i=99;--i&&cc+dd<4;)e=cc / \ V / \ V / | |\/| |/ -dd+a-2,d=2cd+b-2,c=e;putchar("X =."[i&3]);} / _/ _/ || ||trumae@gmail.com / puts("");}}
used list
, update description