-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add currying #32
Comments
This comment was originally written by paulp...@gmail.com More on scala's currying: |
This comment was originally written by esprehn...@gmail.com The Function interface is empty which is silly. It should have a method on it to return a partially applied function just like Function.bind() in JS. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind var addOne = function(a, b) { return a + b }.bind(1); // This should work in Dart |
Removed Type-Defect label. |
This comment was originally written by drfibonacci@google.com Added Triaged label. |
Added WontFix label. |
This comment was originally written by paulp...@gmail.com Sorry, why this is |
This CL moves write-barrier checking code into stub for binary size reduction. ``` before ;; StoreInstanceField(v11 . start = v15) 0x101d0040c b801b020 strw r0, [r1, dart-lang#27] 0x101d00410 36000100 tbzw r0, #0, 0x101d00430 0x101d00414 385ff030 ldrb ip0, [r1, #-1] 0x101d00418 385ff011 ldrb ip1, [r0, #-1] 0x101d0041c 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00420 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d00424 54000060 beq 0x101d00430 0x101d00428 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d0042c d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x101d00430 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x101d00434 b801f020 strw r0, [r1, dart-lang#31] 0x101d00438 36000100 tbzw r0, #0, 0x101d00458 0x101d0043c 385ff030 ldrb ip0, [r1, #-1] 0x101d00440 385ff011 ldrb ip1, [r0, #-1] 0x101d00444 8a500a30 and ip0, ip1, ip0 lsr dart-lang#2 0x101d00448 ea5c821f ands zr, ip0, r28 lsr dart-lang#32 0x101d0044c 54000060 beq 0x101d00458 0x101d00450 f942cb5e ldr lr, [r26, dart-lang#1424] 0x101d00454 d63f03c0 blr lr ``` ``` after ;; StoreInstanceField(v11 . start = v15) 0x10a6003cc b801b020 strw r0, [r1, dart-lang#27] 0x10a6003d0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003d4 d63f03c0 blr lr ;; ParallelMove r0 <- r4 0x10a6003d8 aa0403e0 mov r0, r4 ;; StoreInstanceField(v11 . end = v17) 0x10a6003dc b801f020 strw r0, [r1, dart-lang#31] 0x10a6003e0 f942cb5e ldr lr, [r26, dart-lang#1424] 0x10a6003e4 d63f03c0 blr lr ```
Revisions updated by `dart tools/rev_sdk_deps.dart`. dartdoc (https://github.com/dart-lang/dartdoc/compare/dc502d0..4d7dc93): 4d7dc93b 2022-12-05 dependabot[bot] Bump github/codeql-action from 2.1.31 to 2.1.35 (#3263) bcf8b6e8 2022-12-05 Parker Lougheed Weight enums the same as classes for searching (#3260) 7d95578b 2022-12-04 Parker Lougheed Update template descriptions (#3258) d558f043 2022-12-04 Parker Lougheed Fix error when using base element href (#3256) c3663762 2022-12-04 Parker Lougheed Add unnecessary override ignore to fix build (#3257) http (https://github.com/dart-lang/http/compare/976bd56..46a7708): 46a7708 2022-12-02 Brian Quinlan Remove binary artifact (#833) sync_http (https://github.com/dart-lang/sync_http/compare/f5c1f18..8622614): 8622614 2022-12-02 Kevin Moore blast_repo fixes (#32) test (https://github.com/dart-lang/test/compare/f3d80a6..4dceb87): 4dceb87c 2022-12-01 Nate Bosch Ignore some usage of dperecated errors (#1807) webdev (https://github.com/dart-lang/webdev/compare/91b8a19..e39506e): e39506e 2022-12-05 Anna Gringauze Pre-warm expression compiler to speed up Flutter Inspector page loading. (#1786) 9b19b3b 2022-12-02 Elliott Brooks (she/her) Can save storage objects in both `session` and `local` storage (#1807) e75c45e 2022-12-02 Elliott Brooks (she/her) Injected client adds `isFlutterApp` to global window object (#1806) ba5e3ec 2022-12-01 Elliott Brooks (she/her) `DebugSession` listens to events instead of just sending events (#1804) Change-Id: I881d02e966b763879df72b29653a9f241b71eb3d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273826 Commit-Queue: Devon Carew <devoncarew@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
…_server, http_parser, logging, mockito, path, pool, shelf, source_map_stack_trace, sse, stream_channel, term_glyph, test, typed_data, watcher, web_socket_channel, webdev, webkit_inspection_protocol, yaml Revisions updated by `dart tools/rev_sdk_deps.dart`. cli_util (https://github.com/dart-lang/cli_util/compare/5a8e8ee..32bc077): 32bc077 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#73) clock (https://github.com/dart-lang/clock/compare/6b8b7bf..65e8a13): 65e8a13 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#42) csslib (https://github.com/dart-lang/csslib/compare/d776535..7054945): 7054945 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#157) dartdoc (https://github.com/dart-lang/dartdoc/compare/29a1bbf..c4ab682): c4ab6824 2023-01-10 Sam Rawlins Regenerate so latest analyzer is happy (#3293) fixnum (https://github.com/dart-lang/fixnum/compare/714381c..71f0d4d): 71f0d4d 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#103) glob (https://github.com/dart-lang/glob/compare/7adf833..4579281): 4579281 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#68) http_multi_server (https://github.com/dart-lang/http_multi_server/compare/beb40a7..cce5080): cce5080 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#48) http_parser (https://github.com/dart-lang/http_parser/compare/16a4f34..6f73e4a): 6f73e4a 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#66) logging (https://github.com/dart-lang/logging/compare/b525d5c..34ed68f): 34ed68f 2023-01-09 Kevin Moore Move to new analyzer language settings (#126) mockito (https://github.com/dart-lang/mockito/compare/942dd03..9cc958a): 9cc958a 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts path (https://github.com/dart-lang/path/compare/1299791..9768908): 9768908 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#133) pool (https://github.com/dart-lang/pool/compare/713e631..ad4e2a7): ad4e2a7 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#60) shelf (https://github.com/dart-lang/shelf/compare/32e342d..a44e95e): a44e95e 2023-01-10 Kevin Moore Fix doc comment references (#323) source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/e5f9564..adea3e5): adea3e5 2023-01-09 Sam Rawlins Migrate no-implicit-casts to strict-casts (#32) sse (https://github.com/dart-lang/sse/compare/3c37edb..be426a2): be426a2 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#74) stream_channel (https://github.com/dart-lang/stream_channel/compare/0a7800a..3b99268): 3b99268 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#84) term_glyph (https://github.com/dart-lang/term_glyph/compare/2bf4594..8cd9318): 8cd9318 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#31) test (https://github.com/dart-lang/test/compare/3415089..932a652): 932a652b 2023-01-09 Nate Bosch Add a Map operator[] extension (#1830) 1f2e963e 2023-01-09 Nate Bosch Add Future.doesNotComplete condition (#1827) typed_data (https://github.com/dart-lang/typed_data/compare/dbf81a7..9c209b9): 9c209b9 2023-01-09 Sam Rawlins Migrate no-implicit-casts to strict-casts (#58) watcher (https://github.com/dart-lang/watcher/compare/2e0db71..3b49c7e): 3b49c7e 2023-01-09 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#134) web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/ebd0fe9..28d7b82): 28d7b82 2023-01-10 Kevin Moore Fix CI link in readme (#248) c6ce895 2023-01-09 Sam Rawlins Update analysis_options.yaml (#247) webdev (https://github.com/dart-lang/webdev/compare/49f97b8..094ee97): 094ee97 2023-01-10 Anna Gringauze Add back setExceptionPauseMode (#1871) 2e65ddf 2023-01-10 Anna Gringauze Prepare for dart 3.0 alpha breaking changes (#1880) 2e2587a 2023-01-10 Elliott Brooks (she/her) Add hotfix instructions to DWDS (#1876) fe39123 2023-01-10 Elliott Brooks (she/her) Re-enable `reload_tests` (#1877) e71c0e3 2023-01-09 Anna Gringauze Fix crash on processing devtools event (#1875) webkit_inspection_protocol (https://github.com/google/webkit_inspection_protocol.dart/compare/ddb624c..15244ff): 15244ff 2023-01-09 Kevin Moore Add cron to CI (#97) yaml (https://github.com/dart-lang/yaml/compare/02be51e..b2fce6c): b2fce6c 2023-01-10 Sam Rawlins Migrate from no-implicit-casts to strict-casts (#134) Change-Id: I4fb257fe7c697fab562f4d18e4ea50c5903b4cd8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278807 Auto-Submit: Devon Carew <devoncarew@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This issue was originally filed by paulpmill...@gmail.com
Currying is a well-known (in functional languages) technique of transforming a function that takes multiple arguments (or an n-tuple of arguments) in such a way that it can be called as a chain of functions each with a single argument (partial application).
I propose to add its support into dart. Dart could implement them scala-way to keep both named / optional params and currying:
a = function(params1)(params2)(params3) {
return params1 + params2 + params3
}
a(5)(6)(7)
The text was updated successfully, but these errors were encountered: