<commit_before>;------------------------------------------------------------------------------
;Copyright (c) 2012, <NAME> 
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL Joshua Scoggins BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Hint.clp - An object used to signify something is a hint. It also has the
; ability to be reference counted if necessary
;------------------------------------------------------------------------------
(defclass core::Hint 
  "An object that makes it easy to create temporary entities."
  (is-a Object)
  (multislot values (visibility public))
  (slot reference-count (type NUMBER) (visibility public))
  (slot type (visibility public) (type SYMBOL))
  (slot point (visibility public) (type SYMBOL)))
;------------------------------------------------------------------------------
(defmessage-handler core::Hint increment-reference-count primary ($?by)
"Incrementes the reference count of the given hint.  If no parameters are given 
then the default is one. If a parameter is given then that is the value 
incremented by. If more than one parameter is given then those numbers are 
added together and then added to the current reference count"
						  (bind ?len (length$ ?by))
						  (switch (length$ ?by)
									 (case 0 then 
										(bind ?self:reference-count 
												(+ 1 ?self:reference-count)))
									 (case 1 then 
										(bind ?self:reference-count 
										      (eval (format nil "(+ %i %i)", (first$ ?by)
														 ?self:reference-count))))
									 (default 
										(bind ?v (eval (format nil "(+ %s)" 
																	  (implode$ ?by))))
										(bind ?self:reference-count 
												(+ ?self:reference-count ?v)))))
;------------------------------------------------------------------------------
(defmessage-handler core::Hint decrement-reference-count 
"Decrements the reference count of the given hint.  If no parameters are given 
then the default is one. If a parameter is given then that is the value 
decremented by. If more than one parameter is given then those numbers are 
added together and then subtracted from the current reference count"
						  ($?by)
						  (bind ?len (length$ ?by))
						  (switch (length$ ?by)
									 (case 0 then 
										(bind ?self:reference-count 
												(- 1 ?self:reference-count)))
									 (case 1 then 
										(bind ?self:reference-count 
										      (eval (format nil "(- %i %i)" (first$ ?by)
														 ?self:reference-count))))
									 (default 
										;add all of the element together so that the
										;subtraction is correct
										(bind ?v (eval (format nil "(+ %s)" 
																	  (implode$ ?by))))
										(bind ?self:reference-count 
												(- ?self:reference-count ?v)))))
;------------------------------------------------------------------------------<commit_msg>Fixed a major logic bug in Hint.clp<commit_after>;------------------------------------------------------------------------------
;Copyright (c) 2012, <NAME> 
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * Redistributions in binary form must reproduce the above copyright
;      notice, this list of conditions and the following disclaimer in the
;      documentation and/or other materials provided with the distribution.
;    * Neither the name of <NAME> nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;DISCLAIMED. IN NO EVENT SHALL <NAME> BE LIABLE FOR ANY
;DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
;ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;------------------------------------------------------------------------------
; Hint.clp - An object used to signify something is a hint. It also has the
; ability to be reference counted if necessary
;------------------------------------------------------------------------------
(defclass core::Hint 
  "An object that makes it easy to create temporary entities."
  (is-a Object)
  (multislot values (visibility public))
  (slot reference-count (type NUMBER) (visibility public))
  (slot type (visibility public) (type SYMBOL))
  (slot point (visibility public) (type SYMBOL)))
;------------------------------------------------------------------------------
(defmessage-handler core::Hint increment-reference-count primary 
"Incrementes the reference count of the given hint.  If no parameters are given 
then the default is one. If a parameter is given then that is the value 
incremented by. If more than one parameter is given then those numbers are 
added together and then added to the current reference count"
                    ($?by)
                    (bind ?len (length$ ?by))
                    (switch (length$ ?by)
                            (case 0 then 
                              (bind ?self:reference-count 
                                    (+ 1 ?self:reference-count)))
                            (case 1 then 
                              (bind ?self:reference-count 
                                    (eval (format nil "(+ %i %i)", (first$ ?by)
                                                  ?self:reference-count))))
                            (default 
                              (bind ?v (eval (format nil "(+ %s)" 
                                                     (implode$ ?by))))
                              (bind ?self:reference-count 
                                    (+ ?self:reference-count ?v)))))
;------------------------------------------------------------------------------
(defmessage-handler core::Hint decrement-reference-count primary
"Decrements the reference count of the given hint.  If no parameters are given 
then the default is one. If a parameter is given then that is the value 
decremented by. If more than one parameter is given then those numbers are 
added together and then subtracted from the current reference count"
                    ($?by)
                    (bind ?len (length$ ?by))
                    (switch (length$ ?by)
                            (case 0 then 
                              (bind ?self:reference-count 
                                    (- ?self:reference-count 1)))
                            (case 1 then 
                              (bind ?self:reference-count 
                                    (eval (format nil "(- %i %i)" 
                                           ?self:reference-count
                                                  (first$ ?by)))))
                            (default 
                              ;add all of the element together so that the
                              ;subtraction is correct
                              (bind ?v (eval (format nil "(+ %s)" 
                                                     (implode$ ?by))))
                              (bind ?self:reference-count 
                                    (- ?self:reference-count ?v)))))
;------------------------------------------------------------------------------
{'fraction_non_alphanumeric': 0.1682032590051458, 'fraction_numerical': 0.002144082332761578, 'mean_word_length': 1.6080514397539838, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5197017', 'n_tokens_mistral': 2430, 'n_tokens_neox': 1986, 'n_words': 959}