]> gitweb.factorcode.org Git - factor.git/commitdiff
use array literals instead of vector literals
authorSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2005 20:53:47 +0000 (20:53 +0000)
committerSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2005 20:53:47 +0000 (20:53 +0000)
49 files changed:
TODO.FACTOR.txt
contrib/httpd/html.factor
contrib/math/test.factor
library/alien/c-types.factor
library/alien/compiler.factor
library/alien/structs.factor
library/bootstrap/boot-stage1.factor
library/bootstrap/boot-stage2.factor
library/bootstrap/image.factor
library/bootstrap/primitives.factor
library/collections/arrays.factor
library/collections/assoc.factor
library/collections/sequence-combinators.factor
library/collections/sequences-epilogue.factor
library/collections/slicing.factor
library/compiler/basic-blocks.factor
library/compiler/compiler.factor
library/compiler/intrinsics.factor
library/compiler/linearizer.factor
library/compiler/x86/architecture.factor
library/freetype/freetype-gl.factor
library/generic/slots.factor
library/help/tutorial.factor
library/inference/branches.factor
library/inference/call-optimizers.factor
library/inference/dataflow.factor
library/inference/inference.factor
library/inference/known-words.factor
library/inference/shuffle.factor
library/inference/stack.factor
library/inference/words.factor
library/opengl/opengl-utils.factor
library/sdl/sdl-keysym.factor
library/syntax/prettyprint.factor
library/test/collections/strings.factor
library/test/files.factor
library/test/gadgets/rectangles.factor
library/test/lists/assoc.factor
library/test/math/integer.factor
library/test/test.factor
library/tools/describe.factor
library/tools/memory.factor
library/tools/walker.factor
library/ui/books.factor
library/ui/presentations.factor
library/ui/scrolling.factor
library/ui/splitters.factor
library/ui/theme.factor
library/words.factor

index 54086d68305ff94e8a988264e24ac8f64342bd05..4e5f19dad5b56ae701b7964fbd0e32d14f77a0ec 100644 (file)
@@ -2,14 +2,8 @@
 \r
 - swap @{ and { syntax\r
 - get stuff in examples dir running in the ui\r
-- [ ... is annoying\r
-  perhaps on the last line of output, if a block doesn't fit, print\r
-  it anyway?\r
-- deallocate textures and display lists\r
 - pixelColor replacement\r
-- fix presentations\r
-- gadget-children on f error with outliners\r
-\r
+X\r
 + ui:\r
 \r
 - make-pane: if no input, just return pane-output\r
@@ -46,7 +40,6 @@
 + ffi:\r
 \r
 - C structs, enums, unions: use new-style string mode parsing\r
-- alien/c-types.factor is ugly\r
 - smarter out parameter handling\r
 - clarify powerpc passing of value struct parameters\r
 - ffi unicode strings: null char security hole\r
index 03ae5848fb3d4f029763b373d7cc58bada4cdd89..51a1c381c6f0e7d186e34d0d4d033cb13e333865 100644 (file)
@@ -20,7 +20,7 @@ presentation sequences strings styles words ;
     ] "" make ;
 
 : hex-color, ( triplet -- )
-    [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
+    3 swap head [ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
 
 : fg-css, ( color -- )
     "color: #" % hex-color, "; " % ;
@@ -40,6 +40,16 @@ presentation sequences strings styles words ;
 : font-css, ( font -- )
     "font-family: " % % "; " % ;
 
+: assoc-apply ( value-alist quot-alist -- )
+    #! Looks up the key of each pair in the first list in the
+    #! second list to produce a quotation. The quotation is
+    #! applied to the value of the pair. If there is no
+    #! corresponding quotation, the value is popped off the
+    #! stack.
+    swap [
+        unswons rot assoc* dup [ cdr call ] [ 2drop ] if
+    ] each-with ;
+
 : css-style ( style -- )
     [
         [
index 496e75f70655b9b9d03699cf87349a0154807736..99abad984432e45da6c0e5994faa5ba079666b05 100644 (file)
@@ -223,3 +223,5 @@ unit-test
 [ 0 ] [ { 1 } var ] unit-test
 [ 0 ] [ { 1 } std ] unit-test
 
+[ 3 ] [ 5 7 mod-inv ] unit-test
+[ 78572682077 ] [ 234829342 342389423843 mod-inv ] unit-test
index 4cf7b134916d8c15fca07948d960f632c11bacd1..255d108ad1479d588998dea70540121d121ec900 100644 (file)
@@ -23,7 +23,13 @@ SYMBOL: c-types
     ] ?if ;
 
 : c-size ( name -- size )
-    c-type [ "width" get ] bind ;
+    "width" swap c-type hash ;
+
+: c-getter ( name -- quot )
+    "getter" swap c-type hash ;
+
+: c-setter ( name -- quot )
+    "setter" swap c-type hash ;
 
 : define-c-type ( quot name -- )
     >r <c-type> [ swap bind ] keep r> c-types get set-hash ;
@@ -31,50 +37,44 @@ SYMBOL: c-types
 
 : <c-object> ( size -- c-ptr ) cell / ceiling <byte-array> ;
 
-: <c-array> ( n size -- c-ptr ) * <c-object> ;
-
 : define-pointer ( type -- )
     "void*" c-type swap "*" append c-types get set-hash ;
 
 : define-deref ( name vocab -- )
     >r dup "*" swap append r> create
-    "getter" rot c-type hash 0 swons define-compound ;
+    swap c-getter 0 swons define-compound ;
+
+: (c-constructor) ( name vocab type quot -- )
+    >r >r constructor-word r> c-size r> cons define-compound ;
 
 : c-constructor ( name vocab -- )
     #! Make a word <foo> where foo is the structure name that
     #! allocates a Factor heap-local instance of this structure.
     #! Used for C functions that expect you to pass in a struct.
-    dupd constructor-word
-    swap c-size [ <c-object> ] cons
-    define-compound ;
+    over [ <c-object> ] (c-constructor) ;
 
 : array-constructor ( name vocab -- )
     #! Make a word <foo-array> ( n -- byte-array ).
-    >r dup "-array" append r> constructor-word
-    swap c-size [ <c-array> ] cons
-    define-compound ;
+    over >r >r "-array" append r> r>
+    [ * <c-object> ] (c-constructor) ;
+
+: (define-nth) ( word type quot -- )
+    >r c-size [ rot * ] cons r> append define-compound ;
 
 : define-nth ( name vocab -- )
-    #! Make a word foo-nth ( n alien -- dsplaced-alien ).
+    #! Make a word foo-nth ( n alien -- displaced-alien ).
     >r dup "-nth" append r> create
-    swap dup c-size [ rot * ] cons "getter" rot c-type hash
-    append define-compound ;
+    swap dup c-getter (define-nth) ;
 
 : define-set-nth ( name vocab -- )
-    #! Make a word foo-nth ( n alien -- dsplaced-alien ).
+    #! Make a word foo-nth ( n alien -- displaced-alien ).
     >r "set-" over "-nth" append3 r> create
-    swap dup c-size [ rot * ] cons "setter" rot c-type hash
-    append define-compound ;
+    swap dup c-setter (define-nth) ;
 
 : define-out ( name vocab -- )
     #! Out parameter constructor for integral types.
-    dupd constructor-word
-    swap c-type [
-        [
-            "width" get , \ <c-object> , \ tuck , 0 ,
-            "setter" get %
-        ] [ ] make
-    ] bind define-compound ;
+    over [ <c-object> tuck 0 ] over c-setter append
+    (c-constructor) ;
 
 : init-c-type ( name vocab -- )
     over define-pointer
index 8fea20309fcd8788149c744c43fe22db7e54c9cc..570cbae65819963e0e79875894273a22f74758ee 100644 (file)
@@ -70,7 +70,7 @@ C: alien-node make-node ;
 : c-aligned c-size cell align ;
 
 : stack-space ( parameters -- n )
-    0 swap [ c-aligned + ] each ;
+    0 [ c-aligned + ] reduce ;
 
 : unbox-parameter ( n parameter -- node )
     c-type [ "unboxer" get "reg-class" get ] bind %unbox ;
@@ -134,7 +134,7 @@ M: alien-node linearize* ( node -- )
 
 : unpair ( seq -- odds evens )
     2 swap group flip dup empty?
-    [ drop { } { } ] [ first2 ] if ;
+    [ drop @{ }@ @{ }@ ] [ first2 ] if ;
 
 : parse-arglist ( lst -- types stack effect )
     unpair [
@@ -169,6 +169,6 @@ M: compound (uncrossref)
     over "infer" word-prop or [
         drop
     ] [
-        dup { "infer-effect" "base-case" "no-effect" "terminates" }
+        dup @{ "infer-effect" "base-case" "no-effect" "terminates" }@
         reset-props update-xt
     ] if ;
index 0f0bbf0a564c0334405669cac04345622bcea38b..746299cb8a060d2b5b0b0f18f21445ca50a071a1 100644 (file)
@@ -10,24 +10,25 @@ words ;
 : define-getter ( offset type name -- )
     #! Define a word with stack effect ( alien -- obj ) in the
     #! current 'in' vocabulary.
-    create-in >r
-    [ "getter" get ] bind cons r> swap define-compound ;
+    create-in >r c-getter cons r> swap define-compound ;
 
 : define-setter ( offset type name -- )
     #! Define a word with stack effect ( obj alien -- ) in the
     #! current 'in' vocabulary.
-    "set-" swap append create-in >r
-    [ "setter" get ] bind cons r> swap define-compound ;
+    "set-" swap append create-in >r c-setter cons r>
+    swap define-compound ;
+
+: c-align c-type [ "align" get ] bind ;
 
 : define-field ( offset type name -- offset )
-    >r c-type dup >r [ "align" get ] bind align r> r>
+    >r dup >r c-align align r> r>
     "struct-name" get swap "-" swap append3
     ( offset type name -- )
     3dup define-getter 3dup define-setter
-    drop [ "width" get ] bind + ;
+    drop c-size + ;
 
 : define-member ( max type -- max )
-    c-type [ "width" get ] bind max ;
+    c-size max ;
 
 : define-struct-type ( width -- )
     #! Define inline and pointer type for the struct. Pointer
@@ -36,6 +37,5 @@ words ;
         "width" set
         cell "align" set
         [ swap <displaced-alien> ] "getter" set
-    ]
-    "struct-name" get define-c-type
+    ] "struct-name" get define-c-type
     "struct-name" get "in" get init-c-type ;
index 30ff1f35113796468ae9e52e363dfbf1670f3078..7ef9aebe8b831cf2fcafed954bf1996e2ebed599 100644 (file)
@@ -17,7 +17,7 @@ sequences io vectors words ;
         boot
     ] %
 
-    {
+    @{
         "/version.factor"
 
         "/library/generic/early-generic.factor"
@@ -150,7 +150,7 @@ sequences io vectors words ;
         "/library/cli.factor"
         
         "/library/bootstrap/init.factor"
-    } [ dup print parse-resource % ] each
+    }@ [ dup print parse-resource % ] each
     
     [ "/library/bootstrap/boot-stage2.factor" run-resource ] %
 ] [ ] make
index 789eb809115d45c2daddcedecfefcc9b367340e4..6b32bb6c957fb483e6bf32ecdd1c416a74009e0f 100644 (file)
@@ -41,12 +41,12 @@ parse-command-line
 compile? [\r
     "Compiling base..." print\r
 \r
-    {\r
+    @{\r
         uncons 1+ 1- + <= > >= mod length\r
         nth-unsafe set-nth-unsafe\r
         = string>number number>string scan solve-recursion\r
         kill-set kill-node (generate)\r
-    } [ compile ] each\r
+    }@ [ compile ] each\r
 ] when\r
 \r
 compile? [\r
@@ -80,10 +80,13 @@ compile? [
     0 exit\r
 ] set-boot\r
 \r
-0 [ compiled? [ 1+ ] when ] each-word\r
-number>string write " words compiled" print\r
+all-words [ compiled? ] subset length\r
+number>string write " compiled words" print\r
 \r
-0 [ drop 1+ ] each-word\r
+all-words [ symbol? ] subset length\r
+number>string write " symbol words" print\r
+\r
+all-words length\r
 number>string write " words total" print \r
 \r
 "Total bootstrap GC time: " write gc-time\r
index 5b472b226f95ddf8276990f21ca00f789a4b100e..0e65b31fdcccdc6d3bf201cd46cd220a6c40e125 100644 (file)
@@ -123,7 +123,7 @@ M: fixnum ' ( n -- tagged ) fixnum-tag immediate ;
 
 : bignum>seq ( n -- seq )
     #! n is positive or zero.
-    [ (bignum>seq) ] { } make ;
+    [ (bignum>seq) ] @{ }@ make ;
 
 : emit-bignum ( n -- )
     [ 0 < 1 0 ? ] keep abs bignum>seq
@@ -285,7 +285,7 @@ M: hashtable ' ( hashtable -- pointer )
 
 : global, ( -- )
     [
-        { vocabularies typemap builtins } [ [ ] change ] each
+        @{ vocabularies typemap builtins }@ [ [ ] change ] each
     ] make-hash '
     global-offset fixup ;
 
index a3f168eec888736df8828d7252dd10d13ad1621c..a7de5bfda9a262e68c13fabe59086a33bb8c00fc 100644 (file)
@@ -12,7 +12,7 @@ words ;
 
 ! These symbols need the same hashcode in the target as in the
 ! host.
-{ vocabularies typemap builtins }
+@{ vocabularies typemap builtins }@
 
 ! Bring up a bare cross-compiling vocabulary.
 "syntax" vocab
@@ -22,224 +22,224 @@ f crossref set
 
 vocabularies get [ "syntax" set [ reveal ] each ] bind
 
-: make-primitive ( { vocab word } n -- )
+: make-primitive ( @{ vocab word }@ n -- )
     >r first2 create r> f define ;
 
-{
-    { "execute" "words"                     }
-    { "call" "kernel"                       }
-    { "if" "kernel"                         }
-    { "dispatch" "kernel-internals"         }
-    { "cons" "lists"                        }
-    { "<vector>" "vectors"                  }
-    { "rehash-string" "strings"             }
-    { "<sbuf>" "strings"                    }
-    { "sbuf>string" "strings"               }
-    { ">fixnum" "math"                      }
-    { ">bignum" "math"                      }
-    { ">float" "math"                       }
-    { "(fraction>)" "math-internals"        }
-    { "string>float" "math-internals"       }
-    { "float>string" "math-internals"       }
-    { "float>bits" "math"                   }
-    { "double>bits" "math"                  }
-    { "bits>float" "math"                   }
-    { "bits>double" "math"                  }
-    { "<complex>" "math-internals"          }
-    { "fixnum+" "math-internals"            }
-    { "fixnum-" "math-internals"            }
-    { "fixnum*" "math-internals"            }
-    { "fixnum/i" "math-internals"           }
-    { "fixnum/f" "math-internals"           }
-    { "fixnum-mod" "math-internals"         }
-    { "fixnum/mod" "math-internals"         }
-    { "fixnum-bitand" "math-internals"      }
-    { "fixnum-bitor" "math-internals"       }
-    { "fixnum-bitxor" "math-internals"      }
-    { "fixnum-bitnot" "math-internals"      }
-    { "fixnum-shift" "math-internals"       }
-    { "fixnum<" "math-internals"            }
-    { "fixnum<=" "math-internals"           }
-    { "fixnum>" "math-internals"            }
-    { "fixnum>=" "math-internals"           }
-    { "bignum=" "math-internals"            }
-    { "bignum+" "math-internals"            }
-    { "bignum-" "math-internals"            }
-    { "bignum*" "math-internals"            }
-    { "bignum/i" "math-internals"           }
-    { "bignum/f" "math-internals"           }
-    { "bignum-mod" "math-internals"         }
-    { "bignum/mod" "math-internals"         }
-    { "bignum-bitand" "math-internals"      }
-    { "bignum-bitor" "math-internals"       }
-    { "bignum-bitxor" "math-internals"      }
-    { "bignum-bitnot" "math-internals"      }
-    { "bignum-shift" "math-internals"       }
-    { "bignum<" "math-internals"            }
-    { "bignum<=" "math-internals"           }
-    { "bignum>" "math-internals"            }
-    { "bignum>=" "math-internals"           }
-    { "float=" "math-internals"             }
-    { "float+" "math-internals"             }
-    { "float-" "math-internals"             }
-    { "float*" "math-internals"             }
-    { "float/f" "math-internals"            }
-    { "float<" "math-internals"             }
-    { "float<=" "math-internals"            }
-    { "float>" "math-internals"             }
-    { "float>=" "math-internals"            }
-    { "facos" "math-internals"              }
-    { "fasin" "math-internals"              }
-    { "fatan" "math-internals"              }
-    { "fatan2" "math-internals"             }
-    { "fcos" "math-internals"               }
-    { "fexp" "math-internals"               }
-    { "fcosh" "math-internals"              }
-    { "flog" "math-internals"               }
-    { "fpow" "math-internals"               }
-    { "fsin" "math-internals"               }
-    { "fsinh" "math-internals"              }
-    { "fsqrt" "math-internals"              }
-    { "<word>" "words"                      }
-    { "update-xt" "words"                   }
-    { "compiled?" "words"                   }
-    { "drop" "kernel"                       }
-    { "2drop" "kernel"                      }
-    { "3drop" "kernel"                      }
-    { "dup" "kernel"                        }
-    { "2dup" "kernel"                       }
-    { "3dup" "kernel"                       }
-    { "rot" "kernel"                        }
-    { "-rot" "kernel"                       }
-    { "dupd" "kernel"                       }
-    { "swapd" "kernel"                      }
-    { "nip" "kernel"                        }
-    { "2nip" "kernel"                       }
-    { "tuck" "kernel"                       }
-    { "over" "kernel"                       }
-    { "pick" "kernel"                       }
-    { "swap" "kernel"                       }
-    { ">r" "kernel"                         }
-    { "r>" "kernel"                         }
-    { "eq?" "kernel"                        }
-    { "getenv" "kernel-internals"           }
-    { "setenv" "kernel-internals"           }
-    { "stat" "io"                           }
-    { "(directory)" "io"                    }
-    { "gc" "memory"                         }
-    { "gc-time" "memory"                    }
-    { "save-image" "memory"                 }
-    { "datastack" "kernel"                  }
-    { "callstack" "kernel"                  }
-    { "set-datastack" "kernel"              }
-    { "set-callstack" "kernel"              }
-    { "exit" "kernel"                       }
-    { "room" "memory"                       }
-    { "os-env" "kernel"                     }
-    { "millis" "kernel"                     }
-    { "type" "kernel"                       }
-    { "tag" "kernel-internals"              }
-    { "cwd" "io"                            }
-    { "cd" "io"                             }
-    { "compiled-offset" "assembler"         }
-    { "set-compiled-offset" "assembler"     }
-    { "literal-top" "assembler"             }
-    { "set-literal-top" "assembler"         }
-    { "address" "memory"                    }
-    { "dlopen" "alien"                      }
-    { "dlsym" "alien"                       }
-    { "dlclose" "alien"                     }
-    { "<alien>" "alien"                     }
-    { "<byte-array>" "arrays"               }
-    { "<displaced-alien>" "alien"           }
-    { "alien-signed-cell" "alien"           }
-    { "set-alien-signed-cell" "alien"       }
-    { "alien-unsigned-cell" "alien"         }
-    { "set-alien-unsigned-cell" "alien"     }
-    { "alien-signed-8" "alien"              }
-    { "set-alien-signed-8" "alien"          }
-    { "alien-unsigned-8" "alien"            }
-    { "set-alien-unsigned-8" "alien"        }
-    { "alien-signed-4" "alien"              }
-    { "set-alien-signed-4" "alien"          }
-    { "alien-unsigned-4" "alien"            }
-    { "set-alien-unsigned-4" "alien"        }
-    { "alien-signed-2" "alien"              }
-    { "set-alien-signed-2" "alien"          }
-    { "alien-unsigned-2" "alien"            }
-    { "set-alien-unsigned-2" "alien"        }
-    { "alien-signed-1" "alien"              }
-    { "set-alien-signed-1" "alien"          }
-    { "alien-unsigned-1" "alien"            }
-    { "set-alien-unsigned-1" "alien"        }
-    { "alien-float" "alien"                 }
-    { "set-alien-float" "alien"             }
-    { "alien-double" "alien"                }
-    { "set-alien-double" "alien"            }
-    { "alien-c-string" "alien"              }
-    { "set-alien-c-string" "alien"          }
-    { "throw" "errors"                      }
-    { "string>memory" "kernel-internals"    }
-    { "memory>string" "kernel-internals"    }
-    { "alien-address" "alien"               }
-    { "slot" "kernel-internals"             }
-    { "set-slot" "kernel-internals"         }
-    { "integer-slot" "kernel-internals"     }
-    { "set-integer-slot" "kernel-internals" }
-    { "char-slot" "kernel-internals"        }
-    { "set-char-slot" "kernel-internals"    }
-    { "resize-array" "arrays"               }
-    { "resize-string" "strings"             }
-    { "<hashtable>" "hashtables"            }
-    { "<array>" "arrays"                    }
-    { "<tuple>" "kernel-internals"          }
-    { "begin-scan" "memory"                 }
-    { "next-object" "memory"                }
-    { "end-scan" "memory"                   }
-    { "size" "memory"                       }
-    { "die" "kernel"                        }
-    { "flush-icache" "assembler"            }
-    { "fopen"  "io-internals"               }
-    { "fgetc" "io-internals"                }
-    { "fwrite" "io-internals"               }
-    { "fflush" "io-internals"               }
-    { "fclose" "io-internals"               }
-    { "expired?" "alien"                    }
-    { "<wrapper>" "kernel"                  }
-    { "(clone)" "kernel-internals"          }
-    { "(array>tuple)" "kernel-internals"    }
-    { "tuple>array" "generic"               }
-    { "array>vector" "vectors"              }
-} dup length 3 swap [ + ] map-with [ make-primitive ] 2each
-
-: set-stack-effect ( { vocab word effect } -- )
+@{
+    @{ "execute" "words"                     }@
+    @{ "call" "kernel"                       }@
+    @{ "if" "kernel"                         }@
+    @{ "dispatch" "kernel-internals"         }@
+    @{ "cons" "lists"                        }@
+    @{ "<vector>" "vectors"                  }@
+    @{ "rehash-string" "strings"             }@
+    @{ "<sbuf>" "strings"                    }@
+    @{ "sbuf>string" "strings"               }@
+    @{ ">fixnum" "math"                      }@
+    @{ ">bignum" "math"                      }@
+    @{ ">float" "math"                       }@
+    @{ "(fraction>)" "math-internals"        }@
+    @{ "string>float" "math-internals"       }@
+    @{ "float>string" "math-internals"       }@
+    @{ "float>bits" "math"                   }@
+    @{ "double>bits" "math"                  }@
+    @{ "bits>float" "math"                   }@
+    @{ "bits>double" "math"                  }@
+    @{ "<complex>" "math-internals"          }@
+    @{ "fixnum+" "math-internals"            }@
+    @{ "fixnum-" "math-internals"            }@
+    @{ "fixnum*" "math-internals"            }@
+    @{ "fixnum/i" "math-internals"           }@
+    @{ "fixnum/f" "math-internals"           }@
+    @{ "fixnum-mod" "math-internals"         }@
+    @{ "fixnum/mod" "math-internals"         }@
+    @{ "fixnum-bitand" "math-internals"      }@
+    @{ "fixnum-bitor" "math-internals"       }@
+    @{ "fixnum-bitxor" "math-internals"      }@
+    @{ "fixnum-bitnot" "math-internals"      }@
+    @{ "fixnum-shift" "math-internals"       }@
+    @{ "fixnum<" "math-internals"            }@
+    @{ "fixnum<=" "math-internals"           }@
+    @{ "fixnum>" "math-internals"            }@
+    @{ "fixnum>=" "math-internals"           }@
+    @{ "bignum=" "math-internals"            }@
+    @{ "bignum+" "math-internals"            }@
+    @{ "bignum-" "math-internals"            }@
+    @{ "bignum*" "math-internals"            }@
+    @{ "bignum/i" "math-internals"           }@
+    @{ "bignum/f" "math-internals"           }@
+    @{ "bignum-mod" "math-internals"         }@
+    @{ "bignum/mod" "math-internals"         }@
+    @{ "bignum-bitand" "math-internals"      }@
+    @{ "bignum-bitor" "math-internals"       }@
+    @{ "bignum-bitxor" "math-internals"      }@
+    @{ "bignum-bitnot" "math-internals"      }@
+    @{ "bignum-shift" "math-internals"       }@
+    @{ "bignum<" "math-internals"            }@
+    @{ "bignum<=" "math-internals"           }@
+    @{ "bignum>" "math-internals"            }@
+    @{ "bignum>=" "math-internals"           }@
+    @{ "float=" "math-internals"             }@
+    @{ "float+" "math-internals"             }@
+    @{ "float-" "math-internals"             }@
+    @{ "float*" "math-internals"             }@
+    @{ "float/f" "math-internals"            }@
+    @{ "float<" "math-internals"             }@
+    @{ "float<=" "math-internals"            }@
+    @{ "float>" "math-internals"             }@
+    @{ "float>=" "math-internals"            }@
+    @{ "facos" "math-internals"              }@
+    @{ "fasin" "math-internals"              }@
+    @{ "fatan" "math-internals"              }@
+    @{ "fatan2" "math-internals"             }@
+    @{ "fcos" "math-internals"               }@
+    @{ "fexp" "math-internals"               }@
+    @{ "fcosh" "math-internals"              }@
+    @{ "flog" "math-internals"               }@
+    @{ "fpow" "math-internals"               }@
+    @{ "fsin" "math-internals"               }@
+    @{ "fsinh" "math-internals"              }@
+    @{ "fsqrt" "math-internals"              }@
+    @{ "<word>" "words"                      }@
+    @{ "update-xt" "words"                   }@
+    @{ "compiled?" "words"                   }@
+    @{ "drop" "kernel"                       }@
+    @{ "2drop" "kernel"                      }@
+    @{ "3drop" "kernel"                      }@
+    @{ "dup" "kernel"                        }@
+    @{ "2dup" "kernel"                       }@
+    @{ "3dup" "kernel"                       }@
+    @{ "rot" "kernel"                        }@
+    @{ "-rot" "kernel"                       }@
+    @{ "dupd" "kernel"                       }@
+    @{ "swapd" "kernel"                      }@
+    @{ "nip" "kernel"                        }@
+    @{ "2nip" "kernel"                       }@
+    @{ "tuck" "kernel"                       }@
+    @{ "over" "kernel"                       }@
+    @{ "pick" "kernel"                       }@
+    @{ "swap" "kernel"                       }@
+    @{ ">r" "kernel"                         }@
+    @{ "r>" "kernel"                         }@
+    @{ "eq?" "kernel"                        }@
+    @{ "getenv" "kernel-internals"           }@
+    @{ "setenv" "kernel-internals"           }@
+    @{ "stat" "io"                           }@
+    @{ "(directory)" "io"                    }@
+    @{ "gc" "memory"                         }@
+    @{ "gc-time" "memory"                    }@
+    @{ "save-image" "memory"                 }@
+    @{ "datastack" "kernel"                  }@
+    @{ "callstack" "kernel"                  }@
+    @{ "set-datastack" "kernel"              }@
+    @{ "set-callstack" "kernel"              }@
+    @{ "exit" "kernel"                       }@
+    @{ "room" "memory"                       }@
+    @{ "os-env" "kernel"                     }@
+    @{ "millis" "kernel"                     }@
+    @{ "type" "kernel"                       }@
+    @{ "tag" "kernel-internals"              }@
+    @{ "cwd" "io"                            }@
+    @{ "cd" "io"                             }@
+    @{ "compiled-offset" "assembler"         }@
+    @{ "set-compiled-offset" "assembler"     }@
+    @{ "literal-top" "assembler"             }@
+    @{ "set-literal-top" "assembler"         }@
+    @{ "address" "memory"                    }@
+    @{ "dlopen" "alien"                      }@
+    @{ "dlsym" "alien"                       }@
+    @{ "dlclose" "alien"                     }@
+    @{ "<alien>" "alien"                     }@
+    @{ "<byte-array>" "arrays"               }@
+    @{ "<displaced-alien>" "alien"           }@
+    @{ "alien-signed-cell" "alien"           }@
+    @{ "set-alien-signed-cell" "alien"       }@
+    @{ "alien-unsigned-cell" "alien"         }@
+    @{ "set-alien-unsigned-cell" "alien"     }@
+    @{ "alien-signed-8" "alien"              }@
+    @{ "set-alien-signed-8" "alien"          }@
+    @{ "alien-unsigned-8" "alien"            }@
+    @{ "set-alien-unsigned-8" "alien"        }@
+    @{ "alien-signed-4" "alien"              }@
+    @{ "set-alien-signed-4" "alien"          }@
+    @{ "alien-unsigned-4" "alien"            }@
+    @{ "set-alien-unsigned-4" "alien"        }@
+    @{ "alien-signed-2" "alien"              }@
+    @{ "set-alien-signed-2" "alien"          }@
+    @{ "alien-unsigned-2" "alien"            }@
+    @{ "set-alien-unsigned-2" "alien"        }@
+    @{ "alien-signed-1" "alien"              }@
+    @{ "set-alien-signed-1" "alien"          }@
+    @{ "alien-unsigned-1" "alien"            }@
+    @{ "set-alien-unsigned-1" "alien"        }@
+    @{ "alien-float" "alien"                 }@
+    @{ "set-alien-float" "alien"             }@
+    @{ "alien-double" "alien"                }@
+    @{ "set-alien-double" "alien"            }@
+    @{ "alien-c-string" "alien"              }@
+    @{ "set-alien-c-string" "alien"          }@
+    @{ "throw" "errors"                      }@
+    @{ "string>memory" "kernel-internals"    }@
+    @{ "memory>string" "kernel-internals"    }@
+    @{ "alien-address" "alien"               }@
+    @{ "slot" "kernel-internals"             }@
+    @{ "set-slot" "kernel-internals"         }@
+    @{ "integer-slot" "kernel-internals"     }@
+    @{ "set-integer-slot" "kernel-internals" }@
+    @{ "char-slot" "kernel-internals"        }@
+    @{ "set-char-slot" "kernel-internals"    }@
+    @{ "resize-array" "arrays"               }@
+    @{ "resize-string" "strings"             }@
+    @{ "<hashtable>" "hashtables"            }@
+    @{ "<array>" "arrays"                    }@
+    @{ "<tuple>" "kernel-internals"          }@
+    @{ "begin-scan" "memory"                 }@
+    @{ "next-object" "memory"                }@
+    @{ "end-scan" "memory"                   }@
+    @{ "size" "memory"                       }@
+    @{ "die" "kernel"                        }@
+    @{ "flush-icache" "assembler"            }@
+    @{ "fopen"  "io-internals"               }@
+    @{ "fgetc" "io-internals"                }@
+    @{ "fwrite" "io-internals"               }@
+    @{ "fflush" "io-internals"               }@
+    @{ "fclose" "io-internals"               }@
+    @{ "expired?" "alien"                    }@
+    @{ "<wrapper>" "kernel"                  }@
+    @{ "(clone)" "kernel-internals"          }@
+    @{ "(array>tuple)" "kernel-internals"    }@
+    @{ "tuple>array" "generic"               }@
+    @{ "array>vector" "vectors"              }@
+}@ dup length 3 swap [ + ] map-with [ make-primitive ] 2each
+
+: set-stack-effect ( @{ vocab word effect }@ -- )
     first3 >r lookup r> "stack-effect" set-word-prop ;
 
-{
-    { "drop" "kernel" " x -- " }
-    { "2drop" "kernel" " x y -- " }
-    { "3drop" "kernel" " x y z -- " }
-    { "dup" "kernel"  " x -- x x " }
-    { "2dup" "kernel"  " x y -- x y x y " }
-    { "3dup" "kernel"  " x y z -- x y z x y z " }
-    { "rot" "kernel"  " x y z -- y z x " }
-    { "-rot" "kernel"  " x y z -- z x y " }
-    { "dupd" "kernel"  " x y -- x x y " }
-    { "swapd" "kernel"  " x y z -- y x z " }
-    { "nip" "kernel"  " x y -- y " }
-    { "2nip" "kernel"  " x y z -- z " }
-    { "tuck" "kernel"  " x y -- y x y " }
-    { "over" "kernel" " x y -- x y x " }
-    { "pick" "kernel" " x y z -- x y z x " }
-    { "swap" "kernel" " x y -- y x " }
-    { ">r" "kernel"   " x -- r: x " }
-    { "r>" "kernel"   " r: x -- x " }
-    { "datastack" "kernel" " -- ds " }
-    { "callstack" "kernel" " -- cs " }
-    { "set-datastack" "kernel" " ds -- " }
-    { "set-callstack" "kernel" " cs -- " }
-    { "flush-icache" "assembler" " -- " }
-} [
+@{
+    @{ "drop" "kernel" " x -- " }@
+    @{ "2drop" "kernel" " x y -- " }@
+    @{ "3drop" "kernel" " x y z -- " }@
+    @{ "dup" "kernel"  " x -- x x " }@
+    @{ "2dup" "kernel"  " x y -- x y x y " }@
+    @{ "3dup" "kernel"  " x y z -- x y z x y z " }@
+    @{ "rot" "kernel"  " x y z -- y z x " }@
+    @{ "-rot" "kernel"  " x y z -- z x y " }@
+    @{ "dupd" "kernel"  " x y -- x x y " }@
+    @{ "swapd" "kernel"  " x y z -- y x z " }@
+    @{ "nip" "kernel"  " x y -- y " }@
+    @{ "2nip" "kernel"  " x y z -- z " }@
+    @{ "tuck" "kernel"  " x y -- y x y " }@
+    @{ "over" "kernel" " x y -- x y x " }@
+    @{ "pick" "kernel" " x y z -- x y z x " }@
+    @{ "swap" "kernel" " x y -- y x " }@
+    @{ ">r" "kernel"   " x -- r: x " }@
+    @{ "r>" "kernel"   " r: x -- x " }@
+    @{ "datastack" "kernel" " -- ds " }@
+    @{ "callstack" "kernel" " -- cs " }@
+    @{ "set-datastack" "kernel" " ds -- " }@
+    @{ "set-callstack" "kernel" " cs -- " }@
+    @{ "flush-icache" "assembler" " -- " }@
+}@ [
     set-stack-effect
 ] each
 
@@ -275,101 +275,101 @@ num-types <array> builtins set
 "null" "generic" create drop
 
 "fixnum?" "math" create t "inline" set-word-prop
-"fixnum" "math" create 0 "fixnum?" "math" create { } define-builtin
+"fixnum" "math" create 0 "fixnum?" "math" create @{ }@ define-builtin
 "fixnum" "math" create 0 "math-priority" set-word-prop
 "fixnum" "math" create ">fixnum" [ "math" ] search unit "coercer" set-word-prop
 
 "bignum?" "math" create t "inline" set-word-prop
-"bignum" "math" create 1 "bignum?" "math" create { } define-builtin
+"bignum" "math" create 1 "bignum?" "math" create @{ }@ define-builtin
 "bignum" "math" create 1 "math-priority" set-word-prop
 "bignum" "math" create ">bignum" [ "math" ] search unit "coercer" set-word-prop
 
 "cons?" "lists" create t "inline" set-word-prop
 "cons" "lists" create 2 "cons?" "lists" create
-{ { 0 { "car" "lists" } f } { 1 { "cdr" "lists" } f } } define-builtin
+@{ @{ 0 @{ "car" "lists" }@ f }@ @{ 1 @{ "cdr" "lists" }@ f }@ }@ define-builtin
 
 "ratio?" "math" create t "inline" set-word-prop
 "ratio" "math" create 4 "ratio?" "math" create
-{ { 0 { "numerator" "math" } f } { 1 { "denominator" "math" } f } } define-builtin
+@{ @{ 0 @{ "numerator" "math" }@ f }@ @{ 1 @{ "denominator" "math" }@ f }@ }@ define-builtin
 "ratio" "math" create 2 "math-priority" set-word-prop
 
 "float?" "math" create t "inline" set-word-prop
-"float" "math" create 5 "float?" "math" create { } define-builtin
+"float" "math" create 5 "float?" "math" create @{ }@ define-builtin
 "float" "math" create 3 "math-priority" set-word-prop
 "float" "math" create ">float" [ "math" ] search unit "coercer" set-word-prop
 
 "complex?" "math" create t "inline" set-word-prop
 "complex" "math" create 6 "complex?" "math" create
-{ { 0 { "real" "math" } f } { 1 { "imaginary" "math" } f } } define-builtin
+@{ @{ 0 @{ "real" "math" }@ f }@ @{ 1 @{ "imaginary" "math" }@ f }@ }@ define-builtin
 "complex" "math" create 4 "math-priority" set-word-prop
 
-"displaced-alien" "alien" create 7 "displaced-alien?" "alien" create { } define-builtin
+"displaced-alien" "alien" create 7 "displaced-alien?" "alien" create @{ }@ define-builtin
 
 "array?" "arrays" create t "inline" set-word-prop
 "array" "arrays" create 8 "array?" "arrays" create
-{ } define-builtin
+@{ }@ define-builtin
 
 "f" "!syntax" create 9 "not" "kernel" create
-{ } define-builtin
+@{ }@ define-builtin
 
 "hashtable?" "hashtables" create t "inline" set-word-prop
 "hashtable" "hashtables" create 10 "hashtable?" "hashtables" create
-{
-    { 1 { "hash-size" "hashtables" } { "set-hash-size" "kernel-internals" } }
-    { 2 { "underlying" "sequences-internals" } { "set-underlying" "sequences-internals" } }
-} define-builtin
+@{
+    @{ 1 @{ "hash-size" "hashtables" }@ @{ "set-hash-size" "kernel-internals" }@ }@
+    @{ 2 @{ "underlying" "sequences-internals" }@ @{ "set-underlying" "sequences-internals" }@ }@
+}@ define-builtin
 
 "vector?" "vectors" create t "inline" set-word-prop
 "vector" "vectors" create 11 "vector?" "vectors" create
-{
-    { 1 { "length" "sequences" } { "set-fill" "sequences-internals" } }
-    { 2 { "underlying" "sequences-internals" } { "set-underlying" "sequences-internals" } }
-} define-builtin
+@{
+    @{ 1 @{ "length" "sequences" }@ @{ "set-fill" "sequences-internals" }@ }@
+    @{ 2 @{ "underlying" "sequences-internals" }@ @{ "set-underlying" "sequences-internals" }@ }@
+}@ define-builtin
 
 "string?" "strings" create t "inline" set-word-prop
 "string" "strings" create 12 "string?" "strings" create
-{
-    { 1 { "length" "sequences" } f }
-    { 2 { "hashcode" "kernel" } f }
-} define-builtin
+@{
+    @{ 1 @{ "length" "sequences" }@ f }@
+    @{ 2 @{ "hashcode" "kernel" }@ f }@
+}@ define-builtin
 
 "sbuf?" "strings" create t "inline" set-word-prop 
 "sbuf" "strings" create 13 "sbuf?" "strings" create
-{
-    { 1 { "length" "sequences" } { "set-fill" "sequences-internals" } }
-    { 2 { "underlying" "sequences-internals" } { "set-underlying" "sequences-internals" } }
-} define-builtin
+@{
+    @{ 1 @{ "length" "sequences" }@ @{ "set-fill" "sequences-internals" }@ }@
+    @{ 2 @{ "underlying" "sequences-internals" }@ @{ "set-underlying" "sequences-internals" }@ }@
+}@ define-builtin
 
 "wrapper?" "kernel" create t "inline" set-word-prop
 "wrapper" "kernel" create 14 "wrapper?" "kernel" create
-{ { 1 { "wrapped" "kernel" } f } } define-builtin
+@{ @{ 1 @{ "wrapped" "kernel" }@ f }@ }@ define-builtin
 
 "dll?" "alien" create t "inline" set-word-prop
 "dll" "alien" create 15 "dll?" "alien" create
-{ { 1 { "dll-path" "alien" } f } } define-builtin
+@{ @{ 1 @{ "dll-path" "alien" }@ f }@ }@ define-builtin
 
 "alien?" "alien" create t "inline" set-word-prop
-"alien" "alien" create 16 "alien?" "alien" create { } define-builtin
+"alien" "alien" create 16 "alien?" "alien" create @{ }@ define-builtin
 
 "word?" "words" create t "inline" set-word-prop
 "word" "words" create 17 "word?" "words" create
-{
-    { 1 { "hashcode" "kernel" } f }
-    { 2 { "word-name" "words" } f }
-    { 3 { "word-vocabulary" "words" } { "set-word-vocabulary" "words" } }
-    { 4 { "word-primitive" "words" } { "set-word-primitive" "words" } }
-    { 5 { "word-def" "words" } { "set-word-def" "words" } }
-    { 6 { "word-props" "words" } { "set-word-props" "words" } }
-} define-builtin
+@{
+    @{ 1 @{ "hashcode" "kernel" }@ f }@
+    @{ 2 @{ "word-name" "words" }@ f }@
+    @{ 3 @{ "word-vocabulary" "words" }@ @{ "set-word-vocabulary" "words" }@ }@
+    @{ 4 @{ "word-primitive" "words" }@ @{ "set-word-primitive" "words" }@ }@
+    @{ 5 @{ "word-def" "words" }@ @{ "set-word-def" "words" }@ }@
+    @{ 6 @{ "word-props" "words" }@ @{ "set-word-props" "words" }@ }@
+}@ define-builtin
 
 "tuple?" "kernel" create t "inline" set-word-prop
 "tuple" "kernel" create 18 "tuple?" "kernel" create
-{ } define-builtin
+@{ }@ define-builtin
 
 "byte-array?" "arrays" create t "inline" set-word-prop
 "byte-array" "arrays" create 19
 "byte-array?" "arrays" create
-{ } define-builtin
+@{ }@ define-builtin
 
 ! Define general-t type, which is any object that is not f.
 "general-t" "kernel" create dup define-symbol
index 5bc3f7d09c6fbb7f5a78faa205deb0dbbf22deef..c3b01bb48ef48bae9152620c4578a90b57511f47 100644 (file)
@@ -33,7 +33,7 @@ M: byte-array clone (clone) ;
 M: byte-array length array-capacity ;
 M: byte-array resize resize-array ;
 
-: 1array ( x -- { x } )
+: 1array ( x -- @{ x }@ )
     1 <array> [ 0 swap set-array-nth ] keep ; flushable
 
 : 2array ( x y -- @{ x y }@ )
index a9ae46921df3914926766ed9b07926ab9be00030..2e80236a53bd18f43142812827717fdaccb08f17 100644 (file)
@@ -21,13 +21,3 @@ IN: lists USING: kernel sequences ;
 : set-assoc ( value key alist -- alist )
     #! Adds the key/value pair to the alist.
     dupd remove-assoc acons ;
-
-: assoc-apply ( value-alist quot-alist -- )
-    #! Looks up the key of each pair in the first list in the
-    #! second list to produce a quotation. The quotation is
-    #! applied to the value of the pair. If there is no
-    #! corresponding quotation, the value is popped off the
-    #! stack.
-    swap [
-        unswons rot assoc* dup [ cdr call ] [ 2drop ] if
-    ] each-with ;
index 2d671047a066b4c3f266ed6fa32a7a02733cac1f..3600e34b339a4f345142efd3fae5b588b2edb6d1 100644 (file)
@@ -149,8 +149,8 @@ M: object find ( seq quot -- i elt )
     swap [ with rot ] subset 2nip ; inline
 
 : monotonic? ( seq quot -- ? | quot: elt elt -- ? )
-    #! Eg, { 1 2 3 4 } [ < ] monotonic? ==> t
-    #!     { 1 3 2 4 } [ < ] monotonic? ==> f
+    #! Eg, @{ 1 2 3 4 }@ [ < ] monotonic? ==> t
+    #!     @{ 1 3 2 4 }@ [ < ] monotonic? ==> f
     #! Don't use with lists.
     swap dup length 1- [
         pick pick >r >r (monotonic) r> r> rot
index 2e0700aa79ff657b25c253d4b00bf3fb7d849190..7e0f85ff86ab14e55f6df9ccca75a70d394ba2fe 100644 (file)
@@ -17,13 +17,13 @@ sequences strings vectors words ;
 
 IN: sequences
 
-: first2 ( { x y } -- x y )
+: first2 ( @{ x y }@ -- x y )
     1 swap bounds-check nip first2-unsafe ; inline
 
-: first3 ( { x y z } -- x y z )
+: first3 ( @{ x y z }@ -- x y z )
     2 swap bounds-check nip first3-unsafe ; inline
 
-: first4 ( { x y z w } -- x y z w )
+: first4 ( @{ x y z w }@ -- x y z w )
     3 swap bounds-check nip first4-unsafe ; inline
 
 M: object like drop ;
@@ -161,7 +161,7 @@ M: object reverse ( seq -- seq ) [ <reversed> ] keep like ;
 
 : flip ( seq -- seq )
     #! An example illustrates this word best:
-    #! { { 1 2 3 } { 4 5 6 } } ==> { { 1 4 } { 2 5 } { 3 6 } }
+    #! @{ @{ 1 2 3 }@ @{ 4 5 6 }@ }@ ==> @{ @{ 1 4 }@ @{ 2 5 }@ @{ 3 6 }@ }@
     dup empty? [
         dup first [ length ] keep like
         [ swap [ nth ] map-with ] map-with
@@ -177,7 +177,7 @@ IN: kernel
 
 : cond ( conditions -- )
     #! Conditions is a sequence of quotation pairs.
-    #! { { [ X ] [ Y ] } { [ Z ] [ T ] } }
+    #! @{ @{ [ X ] [ Y ] }@ @{ [ Z ] [ T ] }@ }@
     #! => X [ Y ] [ Z [ T ] [ ] if ] if
     #! The last condition should be a catch-all 't'.
     [ first call ] find nip dup
index b468cb32637e21374352e091ca44713e179bac24..bf573ba183340f767c484ce0570ed6a8383b2dec 100644 (file)
@@ -57,7 +57,7 @@ M: object tail ( index seq -- seq ) [ tail-slice ] keep like ;
         2dup head , dupd tail-slice (group)
     ] if ;
 
-: group ( n seq -- seq ) [ (group) ] { } make ; flushable
+: group ( n seq -- seq ) [ (group) ] @{ }@ make ; flushable
 
 : start-step ( subseq seq n -- subseq slice )
     pick length dupd + rot <slice> ;
index d60c7a78fdb1a684dd6bee07fff15ba0ab532f44..c37ac1e6f79b2f82c9aa2052008be3c30ed08641 100644 (file)
@@ -13,7 +13,7 @@ USING: arrays hashtables kernel lists math namespaces sequences ;
     ] if ;
 
 : split-blocks ( linear -- blocks )
-    [ 0 swap (split-blocks) ] { } make ;
+    [ 0 swap (split-blocks) ] @{ }@ make ;
 
 SYMBOL: d-height
 SYMBOL: r-height
@@ -145,7 +145,7 @@ M: %indirect trim-dead* ( tail vop -- ) ?dead-literal ;
         dup simplify-stack
         d-height get %inc-d r-height get %inc-r 2array append
         trim-dead
-    ] { } make ;
+    ] @{ }@ make ;
 
 : keep-simplifying ( block -- block )
     dup length >r simplify-block dup length r> =
index 7cb1888fcdfcfe16a10a37c11f44671b594e22ed..e3793bae48eccf8c6d9e395b5698271b3b502da4 100644 (file)
@@ -39,22 +39,3 @@ words ;
     ] [
         call
     ] if ;
-
-\ dataflow profile
-\ linearize profile
-\ split-blocks profile
-\ simplify profile
-\ keep-optimizing profile
-\ literals profile
-\ kill-set profile
-\ kill-node profile
-\ infer-classes profile
-\ solve-recursion profile
-\ post-inline profile
-\ compose-shuffle-nodes profile
-\ static-branch profile
-\ optimize-hooks profile
-\ partial-eval? profile
-\ partial-eval profile
-\ flip-branches profile
-\ apply-identities profile
index e87c76f9e8e97088bb3dcbbe54d5e9e365ae5a12..2b08dea1394e1fc01cf03ffc9cec96568de32aa2 100644 (file)
@@ -119,13 +119,13 @@ namespaces sequences words ;
     over binary-op-imm?
     [ binary-op-imm ] [ binary-op-reg ] if ;
 
-{
-    { fixnum+       %fixnum+       }
-    { fixnum-       %fixnum-       }
-    { fixnum-bitand %fixnum-bitand }
-    { fixnum-bitor  %fixnum-bitor  }
-    { fixnum-bitxor %fixnum-bitxor }
-} [
+@{
+    @{ fixnum+       %fixnum+       }@
+    @{ fixnum-       %fixnum-       }@
+    @{ fixnum-bitand %fixnum-bitand }@
+    @{ fixnum-bitor  %fixnum-bitor  }@
+    @{ fixnum-bitxor %fixnum-bitxor }@
+}@ [
     first2 [ binary-op ] curry "intrinsic" set-word-prop
 ] each
 
@@ -139,13 +139,13 @@ namespaces sequences words ;
     pick binary-op-imm?
     [ binary-jump-imm ] [ binary-jump-reg ] if ;
 
-{
-    { fixnum<= %jump-fixnum<= }
-    { fixnum<  %jump-fixnum<  }
-    { fixnum>= %jump-fixnum>= }
-    { fixnum>  %jump-fixnum>  }
-    { eq?      %jump-eq?      }
-} [
+@{
+    @{ fixnum<= %jump-fixnum<= }@
+    @{ fixnum<  %jump-fixnum<  }@
+    @{ fixnum>= %jump-fixnum>= }@
+    @{ fixnum>  %jump-fixnum>  }@
+    @{ eq?      %jump-eq?      }@
+}@ [
     first2 [ binary-jump ] curry "if-intrinsic" set-word-prop
 ] each
 
@@ -168,8 +168,8 @@ namespaces sequences words ;
     ! See the remark on fixnum-mod for vreg usage
     drop
     in-2
-    { << vreg f 1 >> << vreg f 0 >> }
-    { << vreg f 2 >> << vreg f 0 >> }
+    @{ << vreg f 1 >> << vreg f 0 >> }@
+    @{ << vreg f 2 >> << vreg f 0 >> }@
     %fixnum/mod ,
     << vreg f 2 >> 0 %replace-d ,
     << vreg f 0 >> 1 %replace-d ,
index b27fc4c274c7b8fa7305ab2539ec5f9120f2cec3..793924b86a71c8b0d19427db15b575a117809c12 100644 (file)
@@ -10,7 +10,7 @@ GENERIC: linearize* ( node -- )
     #! Transform dataflow IR into linear IR. This strips out
     #! stack flow information, and flattens conditionals into
     #! jumps and labels.
-    [ %prologue , linearize* ] { } make ;
+    [ %prologue , linearize* ] @{ }@ make ;
 
 : linearize-next node-successor linearize* ;
 
index e8466b21b97b7892f2f2427b65830f5ce0841d9a..d967962f6f75920636e6d3da7707ba9b409d3ee5 100644 (file)
@@ -18,7 +18,7 @@ USING: assembler compiler-backend kernel sequences ;
     #! Number of vregs
     3 ; inline
 
-M: vreg v>operand vreg-n { EAX ECX EDX } nth ;
+M: vreg v>operand vreg-n @{ EAX ECX EDX }@ nth ;
 
 ! On x86, parameters are never passed in registers.
 M: int-regs fastcall-regs drop 0 ;
index 47b70a50c761cc6dcd761a45aa67bd0cee25e94f..2f7c90801d5a479197481ee132e4cb722b5972ae 100644 (file)
@@ -19,15 +19,9 @@ SYMBOL: open-fonts
         {{ }} clone open-fonts set
     ] bind ;
 
-: free-dlists ( seq -- )
-    drop ;
-
-: free-textures ( seq -- )
-    drop ;
-
-: free-sprites ( glyphs -- )
-    dup [ sprite-dlist ] map free-dlists
-    [ sprite-texture ] map free-textures ;
+: free-sprite ( sprite -- )
+    dup sprite-dlist 1 glDeleteLists
+    sprite-texture <uint> 1 swap glDeleteTextures ;
 
 ! A font object from FreeType.
 ! the handle is an FT_Face.
@@ -38,7 +32,7 @@ M: font = eq? ;
 
 : flush-font ( font -- )
     #! Only do this after re-creating a GL context!
-    dup font-sprites [ ] subset free-sprites
+    dup font-sprites [ [ free-sprite ] when* ] each
     { } clone swap set-font-sprites ;
 
 : close-font ( font -- )
@@ -106,12 +100,12 @@ M: font = eq? ;
 C: font ( handle -- font )
     [ set-font-handle ] keep dup flush-font dup init-font ;
 
-: open-font ( { font style ptsize } -- font )
+: open-font ( @{ font style ptsize }@ -- font )
     #! Open a font and set the point size of the font.
     first3 >r open-face dup 0 r> 6 shift
     dpi dpi FT_Set_Char_Size freetype-error <font> ;
 
-: lookup-font ( { font style ptsize } -- font )
+: lookup-font ( @{ font style ptsize }@ -- font )
     #! Cache open fonts.
     open-fonts get [ open-font ] cache ;
 
index a4233c118ca7514af6b599c9067e7a63df270f0c..0e54eb6237d6e971ee89eaff77671fb5768fe658 100644 (file)
@@ -29,7 +29,7 @@ parser sequences strings words ;
 : define-slot ( class slot reader writer -- )
     >r >r 2dup r> define-reader r> define-writer ;
 
-: ?create ( { name vocab }/f -- word )
+: ?create ( @{ name vocab }@ -- word )
     dup [ first2 create ] when ;
 
 : intern-slots ( spec -- spec )
index e20edc7abf1a74a33b529978c5a5d01255cb08f8..983b998ff0d28c4974ebaab090349492ecbf5276 100644 (file)
@@ -42,8 +42,8 @@ M: general-list tutorial-line
     dup page-theme <border> ;\r
 \r
 : tutorial-pages\r
-    {\r
-        {\r
+    @{\r
+        @{\r
             "* Factor: a dynamic language"\r
             "--"\r
             "This series of slides presents a quick overview of Factor."\r
@@ -59,7 +59,7 @@ M: general-list tutorial-line
             "You can then press ENTER to execute the code, or edit it first."\r
             ""\r
             "http://factor.sourceforge.net"\r
-        } {\r
+        }@ @{\r
             "* The view from 10,000 feet"\r
             "--"\r
             "- Everything is an object"\r
@@ -68,7 +68,7 @@ M: general-list tutorial-line
             "- Words pass parameters on the stack"\r
             "- Code blocks can be passed as parameters to words"\r
             "- Word definitions are very short with very high code reuse"\r
-        } {\r
+        }@ @{\r
             "* Basic syntax"\r
             "--"\r
             "Factor code is made up of whitespace-speparated tokens."\r
@@ -79,7 +79,7 @@ M: general-list tutorial-line
             "The first token (\"hello world\") is a string."\r
             "The second token (print) is a word."\r
             "The string is pushed on the stack, and the print word prints it."\r
-        } {\r
+        }@ @{\r
             "* The stack"\r
             "--"\r
             "- The stack is like a pile of papers."\r
@@ -91,7 +91,7 @@ M: general-list tutorial-line
             [ "2 3 + ." ]\r
             ""\r
             "Try running it in the listener now."\r
-        } {\r
+        }@ @{\r
             "* Postfix arithmetic"\r
             "--"\r
             "What happened when you ran it?"\r
@@ -103,7 +103,7 @@ M: general-list tutorial-line
             "This is called postfix arithmetic."\r
             "Traditional arithmetic is called infix: 3 + (6 * 2)"\r
             "Lets translate this into postfix: 3 6 2 * + ."\r
-        } {\r
+        }@ @{\r
             "* Colon definitions"\r
             "--"\r
             "We can define new words in terms of existing words."\r
@@ -118,7 +118,7 @@ M: general-list tutorial-line
             "The result is the same as if you wrote:"\r
             ""\r
             [ "3 2 * 2 * ." ]\r
-        } {\r
+        }@ @{\r
             "* Stack effects"\r
             "--"\r
             "When we look at the definition of the ``twice'' word,"\r
@@ -133,7 +133,7 @@ M: general-list tutorial-line
             "The stack effect of twice is ( x -- 2*x )."\r
             "The stack effect of + is ( x y -- x+y )."\r
             "The stack effect of . is ( object -- )."\r
-        } {\r
+        }@ @{\r
             "* Reading user input"\r
             "--"\r
             "User input is read using the readln ( -- string ) word."\r
@@ -143,7 +143,7 @@ M: general-list tutorial-line
             ""\r
             [ "\"What is your name?\" print" ]\r
             [ "readln \"Hello, \" write print" ]\r
-        } {\r
+        }@ @{\r
             "* Shuffle words"\r
             "--"\r
             "The word ``twice'' we defined is useless."\r
@@ -156,7 +156,7 @@ M: general-list tutorial-line
             "However, we can use the word ``dup''. It has stack effect"\r
             "( object -- object object ), and it does exactly what we"\r
             "need. The ``dup'' word is known as a shuffle word."\r
-        } {\r
+        }@ @{\r
             "* The squared word"\r
             "--"\r
             "Try entering the following word definition:"\r
@@ -171,7 +171,7 @@ M: general-list tutorial-line
             "drop ( object -- )"\r
             "swap ( obj1 obj2 -- obj2 obj1 )"\r
             "over ( obj1 obj2 -- obj1 obj2 obj1 )"\r
-        } {\r
+        }@ @{\r
             "* Another shuffle example"\r
             "--"\r
             "Now let us write a word that negates a number."\r
@@ -186,7 +186,7 @@ M: general-list tutorial-line
             "So indeed, we can factor out the definition ``0 swap -'':"\r
             ""\r
             [ ": negate ( n -- -n ) 0 swap - ;" ]\r
-        } {\r
+        }@ @{\r
             "* Seeing words"\r
             "--"\r
             "If you have entered every definition in this tutorial,"\r
@@ -203,7 +203,7 @@ M: general-list tutorial-line
             ""\r
             "Prefixing a word with \\ pushes it on the stack, instead of"\r
             "executing it. So the see word has stack effect ( word -- )."\r
-        } {\r
+        }@ @{\r
             "* Branches"\r
             "--"\r
             "Now suppose we want to write a word that computes the"\r
@@ -219,7 +219,7 @@ M: general-list tutorial-line
             "In Factor, any object can be used as a truth value."\r
             "- The f object is false."\r
             "- Anything else is true."\r
-        } {\r
+        }@ @{\r
             "* More branches"\r
             "--"\r
             "On the previous slide, you saw the 'when' conditional:"\r
@@ -233,7 +233,7 @@ M: general-list tutorial-line
             "The 'if' conditional takes action on both branches:"\r
             ""\r
             [ "  ... condition ... [ ... ] [ ... ] if" ]\r
-        } {\r
+        }@ @{\r
             "* Combinators"\r
             "--"\r
             "if, when, unless are words that take lists of code as input."\r
@@ -247,7 +247,7 @@ M: general-list tutorial-line
             "Try this:"\r
             ""\r
             [ "10 [ \"Hello combinators\" print ] times" ]\r
-        } {\r
+        }@ @{\r
             "* Sequences"\r
             "--"\r
             "You have already seen strings, very briefly:"\r
@@ -257,13 +257,13 @@ M: general-list tutorial-line
             "Strings are part of a class of objects called sequences."\r
             "Two other types of sequences you will use a lot are:"\r
             ""\r
-            "  Lists: { 1 3 \"hi\" 10 2 }"\r
+            "  Lists: [ 1 3 \"hi\" 10 2 ]"\r
             "  Vectors: { \"the\" { \"quick\" \"brown\" } \"fox\" }"\r
             ""\r
             "As you can see in the second example, lists and vectors"\r
             "can contain any type of object, including other lists"\r
             "and vectors."\r
-        } {\r
+        }@ @{\r
             "* Sequences and combinators"\r
             "--"\r
             "A very useful combinator is each ( seq quot -- )."\r
@@ -282,7 +282,7 @@ M: general-list tutorial-line
             ""\r
             [ "{ 10 20 30 } [ 3 + ] map ." ]\r
             "==> { 13 23 33 }"\r
-        } {\r
+        }@ @{\r
             "* Numbers - integers and ratios"\r
             "--"\r
             "Factor's supports arbitrary-precision integers and ratios."\r
@@ -296,18 +296,7 @@ M: general-list tutorial-line
             ""\r
             "Rational numbers are added, multiplied and reduced to"\r
             "lowest terms in the same way you learned in grade school."\r
-        } {\r
-            "* Numbers - higher math"\r
-            "--"\r
-            [ "2 sqrt ." ]\r
-            ""\r
-            [ "-1 sqrt ." ]\r
-            ""\r
-            [ "{ { 10 3 } { 7 5 } { -2 0 } }" ]\r
-            [ "{ { 11 2 } { 4 8 } } m." ]\r
-            ""\r
-            "... and there is much more for the math geeks."\r
-        } {\r
+        }@ @{\r
             "* Object oriented programming"\r
             "--"\r
             "Each object belongs to a class."\r
@@ -322,7 +311,7 @@ M: general-list tutorial-line
             "Method definitions may appear in independent source files."\r
             ""\r
             "integer, string, object are built-in classes."\r
-        } {\r
+        }@ @{\r
             "* Defining new classes"\r
             "--"\r
             "New classes can be defined:"\r
@@ -337,7 +326,7 @@ M: general-list tutorial-line
             ""\r
             "Tuples support custom constructors, delegation..."\r
             "see the developer's handbook for details."\r
-        } {\r
+        }@ @{\r
             "* The library"\r
             "--"\r
             "Offers a good selection of highly-reusable words:"\r
@@ -352,7 +341,7 @@ M: general-list tutorial-line
             [ "\"sequences\" words ." ]\r
             "- To show a word definition:"\r
             [ "\\ reverse see" ]\r
-        } {\r
+        }@ @{\r
             "* Learning more"\r
             "--"\r
             "Hopefully this tutorial has sparked your interest in Factor."\r
@@ -363,8 +352,8 @@ M: general-list tutorial-line
             ""\r
             "Also, point your IRC client to irc.freenode.net and hop in the"\r
             "#concatenative channel to chat with other Factor geeks."\r
-        }\r
-    } ;\r
+        }@\r
+    }@ ;\r
 \r
 : <tutorial> ( pages -- browser )\r
     tutorial-pages [ <page> ] map <book> <book-browser> ;\r
index 7a894c8688eaa780666fdb8db6c0d2e1b5b34d0a..8244fcee6096d24d39f27f98b7359a35b2f64124 100644 (file)
@@ -33,7 +33,7 @@ namespaces parser prettyprint sequences strings vectors words ;
     0 [ [ max ] when* ] reduce ;
 
 : unbalanced-branches ( in out -- )
-    { "Unbalanced branches:" } -rot [
+    @{ "Unbalanced branches:" }@ -rot [
         swap number>string " " rot length number>string
         append3
     ] 2map append "\n" join inference-error ;
index b770435b7684e9b70f8dd302ebb770b57e88c8be..acb7404e672b836d010a938feb5cb90f19246788 100644 (file)
@@ -13,7 +13,7 @@ math math-internals sequences words ;
     dup optimizer-hooks cond ;
 
 : define-optimizers ( word optimizers -- )
-    { [ t ] [ drop t ] } add "optimizer-hooks" set-word-prop ;
+    @{ [ t ] [ drop t ] }@ add "optimizer-hooks" set-word-prop ;
 
 : partial-eval? ( #call -- ? )
     dup node-param "foldable" word-prop [
@@ -49,18 +49,18 @@ math math-internals sequences words ;
     dup flip-subst node-successor dup
     dup node-children first2 swap 2array swap set-node-children ;
 
-\ not {
-    { [ dup node-successor #if? ] [ flip-branches ] }
-} define-optimizers
+\ not @{
+    @{ [ dup node-successor #if? ] [ flip-branches ] }@
+}@ define-optimizers
 
 : disjoint-eq? ( node -- ? )
     dup node-classes swap node-in-d
     [ swap ?hash ] map-with
     first2 2dup and [ classes-intersect? not ] [ 2drop f ] if ;
 
-\ eq? {
-    { [ dup disjoint-eq? ] [ [ f ] inline-literals ] }
-} define-optimizers
+\ eq? @{
+    @{ [ dup disjoint-eq? ] [ [ f ] inline-literals ] }@
+}@ define-optimizers
 
 ! Arithmetic identities
 SYMBOL: @
index 87a13b48228ec6a599ca0683b4361c07d221fad5..8d4619b28a50adc68288f35666aecd88b06e553c 100644 (file)
@@ -48,10 +48,10 @@ M: node = eq? ;
 : set-node-out-d node-shuffle set-shuffle-out-d ;
 : set-node-out-r node-shuffle set-shuffle-out-r ;
 
-: empty-node f { } { } { } { } ;
-: param-node ( label) { } { } { } { } ;
-: in-node ( inputs) >r f r> { } { } { } ;
-: out-node ( outputs) >r f { } r> { } { } ;
+: empty-node f @{ }@ @{ }@ @{ }@ @{ }@ ;
+: param-node ( label) @{ }@ @{ }@ @{ }@ @{ }@ ;
+: in-node ( inputs) >r f r> @{ }@ @{ }@ @{ }@ ;
+: out-node ( outputs) >r f @{ }@ r> @{ }@ @{ }@ ;
 
 : d-tail ( n -- list ) meta-d get tail* ;
 : r-tail ( n -- list ) meta-r get tail* ;
@@ -146,7 +146,7 @@ SYMBOL: current-node
     [
         dup node-in-d % dup node-out-d %
         dup node-in-r % node-out-r %
-    ] { } make ;
+    ] @{ }@ make ;
 
 : uses-value? ( value node -- ? ) node-values memq? ;
 
index eac15df788bc6a6969b3fcd7470d3a0c13e15cb8..d77962f2a369102ca0d17a13eeb059b4f5f1086e 100644 (file)
@@ -25,12 +25,12 @@ M: inference-error error. ( error -- )
     inference-error-rstate describe ;
 
 M: value literal-value ( value -- )
-    {
+    @{
         "A literal value was expected where a computed value was found.\n"
         "This means the word you are inferring applies 'call' or 'execute'\n"
         "to a value that is not known at compile time.\n"
         "See the handbook for details."
-    } concat inference-error ;
+    }@ concat inference-error ;
 
 ! Word properties that affect inference:
 ! - infer-effect -- must be set. controls number of inputs
index b4dcaa58d215df677f8d7dafa780a1267a24cd99..75407c586b8619443ceb8882205992fd0a9f9f74 100644 (file)
@@ -35,7 +35,7 @@ prettyprint ;
     dup "infer-effect" word-prop consume/produce
     [ [ t ] [ f ] if ] infer-quot ;
 
-{ fixnum<= fixnum< fixnum>= fixnum> eq? } [
+@{ fixnum<= fixnum< fixnum>= fixnum> eq? }@ [
     dup dup literalize [ manual-branch ] cons
     "infer" set-word-prop
 ] each
index 4a4fd51f27111b6e4e6170af37a2af23a325bacc..60018cf39d587f09804a8a3418f8444375ed2c58 100644 (file)
@@ -3,7 +3,7 @@ USING: hashtables kernel math namespaces sequences ;
 
 TUPLE: shuffle in-d in-r out-d out-r ;
 
-: empty-shuffle { } { } { } { } <shuffle> ;
+: empty-shuffle @{ }@ @{ }@ @{ }@ @{ }@ <shuffle> ;
 
 : cut* ( seq1 seq2 -- seq seq ) [ head* ] 2keep tail* ;
 
index 2b3fa38e14bec9fdc033cca762991ef265a30f7c..28257f7da8d7b0bf88453c86b482ed258a1c57c2 100644 (file)
@@ -29,23 +29,23 @@ sequences words ;
     [ shuffle>effect "infer-effect" set-word-prop ] 2keep
     [ , \ infer-shuffle , ] [ ] make "infer" set-word-prop ;
 
-{
-    { drop  << shuffle f 1 0 {             } {   } >> }
-    { 2drop << shuffle f 2 0 {             } {   } >> }
-    { 3drop << shuffle f 3 0 {             } {   } >> }
-    { dup   << shuffle f 1 0 { 0 0         } {   } >> }
-    { 2dup  << shuffle f 2 0 { 0 1 0 1     } {   } >> }
-    { 3dup  << shuffle f 3 0 { 0 1 2 0 1 2 } {   } >> }
-    { rot   << shuffle f 3 0 { 1 2 0       } {   } >> }
-    { -rot  << shuffle f 3 0 { 2 0 1       } {   } >> }
-    { dupd  << shuffle f 2 0 { 0 0 1       } {   } >> }
-    { swapd << shuffle f 3 0 { 1 0 2       } {   } >> }
-    { nip   << shuffle f 2 0 { 1           } {   } >> }
-    { 2nip  << shuffle f 3 0 { 2           } {   } >> }
-    { tuck  << shuffle f 2 0 { 1 0 1       } {   } >> }
-    { over  << shuffle f 2 0 { 0 1 0       } {   } >> }
-    { pick  << shuffle f 3 0 { 0 1 2 0     } {   } >> }
-    { swap  << shuffle f 2 0 { 1 0         } {   } >> }
-    { >r    << shuffle f 1 0 {             } { 0 } >> }
-    { r>    << shuffle f 0 1 { 0           } {   } >> }
-} [ first2 define-shuffle ] each
+@{
+    @{ drop  << shuffle f 1 0 @{             }@ @{   }@ >> }@
+    @{ 2drop << shuffle f 2 0 @{             }@ @{   }@ >> }@
+    @{ 3drop << shuffle f 3 0 @{             }@ @{   }@ >> }@
+    @{ dup   << shuffle f 1 0 @{ 0 0         }@ @{   }@ >> }@
+    @{ 2dup  << shuffle f 2 0 @{ 0 1 0 1     }@ @{   }@ >> }@
+    @{ 3dup  << shuffle f 3 0 @{ 0 1 2 0 1 2 }@ @{   }@ >> }@
+    @{ rot   << shuffle f 3 0 @{ 1 2 0       }@ @{   }@ >> }@
+    @{ -rot  << shuffle f 3 0 @{ 2 0 1       }@ @{   }@ >> }@
+    @{ dupd  << shuffle f 2 0 @{ 0 0 1       }@ @{   }@ >> }@
+    @{ swapd << shuffle f 3 0 @{ 1 0 2       }@ @{   }@ >> }@
+    @{ nip   << shuffle f 2 0 @{ 1           }@ @{   }@ >> }@
+    @{ 2nip  << shuffle f 3 0 @{ 2           }@ @{   }@ >> }@
+    @{ tuck  << shuffle f 2 0 @{ 1 0 1       }@ @{   }@ >> }@
+    @{ over  << shuffle f 2 0 @{ 0 1 0       }@ @{   }@ >> }@
+    @{ pick  << shuffle f 3 0 @{ 0 1 2 0     }@ @{   }@ >> }@
+    @{ swap  << shuffle f 2 0 @{ 1 0         }@ @{   }@ >> }@
+    @{ >r    << shuffle f 1 0 @{             }@ @{ 0 }@ >> }@
+    @{ r>    << shuffle f 0 1 @{ 0           }@ @{   }@ >> }@
+}@ [ first2 define-shuffle ] each
index 048549ec315d8ecce02a3c39e1cde3f527f4c8f6..fcddd3ea44fc0054453196a1103ae0adfe938885 100644 (file)
@@ -105,11 +105,11 @@ M: symbol apply-object ( word -- )
     [ inferring-base-case off ] cleanup ;
 
 : no-base-case ( word -- )
-    {
+    @{
         "The base case of a recursive word could not be inferred.\n"
         "This means the word calls itself in every control flow path.\n"
         "See the handbook for details."
-    } concat inference-error ;
+    }@ concat inference-error ;
 
 : notify-base-case ( -- )
     base-case-continuation get
index 0bb3278e6687fc66a8ae74ec340b0a3ad772eee3..0f721d16ef2aa20f7a651aaff25ac9be42fb6081 100644 (file)
@@ -3,7 +3,7 @@
 IN: opengl
 USING: alien errors kernel math namespaces opengl sdl sequences ;
 
-: gl-color ( { r g b a } -- ) first4 glColor4d ; inline
+: gl-color ( @{ r g b a }@ -- ) first4 glColor4d ; inline
 
 : init-gl ( -- )
     0.0 0.0 0.0 0.0 glClearColor 
@@ -62,7 +62,7 @@ USING: alien errors kernel math namespaces opengl sdl sequences ;
 : four-sides ( dim -- )
     dup top-left dup top-right dup bottom-right bottom-left ;
 
-: gl-line ( from to { r g b } -- )
+: gl-line ( from to color -- )
     gl-color [ gl-vertex ] 2apply ;
 
 : gl-fill-rect ( dim -- )
@@ -82,7 +82,7 @@ USING: alien errors kernel math namespaces opengl sdl sequences ;
     #! Draw a filled polygon.
     dup length 2 > GL_POLYGON GL_LINES ? (gl-poly) ;
 
-: gl-poly ( points { r g b } -- )
+: gl-poly ( points color -- )
     #! Draw a polygon.
     GL_LINE_LOOP (gl-poly) ;
 
@@ -149,7 +149,7 @@ C: sprite ( loc dim dim2 -- )
     GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP glTexParameterf
     GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP glTexParameterf ;
 
-: gl-translate ( { x y z } -- ) first3 glTranslatef ;
+: gl-translate ( @{ x y z }@ -- ) first3 glTranslatef ;
 
 : make-sprite-dlist ( sprite -- id )
     GL_MODELVIEW [
index dec169adb18ee68242c87a7978c327ed194d464d..e3efe0d1c0e933bf62f0eded08940b419067649d 100644 (file)
@@ -6,12 +6,12 @@ IN: sdl USING: namespaces ;
 ! Later, something better needs to be done.
 
 : modifiers
-    {
+    @{
         [[ "SHIFT" HEX: 0003 ]]
         [[ "CTRL"  HEX: 00c0 ]]
         [[ "ALT"   HEX: 0300 ]]
         [[ "META"  HEX: 0c00 ]]
-    } ;
+    }@ ;
 
 : keysyms
     {{
index dbb305488d032483c44943150a2b7d3f9170c3fe..fb8405cb62ad60c7268f4683d577d354af30545f 100644 (file)
@@ -27,7 +27,7 @@ global [
     0 column set
     0 indent set
     0 last-newline set
-    0 line-count set
+    1 line-count set
     string-limit off
 ] bind
 
@@ -43,13 +43,6 @@ C: section ( length -- section )
     [ set-section-start ] keep
     0 over set-section-indent ;
 
-: section-fits? ( section -- ? )
-    margin get dup 0 = [
-        2drop t
-    ] [
-        >r section-end last-newline get - indent get + r> <=
-    ] if ;
-
 : line-limit? ( -- ? )
     line-limit get dup [ line-count get <= ] when ;
 
@@ -61,8 +54,8 @@ C: section ( length -- section )
         drop
     ] [
         last-newline set
-        line-count inc
         line-limit? [ "..." write end-printing get continue ] when
+        line-count inc
         "\n" write do-indent
     ] if ;
 
@@ -109,6 +102,17 @@ C: block ( -- block )
     dup section-nl-after?
     [ section-end fresh-line ] [ drop ] if ;
 
+: section-fits? ( section -- ? )
+    margin get dup 0 = [
+        2drop t
+    ] [
+        line-limit? pick block? and [
+            2drop t
+        ] [
+            >r section-end last-newline get - indent get + r> <=
+        ] if
+    ] if ;
+
 : pprint-section ( section -- )
     dup section-fits?
     [ pprint-section* ] [ inset-section ] if ;
@@ -171,13 +175,13 @@ GENERIC: pprint* ( obj -- )
 
 : vocab-style ( vocab -- style )
     {{
-        [[ "syntax" [ [[ foreground [ 128 128 128 ] ]] ] ]]
-        [[ "kernel" [ [[ foreground [ 0 0 128 ] ]] ] ]]
-        [[ "sequences" [ [[ foreground [ 128 0 0 ] ]] ] ]]
-        [[ "math" [ [[ foreground [ 0 128 0 ] ]] ] ]]
-        [[ "math-internals" [ [[ foreground [ 192 0 0 ] ]] ] ]]
-        [[ "kernel-internals" [ [[ foreground [ 192 0 0 ] ]] ] ]]
-        [[ "io-internals" [ [[ foreground [ 192 0 0 ] ]] ] ]]
+        [[ "syntax" [ [[ foreground @{ 0.5 0.5 0.5 1.0 }@ ]] ] ]]
+        [[ "kernel" [ [[ foreground @{ 0.0 0.0 0.5 1.0 }@ ]] ] ]]
+        [[ "sequences" [ [[ foreground @{ 0.5 0.0 0.0 1.0 }@ ]] ] ]]
+        [[ "math" [ [[ foreground @{ 0.0 0.5 0.0 1.0 }@ ]] ] ]]
+        [[ "math-internals" [ [[ foreground @{ 0.75 0.0 0.0 1.0 }@ ]] ] ]]
+        [[ "kernel-internals" [ [[ foreground @{ 0.75 0.0 0.0 1.0 }@ ]] ] ]]
+        [[ "io-internals" [ [[ foreground @{ 0.75 0.0 0.0 1.0 }@ ]] ] ]]
     }} hash ;
 
 : word-style ( word -- style )
@@ -352,11 +356,11 @@ M: wrapper pprint* ( wrapper -- )
     #! Examples are ] } }} ]] >> and so on.
     t "pprint-close" set-word-prop ;
 
-{
-    { POSTPONE: [ POSTPONE: ] }
-    { POSTPONE: { POSTPONE: } }
-    { POSTPONE: @{ POSTPONE: }@ }
-    { POSTPONE: {{ POSTPONE: }} }
-    { POSTPONE: [[ POSTPONE: ]] }
-    { POSTPONE: [[ POSTPONE: ]] }
-} [ first2 define-close define-open ] each
+@{
+    @{ POSTPONE: [ POSTPONE: ] }@
+    @{ POSTPONE: { POSTPONE: } }@
+    @{ POSTPONE: @{ POSTPONE: }@ }@
+    @{ POSTPONE: {{ POSTPONE: }} }@
+    @{ POSTPONE: [[ POSTPONE: ]] }@
+    @{ POSTPONE: [[ POSTPONE: ]] }@
+}@ [ first2 define-close define-open ] each
index 15236162649ca506611734a6f33fe0f69f333f63..0ab5188fbdf354ba46dcf822d2669674320dc793 100644 (file)
@@ -73,7 +73,7 @@ unit-test
 
 [ f ] [ [ 0 10 "hello" subseq ] catch not ] unit-test
 
-[ { "hell" "o wo" "rld" } ] [ 4 "hello world" group ] unit-test
+[ @{ "hell" "o wo" "rld" }@ ] [ 4 "hello world" group ] unit-test
 
 [ 4 ] [
     0 "There are Four Upper Case characters"
index d147de9b708731a7fcad636ffd172bb547d550f4..c9be31b984734980a69e6db51894c7bc1a86c67b 100644 (file)
@@ -1,11 +1,8 @@
 IN: temporary
 USE: io
-USE: httpd
 USE: lists
 USE: test
 
 [ "txt" ] [ "foo.txt" file-extension ] unit-test
 [ f ] [ "foobar" file-extension ] unit-test
 [ "txt" ] [ "foo.bar.txt" file-extension ] unit-test
-[ "text/plain" ] [ "foo.bar.txt" mime-type ] unit-test
-[ "text/html" ] [ "index.html" mime-type ] unit-test
index d5448a8e8cae18472d9f48b83d2b786c749abb3e..bba6a3fab4f5d6ecfae841f61acd175eaec77e16 100644 (file)
@@ -4,28 +4,28 @@ USING: gadgets kernel namespaces test ;
 [
     << rect f @{ 10 10 0 }@ @{ 50 50 0 }@ >>
     << rect f @{ -10 -10 0 }@ @{ 40 40 0 }@ >>
-    intersect-rect
+    rect-intersect
 ] unit-test
 
 [ << rect f @{ 200 200 0 }@ @{ 0 0 0 }@ >> ]
 [
     << rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
     << rect f @{ 200 200 0 }@ @{ 40 40 0 }@ >>
-    intersect-rect
+    rect-intersect
 ] unit-test
 
 [ << rect f @{ -10 -10 0 }@ @{ 70 70 0 }@ >> ]
 [
     << rect f @{ 10 10 0 }@ @{ 50 50 0 }@ >>
     << rect f @{ -10 -10 0 }@ @{ 40 40 0 }@ >>
-    union-rect
+    rect-union
 ] unit-test
 
 [ << rect f @{ 100 100 0 }@ @{ 140 140 0 }@ >> ]
 [
     << rect f @{ 100 100 0 }@ @{ 50 50 0 }@ >>
     << rect f @{ 200 200 0 }@ @{ 40 40 0 }@ >>
-    union-rect
+    rect-union
 ] unit-test
 
 [ f ] [
index 5a7f85de0eae380cd5631c938536c2608e32d01e..77ae121ec67f96044902effef3dd95abc8fc1486 100644 (file)
@@ -28,16 +28,3 @@ USE: test
     [[ "two" 2 ]]
     [[ "four" 4 ]]
 ] "value-alist" set
-
-[
-    [ "one" + ]
-    [ "three" - ]
-    [ "four" * ]
-] "quot-alist" set
-
-[ 8 ] [ 1 "value-alist" get "quot-alist" get assoc-apply ] unit-test
-[ 1 ] [ 1 "value-alist" get f assoc-apply ] unit-test
-
-[ [ [ "one" + ] [ "four" * ] ] ] [
-    "three" "quot-alist" get remove-assoc
-] unit-test
index 8ab0b4cfff20706254c48a6cf329268754e38ef1..7759d459b43f31168da7af81a433bdb1ea0754e8 100644 (file)
@@ -60,8 +60,6 @@ USING: kernel math prettyprint test ;
 
 [ t ] [ 123 124 verify-gcd ] unit-test
 [ t ] [ 50 120 verify-gcd ] unit-test
-[ 3 ] [ 5 7 mod-inv ] unit-test
-[ 78572682077 ] [ 234829342 342389423843 mod-inv ] unit-test
 
 [ -1 ] [ -1 >bignum >fixnum ] unit-test
 
index 86eeba791f1fcc12ab1ce620cef6da58c874628a..2d992cfb8edf4c32b3b09e712b33607872629676 100644 (file)
@@ -73,7 +73,7 @@ SYMBOL: failures
     prepare-tests [ test ] subset terpri passed. failed. ;
 
 : tests
-    {
+    @{
         "lists/cons" "lists/lists" "lists/assoc"
         "lists/namespaces"
         "combinators"
@@ -94,24 +94,24 @@ SYMBOL: failures
         "gadgets/frames" "memory"
         "redefine" "annotate" "binary" "inspector"
         "kernel"
-    } run-tests ;
+    }@ run-tests ;
 
 : benchmarks
-    {
+    @{
         "benchmark/empty-loop" "benchmark/fac"
         "benchmark/fib" "benchmark/sort"
         "benchmark/continuations" "benchmark/ack"
         "benchmark/hashtables" "benchmark/strings"
         "benchmark/vectors" "benchmark/prettyprint"
         "benchmark/image"
-    } run-tests ;
+    }@ run-tests ;
 
 : compiler-tests
-    {
+    @{
         "io/buffer" "compiler/optimizer"
         "compiler/simple"
         "compiler/stack" "compiler/ifte"
         "compiler/generic" "compiler/bail-out"
         "compiler/linearizer" "compiler/intrinsics"
         "compiler/identities"
-    } run-tests ;
+    }@ run-tests ;
index 9a600c7ecece9fe0ab18ba96cf9cecebd4630fc3..ea3994a90ac1c2803f8921d0bba75fddcee1f6ef 100644 (file)
@@ -18,7 +18,7 @@ M: real summary
 
 M: complex summary
     "a complex number in the "
-    swap quadrant { "first" "second" "fourth" "third" } nth
+    swap quadrant @{ "first" "second" "fourth" "third" }@ nth
     " quadrant" append3 ;
 
 GENERIC: sheet ( obj -- sheet )
index e12b217018d401aa2c394c1d7e3eb425a955ea91..3a4b44ce0cafb72c2b56ca60d5a3ab855d496e93 100644 (file)
@@ -88,7 +88,7 @@ M: object each-slot ( obj quot -- )
     num-types zero-array num-types zero-array
     [ >r 2dup r> heap-stat-step ] each-object ;
 
-: heap-stat. ( { instances bytes type } -- )
+: heap-stat. ( @{ instances bytes type }@ -- )
     dup first 0 = [
         dup third type>class pprint ": " write
         dup second pprint " bytes, " write
index 2cd0130a9ad0d89c4bf9bf95f3970e1f350ec485..67ce604a64b48925bdc53bdc991907106a42f0b0 100644 (file)
@@ -15,7 +15,7 @@ prettyprint sequences io strings vectors words ;
 : meta-r*
     #! Stepper call stack, as well as the currently
     #! executing quotation.
-    [ meta-r get % meta-executing get , meta-cf get , ] { } make ;
+    [ meta-r get % meta-executing get , meta-cf get , ] @{ }@ make ;
 
 : &r
     #! Print stepper call stack, as well as the currently
index eb815e5d5361cdd56471acc16af08c9f1f7270bc..830d8bfacd6a1feaa2b6bbd54e9787395c2a3098 100644 (file)
@@ -44,7 +44,7 @@ TUPLE: book-browser book ;
         arrow-left   [ prev-page  ] <book-button> ,
         arrow-right  [ next-page  ] <book-button> ,
         arrow-right| [ last-page  ] <book-button> ,
-    ] { } make make-shelf ;
+    ] @{ }@ make make-shelf ;
 
 C: book-browser ( book -- gadget )
     dup delegate>frame
index 59d423dd42f82ff239cdbaa5351f22ffcd11d9c0..9344a7b9464d56d54bfd0a41eab9fa13bb400a7d 100644 (file)
@@ -47,7 +47,7 @@ M: command-button gadget-help ( button -- string )
     font-size swap assoc [ 12 ] unless* 3array ;
 
 : <styled-label> ( style text -- label )
-    <label> foreground pick assoc over set-label-text
+    <label> foreground pick assoc [ over set-label-color ] when*
     swap style-font over set-label-font ;
 
 : <presentation> ( style text -- presentation )
index 9a33bfb74bae4b53560f8c58a0111fe0d10f12d8..a4d45d403f9de9a51a90592d494623124177ab9e 100644 (file)
@@ -11,7 +11,7 @@ TUPLE: viewport ;
 ! The follows slot is set by scroll-to.
 TUPLE: scroller viewport x y follows ;
 
-: scroller-origin ( scroller -- { x y 0 } )
+: scroller-origin ( scroller -- @{ x y 0 }@ )
     dup scroller-x slider-value
     swap scroller-y slider-value
     0 3array ;
index fd35831888f63be4e08da73e88ab0adceb3fa1f0..4dd69af614b42450d7f5c03e389b14491e139bce 100644 (file)
@@ -46,12 +46,12 @@ C: splitter ( first second split vector -- splitter )
     dup splitter-split swap rect-dim
     n*v [ >fixnum ] map divider-size 1/2 v*n v- ;
 
-: splitter-layout ( splitter -- { a b c } )
+: splitter-layout ( splitter -- @{ a b c }@ )
     [
         dup splitter-part ,
         divider-size ,
         dup rect-dim divider-size v- swap splitter-part v- ,
-    ] { } make ;
+    ] @{ }@ make ;
 
 M: splitter layout* ( splitter -- )
     dup splitter-layout packed-layout ;
index d2718fa70d7982fca5d9cdf2dd2708f370c2839e..79777051fc630e606ee2df390b0b21673a66b501 100644 (file)
@@ -43,7 +43,7 @@ USING: arrays gadgets kernel sequences styles ;
     }@ >> ;
 
 : faint-boundary
-    << solid f @{ 0.62 0.62 0.62 1.0 }@ >> swap set-gadget-boundary ;
+    << solid f @{ 0.62 0.62 0.62 0.8 }@ >> swap set-gadget-boundary ;
 
 : bevel-button-theme ( gadget -- )
     plain-gradient rollover-gradient pressed-gradient
@@ -55,7 +55,7 @@ USING: arrays gadgets kernel sequences styles ;
 
 : roll-button-theme ( button -- )
     f solid-black solid-black <button-paint> over set-gadget-boundary
-    f f << solid f @{ 0.92 0.9 0.9 1.0 }@ >> <button-paint> swap set-gadget-interior ;
+    f f pressed-gradient <button-paint> swap set-gadget-interior ;
 
 : caret-theme ( caret -- )
     << solid f @{ 1.0 0.0 0.0 1.0 }@ >> swap set-gadget-interior ;
index cdbe276612638954b0195471b15cf54fcd492c45..8bf3c46ce4974c122605f47c47b41ca5ed19be0e 100644 (file)
@@ -50,7 +50,7 @@ SYMBOL: crossref
 : usages ( word -- deps )
     #! List all usages of a word. This is a transitive closure,
     #! so indirect usages are reported.
-    crossref get dup [ closure ] [ 2drop { } ] if ;
+    crossref get dup [ closure ] [ 2drop @{ }@ ] if ;
 
 : usage ( word -- list )
     #! List all direct usages of a word.
@@ -109,13 +109,13 @@ M: compound definer drop \ : ;
     [ f swap set-word-prop ] each-with ;
 
 : reset-word ( word -- )
-    {
+    @{
         "parsing" "inline" "foldable" "flushable" "predicating"
         "documentation" "stack-effect"
-    } reset-props ;
+    }@ reset-props ;
 
 : reset-generic ( word -- )
-    dup reset-word { "methods" "combination" } reset-props ;
+    dup reset-word @{ "methods" "combination" }@ reset-props ;
 
 M: word literalize <wrapper> ;