API

型ごとのセレクタは、コンパイラが持っている一つの表から出しています。その表が、何が呼べるかを決める唯一の場所です。 全量は配布物に同梱の一覧(lpsc api が出力するもの)にあります。ここでは、どの型に何があるかを見渡せるようにします。

数と金額

主なセレクタ
Int+ - * // \\ < abs max: min: between:and: asDecimal asFloat asString to: to:collect: timesRepeat:
FloatInt と同じ算術。sqrt floor ceiling rounded asInteger
Decimal+ - * / と比較。丸めは方向を名前で書く — roundedTo: truncatedTo: floorTo: ceilingTo: awayFromZeroTo:。割り算は dividedBy:roundedTo: の形で、どこまで残すかを一緒に書く。表示は grouped groupedTo:

Int は BigInt です。桁は落ちません。Decimal/ は割り切れなければエラーになるので、割り切れない計算は dividedBy:...To: を使います。

文字と記号

主なセレクタ
Str, size at: copyFrom:to: splitOn: replaceAll:with: startsWith: endsWith: includesSubstring: indexOf: asUppercase asLowercase reversed trimmed asInteger asDecimal asDate asSymbol collect: do:
Charvalue
Symbolname
Booland: or: not ifTrue:ifFalse:

asInteger asDecimal asDateMaybe を返します。読めない文字列は例外ではなく none です。

並びと対応

主なセレクタ
Array[a]size isEmpty first last at: at:ifAbsent: do: doWithIndex: collect: select: reject: detect:ifNone: inject:into: includes: indexOf: copyWith: take: drop: reversed sorted sortBy: joinWith: allSatisfy: anySatisfy: ,
Dict[k v]at: at:ifAbsent: at:put: removeKey: includesKey: keys values size collect: select: do:
Assoc[k v]key value
Maybe[a]isPresent isAbsent value orElse: map: ifPresent: ifPresent:ifAbsent:

ArrayDict も値です。at:put: は新しい Dict を返し、元は変わりません。sorted は要素が < を答える型のときだけ使えます。答えない型は sortBy: に順序を渡します。

日付と時刻

主なセレクタ
Dateyear month day dayOfWeek dayOfYear plusDays: minusDays: plusMonths: plusYears: startOfMonth endOfMonth daysUntil: isLeapYear slashed と比較
Instant比較、asStringDate への変換(時間帯を名指しする)

Date に時刻も時間帯もありません。plusMonths: は暦のとおりで、31日の一か月後は翌月の末日になります。

JSON と HTTP

主なセレクタ
Jsonat: itemAt: keys size isNull asStr asInt asDecimal asFloat asBool asArray asText
Json(クラス側)parse: object: array: str: int: decimal: bool: null
Httpget: get:headers: post:json: post:text: put:json: delete: url:query: encode: deadline:
Responsestatus body ok header:

at: は例外を投げません。オブジェクトでないものに送れば null の Json が返るので、途中を確かめずに辿れます。葉の asInt などが Maybe を返します。Http の要求は失敗しません。線が立たなければ status 0 の Response が返ります。

画面

主なセレクタ
Htmlclone: clone:fill: el: el:text: el:attrs: el:kids: el:attrs:kids: text: markup: child: child:as: all:
VNodeat:put: at:kids: at:class: at:attr:is: on:send: on:sendValue: on:sendEvent: at:on:send: key: class: attr:is: preventDefault stopPropagation
Eventkind value checked key x y scrollTop height shift ctrl alt meta
Appmount: mount:at: page: path go: replace: html: htmlAt:

App にはもう一組、検査のためのセレクタがあります。click: type:text: press:key: check:is: focus: blur scrollTo: です。画面を書くときには使いません。

アクタ

主なセレクタ
Actor(クラス側)spawn: spawn:named:、それに spawn:as:(参照をプロトコルで型付ける)
ActorRef[c]tell ask(送るのは宣言したハンドラ名)、name stop
ActorCtx[c]meref name spawn: spawn:as: monitor: demonitor: link: stop stop: after:send: onPath: listen:on:send: listen:on:sendValue: listen:on:sendEvent: intercept:on:send: ほか
Downactor reason
Future[a]forced then: onError:
Future(クラス側)value: all: after:do: sleep:
Worker(クラス側)new spawn:on:

その他

ConsoleprintLine:)、MathTimeSysErrorsignal:)があります。

一覧の出どころ

この頁の表は、コンパイラの中の署名表から出しています。そこに無いセレクタは、コンパイラが受け付けません。 実在するかどうかの検査も自動で走ります。コンパイラが「ある」と言っているセレクタが、ランタイム側に本当にあるかを機械が突き合わせています。