]> gitweb.factorcode.org Git - factor.git/blob - core/words/constant/constant.factor
Switch to https urls
[factor.git] / core / words / constant / constant.factor
1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: definitions kernel words ;
4 IN: words.constant
5
6 PREDICATE: constant < word "constant" word-prop >boolean ;
7
8 : define-constant ( word value -- )
9     [ drop t "constant" set-word-prop ]
10     [ [ ] curry ( -- value ) define-inline ] 2bi ;
11
12 M: constant reset-word
13     [ call-next-method ] [ "constant" remove-word-prop ] bi ;
14
15 M: constant definer drop \ CONSTANT: f ;