Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit32fd333

Browse files
forkicartermp
authored andcommitted
MapFold is part of FSharp.Core (#3148)
1 parent0feb9c5 commit32fd333

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

‎src/absil/illib.fs‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,7 @@ module List =
449449
match lwith
450450
|[]->false
451451
| h::t-> LanguagePrimitives.PhysicalEquality x h|| memq x t
452-
453-
// must be tail recursive
454-
letmapFold(f:'a->'b->'c* 'a)(s:'a)(l:'b list):'c list* 'a=
455-
match lwith
456-
|[]->[], s
457-
|[h]->letf= OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
458-
leth',s'= f.Invoke(s, h)
459-
[h'], s'
460-
|_->
461-
List.mapFold f s l
462-
452+
463453
// Not tail recursive
464454
let recmapFoldBack f l s=
465455
match lwith
@@ -487,7 +477,7 @@ module List =
487477
| x::xs-> fhead x:: List.map ftail xs
488478

489479
letcollectFold f s l=
490-
letl,s= mapFold f s l
480+
letl,s=List.mapFold f s l
491481
List.concat l, s
492482

493483
letcollect2 f xs ys= List.concat(List.map2 f xs ys)
@@ -496,7 +486,7 @@ module List =
496486
letiterSquared f xss= xss|> List.iter(List.iter f)
497487
letcollectSquared f xss= xss|> List.collect(List.collect f)
498488
letmapSquared f xss= xss|> List.map(List.map f)
499-
letmapFoldSquared f z xss= mapFold(mapFold f) z xss
489+
letmapFoldSquared f z xss=List.mapFold(List.mapFold f) z xss
500490
letforallSquared f xss= xss|> List.forall(List.forall f)
501491
letmapiSquared f xss= xss|> List.mapi(fun i xs-> xs|> List.mapi(fun j x-> f i j x))
502492
letexistsSquared f xss= xss|> List.exists(fun xs-> xs|> List.exists(fun x-> f x))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp