X-Git-Url: http://git.hcoop.net/jackhill/mal.git/blobdiff_plain/ece70f970306f819b148979c3d17f266c7e08146..fbfe6784d2db983018340e4e1492d8d017029867:/impls/powershell/core.psm1 diff --git a/impls/powershell/core.psm1 b/impls/powershell/core.psm1 index 2c64dcdb..a8321824 100644 --- a/impls/powershell/core.psm1 +++ b/impls/powershell/core.psm1 @@ -19,6 +19,14 @@ function concat { new-list $res } +function vec($seq) { + if(vector? $seq) { + return $seq + } else { + return new-vector($seq.values) + } +} + function nth($lst, $idx) { if ($idx -ge $lst.values.Count) { throw "nth: index out of range" @@ -147,6 +155,7 @@ $core_ns = @{ "sequential?" = Get-Command sequential?; "cons" = { param($a, $b); new-list (@($a) + $b.values) }; "concat" = Get-Command concat; + "vec" = Get-Command vec; "nth" = Get-Command nth; "first" = { param($a); if ($a -eq $null) { $null } else { $a.first() } }; "rest" = { param($a); if ($a -eq $null) { new-list @() } else { $a.rest() } };