"#stream.spl" import "#http.spl" import func ls { files | "." list-files } func ls@ { files | list-files } func cd { | chdir } func cat { | read-file } func output { | with thing ; thing gettype "array" eq thing gettype:ends-with<^Iter> or dup if { thing:foreach<&println> } not if { thing _str println } } func *m { | swap :ends-with } func m* { | swap :starts-with } func # { | swap :filter } func ? { | swap :map } func times { | :iter } func \ { | pop } func ~@ { | env:get<"HOME"> "/" concat swap concat } func ~ { | env:get<"HOME"> } func $ { v | env:get } func . { | output } func ex { | with s ; [ ^sh ^-c s ] command-wait; } func ex% { | command-wait; } func ex. { | with s ; [ ^sh ^-c s ] StreamTypes:cmd:create:read-to-end<1024 16 *> } func ex%. { | StreamTypes:cmd:create:read-to-end<1024 16 *> } func into { | with input file ; input gettype any<[ { | "array" eq } { | "bytearray" eq } ]> not if { input _str:to-bytes =input } file 1 StreamTypes:file:create dup :write-exact; :close; } func tcp { stream | StreamTypes:tcp:create } func curl { s | bcurl:to-str } func bcurl { bytes | with url ; 1 if { url:readf<"{}:{}/{}"> dup if { =url url:0 url:1 _int "GET" "/" url:2 concat net:http:Request:new 2 stop } pop url:readf<"{}:{}"> dup if { =url url:0 url:1 _int "GET" "/" net:http:Request:new 2 stop } pop url:readf<"{}/{}"> dup if { =url url:0 80 "GET" "/" url:1 concat net:http:Request:new 2 stop } pop url:readf<"{}"> dup if { =url url:0 80 "GET" "/" net:http:Request:new 2 stop } pop "invalid url" panic } :send:body } construct _shell_array_ext { idx ; next { any | with this ; this:idx 0 or dup ++ this:=idx this:sget } } include _shell_array_ext in array include _Iter in array func any { bool | with o checks ; 0 checks:foreach<{ | o swap call if { pop 1 } }> }