] [
class sel imp types add-method
] if* ;
-
+
: redefine-objc-methods ( methods name -- )
dup class-exists? [
objc_getClass '[ [ _ ] dip (redefine-objc-method) ] each
[ sift { "self" "selector" } prepend ] tri* ;
: parse-method-body ( names -- quot )
- [ [ make-local ] map ] H{ } make-assoc
+ [ [ make-local ] map ] H{ } make
(parse-lambda) <lambda> ?rewrite-closures first ;
SYNTAX: METHOD:
: make-input-map ( #shuffle -- assoc )
! Assoc maps high-level IR values to stack locations.
[
- [ in-d>> <reversed> [ <ds-loc> swap set ] each-index ]
- [ in-r>> <reversed> [ <rs-loc> swap set ] each-index ] bi
- ] H{ } make-assoc ;
+ [ in-d>> <reversed> [ <ds-loc> swap ,, ] each-index ]
+ [ in-r>> <reversed> [ <rs-loc> swap ,, ] each-index ] bi
+ ] H{ } make ;
: make-output-seq ( values mapping input-map -- vregs )
'[ _ at _ at peek-loc ] map ;
! See http://factorcode.org/license.txt for BSD license.
USING: arrays alien alien.c-types alien.data alien.syntax kernel
destructors accessors fry words hashtables strings sequences
-memoize assocs math math.order math.vectors math.rectangles
+memoize assocs make math math.order math.vectors math.rectangles
math.functions locals init namespaces combinators fonts colors
cache core-foundation core-foundation.strings
core-foundation.attributed-strings core-foundation.utilities
dup string? [ not-a-string ] unless
] 2dip
[
- kCTForegroundColorAttributeName set
- kCTFontAttributeName set
- ] H{ } make-assoc <CFAttributedString> &CFRelease
+ kCTForegroundColorAttributeName ,,
+ kCTFontAttributeName ,,
+ ] H{ } make <CFAttributedString> &CFRelease
CTLineCreateWithAttributedString
] with-destructors ;
: pop-functor-words ( -- )
functor-words unuse-words ;
-: (parse-bindings) ( end -- )
- dup parse-binding dup [
- first2 [ make-local ] dip 2array ,
- (parse-bindings)
- ] [ 2drop ] if ;
+: (parse-bindings) ( end -- words )
+ [ dup parse-binding dup ]
+ [ first2 [ make-local ] dip 2array ]
+ produce 2nip ;
: with-bindings ( quot -- words assoc )
- '[
- in-lambda? on
- _ H{ } make-assoc
- ] { } make swap ; inline
+ in-lambda? on H{ } make ; inline
: parse-bindings ( end -- words assoc )
[
- namespace use-words
+ building get use-words
(parse-bindings)
- namespace unuse-words
+ building get unuse-words
] with-bindings ;
: parse-functor-body ( -- form )
username-view>> get-url
swap >json "key" set-query-param
((get-user)) ;
-
+
: strip-hash ( hash1 -- hash2 )
[ drop first CHAR: _ = not ] assoc-filter ;
: (new-user) ( user -- user/f )
dup
[
- [ username>> "username" set ]
- [ email>> "email" set ]
+ [ username>> "username" ,, ]
+ [ email>> "email" ,, ]
bi
- ] H{ } make-assoc
+ ] H{ } make
reserve-multiple
[
user>user-hash >json
couchdb-auth-provider new swap >>username-view swap >>base-url ;
M: couchdb-auth-provider get-user ( username provider -- user/f )
- [
- couchdb-auth-provider set
+ couchdb-auth-provider [
(get-user) [ user-hash>user ] [ f ] if*
- ] with-scope ;
+ ] with-variable ;
M: couchdb-auth-provider new-user ( user provider -- user/f )
- [
- couchdb-auth-provider set
+ couchdb-auth-provider [
dup (new-user) [
username>> couchdb-auth-provider get get-user
] [ drop f ] if
- ] with-scope ;
+ ] with-variable ;
M: couchdb-auth-provider update-user ( user provider -- )
- [
- couchdb-auth-provider set
+ couchdb-auth-provider [
[ username>> (get-user)/throw-on-no-user dup ]
[ drop "_id" swap at get-url ]
[ user>user-hash swapd
unify-users >json swap couch-put drop
]
tri
- ] with-scope ;
+ ] with-variable ;
! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays combinators effects.parser
+USING: accessors arrays assocs combinators effects.parser
generic.parser kernel lexer locals.errors fry
locals.rewrite.closures locals.types make namespaces parser
quotations sequences splitting words vocabs.parser ;
: make-local ( name -- word )
"!" ?tail [
<local-reader>
- dup <local-writer> dup name>> set
+ dup <local-writer> dup name>> ,,
] [ <local> ] if
- dup dup name>> set ;
+ dup dup name>> ,, ;
: make-locals ( seq -- words assoc )
- [ [ make-local ] map ] H{ } make-assoc ;
+ [ [ make-local ] map ] H{ } make ;
: parse-local-defs ( -- words assoc )
- [ "|" [ make-local ] map-tokens ] H{ } make-assoc ;
+ [ "|" [ make-local ] map-tokens ] H{ } make ;
SINGLETON: lambda-parser
[ use-words @ ]
[ unuse-words ] tri
] with-scope ; inline
-
+
: (parse-lambda) ( assoc -- quot )
[ \ ] parse-until >quotation ] ((parse-lambda)) ;
?rewrite-closures ;
: parse-multi-def ( locals -- multi-def )
- [ ")" [ make-local ] map-tokens ] with-variables <multi-def> ;
+ [ [ ")" [ make-local ] map-tokens ] H{ } make ] dip
+ swap assoc-union! drop <multi-def> ;
: parse-def ( name/paren locals -- def )
- over "(" = [ nip parse-multi-def ] [ [ make-local ] with-variables <def> ] if ;
+ over "(" =
+ [ nip parse-multi-def ]
+ [ [ [ make-local ] H{ } make ] dip swap assoc-union! drop <def> ]
+ if ;
M: lambda-parser parse-quotation ( -- quotation )
H{ } clone (parse-lambda) ;
kernel logging sequences combinators splitting assocs strings
math.order math.parser random system calendar summary calendar.format
accessors sets hashtables base64 debugger classes prettyprint words ;
-FROM: namespaces => set ;
IN: smtp
SYMBOL: smtp-domain
: email>headers ( email -- assoc )
[
- now timestamp>rfc822 "Date" set
- message-id "Message-Id" set
- "1.0" "MIME-Version" set
- "base64" "Content-Transfer-Encoding" set
+ now timestamp>rfc822 "Date" ,,
+ message-id "Message-Id" ,,
+ "1.0" "MIME-Version" ,,
+ "base64" "Content-Transfer-Encoding" ,,
{
- [ from>> "From" set ]
- [ to>> ", " join "To" set ]
- [ cc>> ", " join [ "Cc" set ] unless-empty ]
- [ subject>> "Subject" set ]
- [ email-content-type "Content-Type" set ]
+ [ from>> "From" ,, ]
+ [ to>> ", " join "To" ,, ]
+ [ cc>> ", " join [ "Cc" ,, ] unless-empty ]
+ [ subject>> "Subject" ,, ]
+ [ email-content-type "Content-Type" ,, ]
} cleave
- ] { } make-assoc ;
+ ] H{ } make ;
: (send-email) ( headers email -- )
[
: app-plist ( icon? executable bundle-name -- assoc )
[
- "6.0" "CFBundleInfoDictionaryVersion" set
- "APPL" "CFBundlePackageType" set
+ "6.0" "CFBundleInfoDictionaryVersion" ,,
+ "APPL" "CFBundlePackageType" ,,
- file-name "CFBundleName" set
+ file-name "CFBundleName" ,,
- [ "CFBundleExecutable" set ]
- [ "org.factor." prepend "CFBundleIdentifier" set ] bi
+ [ "CFBundleExecutable" ,, ]
+ [ "org.factor." prepend "CFBundleIdentifier" ,, ] bi
- [ "Icon.icns" "CFBundleIconFile" set ] when
- ] H{ } make-assoc ;
+ [ "Icon.icns" "CFBundleIconFile" ,, ] when
+ ] H{ } make ;
: create-app-plist ( icon? executable bundle-name -- )
[ app-plist ] keep
! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays definitions kernel sequences strings
-math assocs words generic namespaces make quotations
-splitting ui.gestures unicode.case unicode.categories tr fry ;
+math assocs words generic make quotations splitting
+ui.gestures unicode.case unicode.categories tr fry ;
IN: ui.commands
SYMBOL: +nullary+
[
commands>>
[ drop ] assoc-filter
- [ '[ _ invoke-command ] swap set ] assoc-each
+ [ '[ _ invoke-command ] swap ,, ] assoc-each
] each
- ] H{ } make-assoc ;
+ ] H{ } make ;
: update-gestures ( class -- )
dup command-gestures set-gestures ;
source-files.errors colors.constants combinators.short-circuit
compiler.units help.tips concurrency.flags concurrency.mailboxes
continuations destructors documents documents.elements fry hashtables
-help help.markup io io.styles kernel lexer listener math models sets
+help help.markup io io.styles kernel lexer listener make math models sets
models.delay models.arrow namespaces parser prettyprint quotations
sequences strings threads vocabs vocabs.refresh vocabs.loader
vocabs.parser words debugger ui ui.commands ui.pens.solid ui.gadgets
M: word (print-input)
"Command: "
[
- "sans-serif" font-name set
- bold font-style set
- ] H{ } make-assoc format . ;
+ "sans-serif" font-name ,,
+ bold font-style ,,
+ ] H{ } make format . ;
: print-input ( object interactor -- )
output>> [ (print-input) ] with-output-stream* ;
compiler.units parser io.encodings.ascii interval-maps
ascii sets combinators locals math.ranges sorting make
strings.parser io.encodings.utf8 memoize simple-flat-file ;
-FROM: namespaces => set ;
IN: unicode.data
<PRIVATE
: set-code-point ( seq -- )
4 head [ multihex ] map first4
- <code-point> swap first set ;
+ <code-point> swap first ,, ;
! Extra properties
: parse-properties ( -- {{[a,b],prop}} )
: load-special-casing ( -- special-casing )
"vocab:unicode/data/SpecialCasing.txt" data
[ length 5 = ] filter
- [ [ set-code-point ] each ] H{ } make-assoc ;
+ [ [ set-code-point ] each ] H{ } make ;
load-data {
[ process-names name-map swap assoc-union! drop ]
! Copyright (C) 2004, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs classes classes.private
-combinators kernel math math.order namespaces sequences sorting
-vectors words ;
+combinators kernel make math math.order namespaces sequences
+sorting vectors words ;
FROM: classes => members ;
RENAME: members sets => set-members
IN: classes.algebra
] if-empty ;
: flatten-class ( class -- assoc )
- [ (flatten-class) ] H{ } make-assoc ;
+ [ (flatten-class) ] H{ } make ;
! Copyright (C) 2004, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: classes classes.algebra.private classes.private kernel
-kernel.private namespaces sequences words ;
+kernel.private make namespaces sequences words ;
IN: classes.builtin
SYMBOL: builtins
M: builtin-class instance? [ tag ] [ class>type ] bi* eq? ;
-M: builtin-class (flatten-class) dup set ;
+M: builtin-class (flatten-class) dup ,, ;
M: builtin-class (classes-intersect?) eq? ;
: make-class-props ( superclass members participants metaclass -- assoc )
[
{
- [ dup [ bootstrap-word ] when "superclass" set ]
- [ [ bootstrap-word ] map "members" set ]
- [ [ bootstrap-word ] map "participants" set ]
- [ "metaclass" set ]
+ [ dup [ bootstrap-word ] when "superclass" ,, ]
+ [ [ bootstrap-word ] map "members" ,, ]
+ [ [ bootstrap-word ] map "participants" ,, ]
+ [ "metaclass" ,, ]
} spread
- ] H{ } make-assoc ;
+ ] H{ } make ;
GENERIC: metaclass-changed ( use class -- )
! See http://factorcode.org/license.txt for BSD license.
USING: words accessors sequences kernel assocs combinators
classes classes.private classes.algebra classes.algebra.private
-classes.builtin namespaces arrays math quotations ;
+classes.builtin namespaces arrays math quotations make ;
IN: classes.intersection
PREDICATE: intersection-class < class
participants>> [ full-cover ] [
[ flatten-class keys ]
[ intersect-flattened-classes ] map-reduce
- [ dup set ] each
+ [ dup ,, ] each
] if-empty ;
M: anonymous-intersection class-name
M: tuple-class instance?
dup echelon-of layout-class-offset tuple-instance? ;
-M: tuple-class (flatten-class) dup set ;
+M: tuple-class (flatten-class) dup ,, ;
M: tuple-class (classes-intersect?)
{
classes.algebra.private classes.maybe classes.private
combinators definitions kernel make namespaces sequences sets
words ;
-FROM: namespaces => set ;
IN: generic
! Method combination protocol
: method-word-props ( class generic -- assoc )
[
- "method-generic" set
- "method-class" set
- ] H{ } make-assoc ;
+ "method-generic" ,,
+ "method-class" ,,
+ ] H{ } make ;
: <method> ( class generic -- method )
check-method
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: math math.functions kernel io io.styles prettyprint
-combinators hints fry namespaces sequences ;
+USING: make math math.functions kernel io io.styles prettyprint
+combinators hints fry sequences ;
IN: benchmark.partial-sums
! Helper words
: partial-sums ( n -- results )
[
{
- [ 2/3^k \ 2/3^k set ]
- [ k^-0.5 \ k^-0.5 set ]
- [ 1/k(k+1) \ 1/k(k+1) set ]
- [ flint-hills \ flint-hills set ]
- [ cookson-hills \ cookson-hills set ]
- [ harmonic \ harmonic set ]
- [ riemann-zeta \ riemann-zeta set ]
- [ alternating-harmonic \ alternating-harmonic set ]
- [ gregory \ gregory set ]
+ [ 2/3^k \ 2/3^k ,, ]
+ [ k^-0.5 \ k^-0.5 ,, ]
+ [ 1/k(k+1) \ 1/k(k+1) ,, ]
+ [ flint-hills \ flint-hills ,, ]
+ [ cookson-hills \ cookson-hills ,, ]
+ [ harmonic \ harmonic ,, ]
+ [ riemann-zeta \ riemann-zeta ,, ]
+ [ alternating-harmonic \ alternating-harmonic ,, ]
+ [ gregory \ gregory ,, ]
} cleave
- ] { } make-assoc ;
+ ] { } make ;
HINTS: partial-sums fixnum ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays hashtables sequences.parser
-html.parser.utils kernel namespaces sequences math
+html.parser.utils kernel namespaces sequences make math
unicode.case unicode.categories combinators.short-circuit
quoting fry ;
IN: html.parser
dup sequence-parse-end? [
drop
] [
- [ parse-key/value swap set ] [ (parse-attributes) ] bi
+ [ parse-key/value swap ,, ] [ (parse-attributes) ] bi
] if ;
: parse-attributes ( sequence-parser -- hashtable )
- [ (parse-attributes) ] H{ } make-assoc ;
+ [ (parse-attributes) ] H{ } make ;
: (parse-tag) ( string -- string' hashtable )
[
: method-word-props ( specializer generic -- assoc )
[
- "multi-method-generic" set
- "multi-method-specializer" set
- ] H{ } make-assoc ;
+ "multi-method-generic" ,,
+ "multi-method-specializer" ,,
+ ] H{ } make ;
: <method> ( specializer generic -- word )
[ method-word-props ] 2keep
: make-token-params ( params quot -- assoc )
'[
- "1.0" "oauth_version" set
- "HMAC-SHA1" "oauth_signature_method" set
+ "1.0" "oauth_version" ,,
+ "HMAC-SHA1" "oauth_signature_method" ,,
_
[
- [ consumer-token>> key>> "oauth_consumer_key" set ]
- [ timestamp>> "oauth_timestamp" set ]
- [ nonce>> "oauth_nonce" set ]
+ [ consumer-token>> key>> "oauth_consumer_key" ,, ]
+ [ timestamp>> "oauth_timestamp" ,, ]
+ [ nonce>> "oauth_nonce" ,, ]
tri
] bi
- ] H{ } make-assoc ; inline
+ ] H{ } make ; inline
:: sign-params ( url request-method consumer-token request-token params -- signed-params )
params sort-keys :> params
<post-request> ;
: make-request-token-params ( params -- assoc )
- [ callback-url>> "oauth_callback" set ] make-token-params ;
+ [ callback-url>> "oauth_callback" ,, ] make-token-params ;
: <request-token-request> ( url params -- request )
[ consumer-token>> f ] [ make-request-token-params ] bi
: make-access-token-params ( params -- assoc )
[
- [ request-token>> key>> "oauth_token" set ]
- [ verifier>> "oauth_verifier" set ]
+ [ request-token>> key>> "oauth_token" ,, ]
+ [ verifier>> "oauth_verifier" ,, ]
bi
] make-token-params ;
params access-token>>
params
[
- access-token>> key>> "oauth_token" set
- namespace request post-data>> assoc-union! drop
+ access-token>> key>> "oauth_token" ,,
+ request post-data>> %%
] make-token-params
sign-params ;