World: r3wp
[Core] Discuss core issues
older newer | first last |
BrianH 9-Dec-2010 [641] | If it doesn't, this needs a ticket. There are other similar gob bugs (CHANGE comes to mind). |
Rebolek 9-Dec-2010 [642] | Does it work between different gobs? - no, it doesn't work between two gobs and it doesn't work for one gob (with sub gobs). |
BrianH 9-Dec-2010 [643] | Then we need a ticket for that. I would think that there would be some GUI reasons for doing SWAP, though more for doing MOVE. |
Steeve 9-Dec-2010 [644] | Well it' s a bad example, because >> swap g next g is easly performed with: >> insert g g/2 :-) |
Ladislav 9-Dec-2010 [645] | ?? >> g: [a b] == [a b] >> insert g g/2 == [a b] >> g == [b a b] |
BrianH 9-Dec-2010 [646] | I just checked, and all of the functions called by MOVE are compatible with gobs. If they behave in a similar way then we can add gob support to MOVE. |
Steeve 9-Dec-2010 [647] | working with gobs only |
Ladislav 9-Dec-2010 [648] | working with gobs only - isn't it a bug, then? |
Steeve 9-Dec-2010 [649x4] | No it's a feature |
A Gob can only have one parent at a time. | |
when you insert a gob already connected somewhere, it's automacly removed from the old place | |
Great feature | |
Rebolek 9-Dec-2010 [653x3] | hmmm |
Yes, I agree | |
Hm, I see that gob! now supports CHANGE and POKE, good news. | |
BrianH 9-Dec-2010 [656] | CHANGE doesn't work: http://curecode.org/rebol3/ticket.rsp?id=1789 |
Rebolek 9-Dec-2010 [657] | You're right. I remember it was throwing error, so I thought it's ok now with my quick test. |
GrahamC 9-Dec-2010 [658] | What's the technical explanation for this question/answer ? http://synapse-ehr.com/forums/showthread.php?151-Help-with-Script-error-Cannot-use-path-on-none! Is it the way Rebol evaluates as it builds functions? |
BrianH 9-Dec-2010 [659x2] | It looks like the code disconnects from the database and then tries to save to it without reconnecting. Beyond that I can't tell without knowing at which stage of the code the error is triggered. |
But it looks like the error is triggered before the SQL call, so it looks like either the db or counter variables are none. | |
GrahamC 9-Dec-2010 [661x3] | to me it looks like the code is breaking when first executed |
so, it creates an empty db, so db/1 will be an empty block | |
My question is .. what does rebol do when it builds a function from the function definition | |
BrianH 9-Dec-2010 [664] | There is nothing special there related to the function definition. The 'db and 'counter vars are global. It looks like the initial db: SQL "select * from customer" call is failing, and 'db is set to none. Test for that. |
GrahamC 9-Dec-2010 [665] | If that were the case, the 'layout would fail ... |
BrianH 9-Dec-2010 [666] | When are the paths in the layout evaluated? The only part I don't know is the View part. |
GrahamC 9-Dec-2010 [667] | Immediately |
BrianH 9-Dec-2010 [668x2] | In that error there are only 3 path roots that could be none: db, db/:counter and FN. If the db is empty then db/:counter would be invalid even in the layout. That leaves FN. |
This seems like a job for PROBE. | |
GrahamC 9-Dec-2010 [670x2] | If ''layout completes, then FN will be a VID field object |
so this suggests to me that db = [ ] | |
BrianH 9-Dec-2010 [672] | If there are no rows returned then that makes sense. Looks like the database access needs some work. And even if the path succeeded, the SQL at the end of btn-save would fail because the database is disconnected. Plus, the create statement at the beginning just creates a database, not a table. |
GrahamC 9-Dec-2010 [673] | I didn't look at the rest of the code .. I'm just interested in the tech explanation as to why the function errors out like that |
BrianH 9-Dec-2010 [674] | The error message itself refers to some fairly limited code. A couple probe statements would narrow things down even further. |
Steeve 10-Dec-2010 [675] | Anyone know which algo is used by the SORT function ? |
BrianH 10-Dec-2010 [676] | Not a stable one (there's a ticket about that). It could be guessed by using a logging compare function. |
Steeve 10-Dec-2010 [677] | So, did you guess it ? |
Dockimbel 10-Dec-2010 [678] | I would bet on a quick sort. |
Steeve 10-Dec-2010 [679x2] | If it uses several algos it will be difficult |
Quick sort is not optimal for cases where the comparison cost is expensive. And with Rebol comparisons have high cost | |
BrianH 10-Dec-2010 [681] | >> print mold collect [sort/compare [20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1] func [x y] [keep/only reduce [x y] x < y]] [[10 20] [1 10] [10 20] [10 19] [10 2] [10 18] [10 3] [10 17] [10 4] [10 16] [10 5] [10 15] [10 6] [10 14] [10 7] [10 13] [10 8] [10 12] [10 9] [10 11] [10 11] [10 9] [5 1] [9 1] [9 5] [5 2] [5 3] [5 4] [5 6] [5 8] [5 7] [5 6] [5 4] [6 7] [7 8] [8 9] [6 7] [7 8] [6 7] [1 2] [2 3] [3 4] [1 2] [2 3] [1 2] [16 11] [20 11] [20 16] [16 12] [16 13] [16 14] [16 15] [16 17] [16 19] [16 18] [16 17] [16 15] [17 18] [18 19] [19 20] [17 18] [18 19] [17 18] [11 12] [12 13] [13 14] [14 15] [11 12] [12 13] [13 14] [11 12] [12 13] [11 12]] |
Steeve 10-Dec-2010 [682x3] | ok it's quick sort |
far from behing the best one in our context as I said. Too much comparisons | |
*from beeing | |
BrianH 10-Dec-2010 [685x3] | Darn. Quicksort is still slow for mostly sorted stuff: |
>> print mold collect [sort/compare [1 2 3 4 5 6 7 8 9 10] func [x y] [keep/only reduce [x y] x < y]] [[6 1] [10 1] [10 6] [6 2] [6 3] [6 4] [6 5] [6 7] [6 9] [6 8] [6 7] [6 5] [7 8] [8 9] [9 10] [7 8] [8 9] [7 8] [1 2] [2 3] [3 4] [4 5] [1 2] [2 3] [3 4] [1 2] [2 3] [1 2]] | |
See also this: http://curecode.org/rebol3/ticket.rsp?id=1152 | |
Steeve 10-Dec-2010 [688] | Merge sort seems to give the best results when the comparison functions are expensive. http://warp.povusers.org/SortComparison |
BrianH 10-Dec-2010 [689] | Good idea, as long as the sort is stable. |
Steeve 10-Dec-2010 [690] | Shell sort seems pretty good aswell |
older newer | first last |