-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: map, filter, fold, zip and other functional operators #319
Comments
"LiveScript doesn't target APL programmers" :p. |
Just what makes an operator for map inferior to all other operators we have already? |
|
Just again, what's the argument to have operators for things that are barely used such as >? and <?, but not for the most used functions in FP? |
I don't know why @satyr wanted wanted string comparison operators, maybe perl6 has them :p. |
What do you mean with string comparison operators? |
I think having a standard library (prelude.ls) with these features is the way to go. We currently have too many operators, and I'll be removing some of the less used/obscure/redundant ones in the future. |
okay comma that apostrophe s fair period this remembers the quote punctuation quote argument in favor of keeping the quote function quote and quote return quote keywords in javascript period punctuation is important comma for sure semicolon that apostrophe s exactly why i just hope you remember there is a reason we use symbols instead of words for punctuation period parenthesis colon |
@viclib, but ^, <, !can use sigils for ██! Symbols like :>, <>, &> look somewhat random (or at the very least, non-obvious), and are definitely more readable when written using |
Speaking of APL programmers, I propose allowing embedding of APL code in LiveScript:
Even if only to make new LiveScript programmers go even more ⍨ than they did before. |
I could never program in APL, but just for the lulz, APL in ls sounds great! :P |
Yaeh, I'd loove to debug that code! 2015-05-02 16:25 GMT+02:00 J Phani Mahesh [email protected]:
|
Considering how those are recurrent functions in FP, I propose we could have operators for them.
[1 to 5] :> (^2)
=> [1 4 9 16 25][1 to 5] ?> (>3)
=> [4 5][1 to 5] <> (+)
=> 15[1 2 3] &> [4 5]
=> [[1 4] [1 5] [2 4] [2 5] [3 4] [3 5]][dog1, dog2] .> bark!
=> [dog1.bark(), dog2.bark()]This way,
[1 to 5] |> map (^2) |> filter even |> fold (+), 0
becomes
[1 to 5] :> (^2) ?> even <> (+)
strs |> map (.toUpperCase!)
becomes
strs.>toUpperCase!
The text was updated successfully, but these errors were encountered: