text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
dropWhileEnd(my isSpace, s) | asPrelude.applescript |
end stripEnd | asPrelude.applescript |
on stripPrefix(pfx, s) | asPrelude.applescript |
set blnString to class of pfx is text | asPrelude.applescript |
if blnString then | asPrelude.applescript |
set {xs, ys} to {characters of pfx, characters of s} | asPrelude.applescript |
set {xs, ys} to {pfx, s} | asPrelude.applescript |
on |λ|(xs, ys) | asPrelude.applescript |
if length of xs < 1 then | asPrelude.applescript |
set v to intercalate("", ys) | asPrelude.applescript |
set v to ys | asPrelude.applescript |
Just(v) | asPrelude.applescript |
if (length of ys < 1) or (item 1 of xs ≠ item 1 of ys) then | asPrelude.applescript |
|λ|(tail(xs), tail(ys)) | asPrelude.applescript |
|λ|(xs, ys) of result | asPrelude.applescript |
end stripPrefix | asPrelude.applescript |
on stripStart(s) | asPrelude.applescript |
dropWhile(my isSpace, s) | asPrelude.applescript |
end stripStart | asPrelude.applescript |
on subTreeAtPath(tree, pathSegments) | asPrelude.applescript |
on |λ|(children, xs) | asPrelude.applescript |
if {} ≠ children and {} ≠ xs then | asPrelude.applescript |
script parentMatch | asPrelude.applescript |
h = root of t | asPrelude.applescript |
script childMatch | asPrelude.applescript |
if 1 < length of xs then | asPrelude.applescript |
|λ|(nest of t, rest of xs) of go | asPrelude.applescript |
Just(t) | asPrelude.applescript |
bindMay(find(parentMatch, children), childMatch) | asPrelude.applescript |
|λ|({tree}, pathSegments) of go | asPrelude.applescript |
end subTreeAtPath | asPrelude.applescript |
on subsequences(xs) | asPrelude.applescript |
script nonEmptySubsequences | asPrelude.applescript |
on |λ|(xxs) | asPrelude.applescript |
if length of xxs < 1 then | asPrelude.applescript |
set {x, xs} to {item 1 of xxs, tail(xxs)} | asPrelude.applescript |
on |λ|(ys, r) | asPrelude.applescript |
cons(ys, cons(cons(x, ys), r)) | asPrelude.applescript |
cons({x}, foldr(f, {}, |λ|(xs) of nonEmptySubsequences)) | asPrelude.applescript |
cons("", map(my concat, |λ|(characters of xs) of nonEmptySubsequences)) | asPrelude.applescript |
cons([], |λ|(xs) of nonEmptySubsequences) | asPrelude.applescript |
end subsequences | asPrelude.applescript |
on subsets(xs) | asPrelude.applescript |
if 0 < length of ys then | asPrelude.applescript |
set h to item 1 of ys | asPrelude.applescript |
set zs to |λ|(rest of ys) | asPrelude.applescript |
script hcons | asPrelude.applescript |
on |λ|(z) | asPrelude.applescript |
{h} & z | asPrelude.applescript |
zs & map(hcons, zs) | asPrelude.applescript |
end subsets | asPrelude.applescript |
on subtract(x, y) | asPrelude.applescript |
y - x | asPrelude.applescript |
end subtract | asPrelude.applescript |
on succ(x) | asPrelude.applescript |
chr(1 + ord(x)) | asPrelude.applescript |
1 + x | asPrelude.applescript |
end succ | asPrelude.applescript |
on succMay(x) | asPrelude.applescript |
if x is maxBound(x) then | asPrelude.applescript |
Just(toEnum(x)'s |λ|(fromEnum(x) + 1)) | asPrelude.applescript |
end succMay | asPrelude.applescript |
on sum(xs) | asPrelude.applescript |
valueForKeyPath:"@sum.self") as real | asPrelude.applescript |
end sum | asPrelude.applescript |
on swap(ab) | asPrelude.applescript |
if class of ab is record then | asPrelude.applescript |
Tuple(|2| of ab, |1| of ab) | asPrelude.applescript |
{item 2 of ab, item 1 of ab} | asPrelude.applescript |
end swap | asPrelude.applescript |
on table(n, xs) | asPrelude.applescript |
set w to length of last item of xs | asPrelude.applescript |
unlines(map(my unwords, ¬ | asPrelude.applescript |
chunksOf(n, map(justifyRight(w, space), xs)))) | asPrelude.applescript |
end table | asPrelude.applescript |
on tail(xs) | asPrelude.applescript |
set blnText to text is class of xs | asPrelude.applescript |
if blnText then | asPrelude.applescript |
set unit to "" | asPrelude.applescript |
set unit to {} | asPrelude.applescript |
if 1 > lng then | asPrelude.applescript |
else if 2 > lng then | asPrelude.applescript |
unit | asPrelude.applescript |
text 2 thru -1 of xs | asPrelude.applescript |
rest of xs | asPrelude.applescript |
end tail | asPrelude.applescript |
on tailMay(xs) | asPrelude.applescript |
if xs = {} then | asPrelude.applescript |
Just(rest of xs) | asPrelude.applescript |
end tailMay | asPrelude.applescript |
on tails(xs) | asPrelude.applescript |
set es to characters of xs | asPrelude.applescript |
set es to xs | asPrelude.applescript |
items i thru -1 of es | asPrelude.applescript |
map(residue, es) & {{}} | asPrelude.applescript |
end tails | asPrelude.applescript |
set c to class of xs | asPrelude.applescript |
if 0 < n and 0 < lng then | asPrelude.applescript |
items 1 thru min(n, lng) of xs | asPrelude.applescript |
else if string is c then | asPrelude.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.