I'd better post here instead of the IRC so we get a more public discussion.
Background: I'm counting words in texts and storing them in idx lists where the word is the key and the count the value. When storing in the database somehow the value (count) gets lost and I have no idea why. In the real application the situation is more complex, but I've been able to isolate what is happening in this code: (class +Awords +Entity) (rel idx (+Key +Any)) (pool "tmp.db") (de countWords (L) (let Words NIL (for W (split L "," "." ";" ":" ")" "[" "]" "{" "}" "(" "/" "!" "?" "\"" "\\" "=" "+" "*" " " "|" "^M" "^J" "<" ">") (and (setq W (lowc (pack W))) (not (idx '*Common W)) (if (idx 'Words W T) (inc (car @)) (set W 1)))) Words )) (setq Wrds (chop "hello hello world apple orange strawberry apple hello")) (setq Widx (countWords Wrds)) (println (val (car (idx 'Widx "hello")))) (new! '(+Awords) 'idx Widx) (setq Wdb (; (car (collect 'idx '+Awords)) idx)) (println (val (car (idx 'Wdb "hello")))) The *Common global is an idx of common words I want to filter out, it can be disregarded in this example as it is not important to the issue at hand here. The code will work without it, we simply end up not filtering out any words at all. Output: 3 "hello" -> "hello" What I'm after in the end is of course the number 3, not "hello". Somehow I think there is something I haven't really understood here. Cheers, /Henrik ------=_Part_31993_13682467.1223103454766 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline <div dir="ltr">I'd better post here instead of the IRC so we get a more public discussion.<br><br>Background: I'm counting words in texts and storing them in idx lists where the word is the key and the count the value. When storing in the database somehow the value (count) gets lost and I have no idea why.<br> <br>In the real application the situation is more complex, but I've been able to isolate what is happening in this code:<br><br>(class +Awords +Entity)<br>(rel idx (+Key +Any))<br><br>(pool "tmp.db")<br><br> (de countWords (L)<br> (let Words NIL<br> (for W (split L "," "." ";" ":" ")" "[" "]" "{" "}" "(" "/" "!" "?" "\"" "\\" "=" "+" "*" " " "|" "^M" "^J" "<" ">")<br> (and <br> (setq W (lowc (pack W))) <br> (not (idx '*Common W)) <br> (if (idx 'Words W T)<br> (inc (car @))<br> (set W 1))))<br> Words ))<br> <br>(setq Wrds (chop "hello hello world apple orange strawberry apple hello"))<br>(setq Widx (countWords Wrds))<br><br>(println (val (car (idx 'Widx "hello"))))<br><br>(new! '(+Awords) 'idx Widx)<br> (setq Wdb (; (car (collect 'idx '+Awords)) idx))<br><br>(println (val (car (idx 'Wdb "hello"))))<br><br>The *Common global is an idx of common words I want to filter out, it can be disregarded in this example as it is not important to the issue at hand here. The code will work without it, we simply end up not filtering out any words at all.<br> <br>Output:<br>3<br>"hello"<br>-> "hello"<br><br>What I'm after in the end is of course the number 3, not "hello". Somehow I think there is something I haven't really understood here. <br> <br>Cheers,<br><br>/Henrik<br></div> ------=_Part_31993_13682467.1223103454766-- -- UNSUBSCRIBE: mailto:[EMAIL PROTECTED]