# Clyx standard library (in addition to [ :: readf src ]) # Created by Luxferre in 2026, released into the public domain :: if [ next next swap rot cond ] :: while [ next [] swap loop ] :: rot [ [ swap ] dip swap ] :: over [ [ dup ] dip swap ] :: qpush [ swap [] cons swap + ] :: nip [ [ drop ] dip ] :: div [ divmod drop ] :: mod [ divmod nip ] :: tuck [ swap over ] :: not [ 0= ] :: and [ if [ not not ] [ drop 0 ] ] :: or [ if [ drop 1 ] [ not not ] ] :: cr [ 10 emit ] :: space [ 32 emit ] :: puts [ uncons while [ emit uncons ] drop ] :: sqrt [ 0.5 ^ ] :: tan [ dup sin swap cos / ] :: cotan [ dup cos swap sin / ] :: neg [ 0 swap - ] :: 1/ [ 1 swap / ] :: shr [ neg shl ] :: readln [ 0 "r" fopen read l2s ] :: writef [ "w" fopen dup rot write swap close ] :: nlstn [ "0.0.0.0" swap nopen ] :: = [ - 0= ] :: != [ = not ] :: < [ - 0< ] :: >= [ < not ] :: > [ swap < ] :: <= [ > not ] :: isnum [ type 0= ] :: isstr [ type 1 = ] :: isquot [ type 2 = ] :: vlen [ type 2 = if [ qlen ] [ slen ] ] :: s2l [ type 2 = if [] [ dup slen 0 = if [ drop [] ] [ uncons drop swap cons ] ] ] :: asc [ s2l 0 qget ] :: lcat [ [ rev ] dip swap uncons while [ [ swap ] dip swap cons swap uncons ] drop ] :: streq [ dup vlen [ swap dup vlen ] dip = if [ 1 while [ uncons if [ [ swap uncons drop ] dip = if [ dup qlen 0 = if [ drop drop 1 0 ] [ swap 1 ] ] [ drop drop 0 0 ] ] [ drop drop 1 0 ] ] ] [ drop drop 0 ] ] :: lower [ "" swap uncons while [ dup 65 >= [ dup 90 <= ] dip and if [ 32 + ] [] [ swap ] dip chr s+ swap uncons ] drop ] :: upper [ "" swap uncons while [ dup 97 >= [ dup 122 <= ] dip and if [ 32 - ] [] [ swap ] dip chr s+ swap uncons ] drop ] :: bitnot [ dup nand ] :: bitand [ nand bitnot ] :: bitor [ bitnot swap bitnot nand ] :: bitxor [ over over bitnot bitand [ swap bitnot bitand ] dip bitor ] :: rev [ [] swap uncons while [ [ swap ] dip swap cons swap uncons ] drop ] :: s+ [ s2l [ s2l ] dip lcat ]