streamlined q-form related calls

This commit is contained in:
Luxferre
2026-07-04 16:59:38 +03:00
parent 46ff217e14
commit a4978499d6
5 changed files with 25 additions and 25 deletions
+6 -6
View File
@@ -22,7 +22,7 @@
:: neg [ 0 swap - ]
:: 1/ [ 1 swap / ]
:: shr [ neg shl ]
:: readln [ 0 "r" fopen read l2s ]
:: readln [ 0 "r" fopen read q2s ]
:: writef [ "w" fopen dup rot write swap close ]
:: nlstn [ "0.0.0.0" swap nopen ]
:: = [ - 0= ]
@@ -35,15 +35,15 @@
:: isstr [ type 1 = ]
:: isq [ 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 ]
:: s2q [ type 2 = if [] [ dup slen 0 = if [ drop [] ] [ uncons drop swap cons ] ] ]
:: asc [ s2q 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 l2s ]
:: upper [ "" swap uncons while [ dup 97 >= [ dup 122 <= ] dip and if [ 32 - ] [] [ swap ] dip chr s+ swap uncons ] drop l2s ]
:: lower [ "" swap uncons while [ dup 65 >= [ dup 90 <= ] dip and if [ 32 + ] [] [ swap ] dip chr s+ swap uncons ] drop q2s ]
:: upper [ "" swap uncons while [ dup 97 >= [ dup 122 <= ] dip and if [ 32 - ] [] [ swap ] dip chr s+ swap uncons ] drop q2s ]
:: 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 ]
:: s+ [ s2q [ s2q ] dip lcat ]