Skip to content

Commit

Permalink
Test passing 'take' and 'skip' as arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
julianhyde committed Jan 2, 2024
1 parent f3254e2 commit 8a20a8c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/resources/script/relational.smli
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ from e in emps
take 2;
> val it = [30,30] : int list

(*) Pass 'take' and 'skip' via function arguments
let
fun earlyEmps n =
from e in emps
yield {e.id, e.deptno}
order id
skip n - 2
take n
in
(earlyEmps 2, earlyEmps 3)
end;
> val it =
> ([{deptno=10,id=100},{deptno=20,id=101}],
> [{deptno=20,id=101},{deptno=30,id=102},{deptno=30,id=103}])
> : {deptno:int, id:int} list * {deptno:int, id:int} list

(*) 'yield' followed by 'order'
from e in emps
yield {e.deptno, x = e.deptno, e.name}
Expand Down

0 comments on commit 8a20a8c

Please sign in to comment.