: (unparse-cookie) ( cookie -- strings )
[
- dup name>> check-cookie-string >lower
+ dup name>> check-cookie-string
over value>> check-cookie-value unparse-cookie-value
"$path" over path>> unparse-cookie-value
"$domain" over domain>> unparse-cookie-value
: unparse-set-cookie ( cookie -- string )
[
- dup name>> check-cookie-string >lower
+ dup name>> check-cookie-string
over value>> check-cookie-value unparse-cookie-value
"path" over path>> unparse-cookie-value
"domain" over domain>> unparse-cookie-value
[ "__s=12345567" parse-cookie ]
unit-test
+[ { T{ cookie { name "CaseSensitive" } { value "aBc" } } } ]
+[ "CaseSensitive=aBc" parse-cookie ]
+unit-test
+
[ { T{ cookie { name "__s" } { value "12345567" } } } ]
[ "__s=12345567;" parse-cookie ]
unit-test
2choice case-sensitive ;
: 'attr' ( -- parser )
- 'token' case-insensitive ;
+ 'token' case-sensitive ;
: 'av-pair' ( -- parser )
[
[ { 10 200 3000 } ] [ { 1 10 100 1000 } pdiff ] unit-test
+
+[ { -512 2304 -4608 5376 -4032 2016 -672 144 -18 1 } ]
+[ { -2 1 } 9 p^ ] unit-test
+
+[ 0 ]
+[ 2 { -2 1 } 9 p^ polyval ] unit-test
dup length iota v* rest ;
: polyval ( x p -- p[x] )
- [ length swap powers ] [ nip ] 2bi v. ;
+ ! Horner scheme
+ [ nip <reversed> unclip-slice swap ]
+ [ drop ] 2bi
+ '[ [ _ * ] dip + ] each ;
MACRO: polyval* ( p -- )
reverse