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

Commit20318b0

Browse files
committed
change the sliceTake and sliceSkip behavior
they will not throw for a n < 0 and n > list.Length. they return []instead.this make arr.[..a] always the same with arr.[0..a]arr.[a..(arr.Length-1)] === arr.[a..]
1 parentd48f3bf commit20318b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/fsharp/FSharp.Core/prim-types.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,7 +3622,7 @@ namespace Microsoft.FSharp.Collections
36223622
// similar to 'take' but with n representing an index, not a number of elements
36233623
// and with exceptions matching array slicing
36243624
letsliceTake n l=
3625-
if n<0thenoutOfRange()
3625+
if n<0then[]
36263626
match lwith
36273627
|[]-> outOfRange()
36283628
| x::xs->
@@ -3637,7 +3637,7 @@ namespace Microsoft.FSharp.Collections
36373637
match lstwith
36383638
|_when i=0-> lst
36393639
|_::t-> loop(i-1) t
3640-
|[]->outOfRange()
3640+
|[]->[]
36413641
loop n l
36423642

36433643
typeList<'T>with

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp