World: r3wp
[Rebol School] Rebol School
older newer | first last |
Geomol 8-Feb-2009 [1878] | Anton, that's a really cool demo with the line and ellipse! |
Anton 8-Feb-2009 [1879] | Thanks, have you not already seen it, though ? |
Geomol 8-Feb-2009 [1880x2] | I think, I saw it the first time. It's just really cool! :-) |
And I can move the ellipse and endpoints of line around. Cool! | |
Anton 8-Feb-2009 [1882] | Note: I did not solve the "nearest point on an ellipse to a given point" problem yet, which is hard, so the auto-selection of nearest control point is not perfect. |
kib2 8-Feb-2009 [1883] | Anton: very nice ! bravo. |
Anton 8-Feb-2009 [1884] | Thanks - I hope it's useful. |
Geomol 8-Feb-2009 [1885] | About intersect of line and polynomial curve. There's a preview of the book, I was talking about here: http://books.google.com/books?id=82kntxqd1BoC&printsec=frontcover&dq=Geometric+Tools+for+Computer+Graphics#PPA250,M1 |
kib2 8-Feb-2009 [1886] | Geomol: thanks |
Geomol 8-Feb-2009 [1887] | The author, David Eberly, also has a lot of online documentation: http://www.geometrictools.com/Documentation/Documentation.html Look under "Intersection". |
kib2 8-Feb-2009 [1888x2] | Geomol: nice, I've bookmarked ! |
Is there any string interpolation ? | |
Geomol 8-Feb-2009 [1890x4] | You mean something like: >> rejoin ["Date: " now/date " Time: " now/time] == "Date: 8-Feb-2009 Time: 23:18:12" |
Some use COMPOSE, that will return a block: >> compose ["Date:" (now/date) "Time:" (now/time)] == ["Date:" 8-Feb-2009 "Time:" 23:21:57] That you can turn into a string with useful spaces by: >> form compose ["Date:" (now/date) "Time:" (now/time)] == "Date: 8-Feb-2009 Time: 23:21:08" | |
If you just wanna print the result, PRINT can work on a block, which will be reduced and spaces included in the output: >> print ["Date:" now/date "Time:" now/time] Date: 8-Feb-2009 Time: 23:24:27 | |
Another example: >> print ["2 + 2 =" 2 + 2] 2 + 2 = 4 | |
kib2 8-Feb-2009 [1894x3] | Geomol: awesome, thanks ! (it's very useful for debugging) |
I just found an article on the subject I'm working on : http://www.alistapart.com/stories/simplecontentmanagement/ | |
I don't like the implementation, but the parse rules are worth reading | |
Geomol 8-Feb-2009 [1897] | For debugging, you'll find PROBE to be very usefull. You can put it in about anywhere in your code, and it will just work as without PROBE. Examples: >> square-root probe 4 * 8 32 == 5.65685424949238 >> read probe join http:// "www.rebol.com" http://www.rebol.com connecting to: www.rebol.com == {<html> ... |
kib2 8-Feb-2009 [1898] | nice, thanks. Now, I'm looking for something like hashtables (key-value). Is there something special, or do I need to use blocks ? |
Geomol 8-Feb-2009 [1899x3] | >> if 1:00 > probe now/time [print "Go to bed!"] 0:05:35 Go to bed! |
Try >> ? hash | |
This will create a hashtable, that works like a block, but is faster: >> table: make hash! [a 1 b 12 c 4 d 65] | |
kib2 8-Feb-2009 [1902x2] | Geomol: sorry, you can go to bed |
Geomol: and thanks a lot for your help | |
Geomol 8-Feb-2009 [1904x2] | lol :-) it's ok, I'll go to bed in a moment. |
You can read a short intro to hash tables here: http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.5 | |
kib2 8-Feb-2009 [1906x4] | I just discovered this: |
markup: ["**" "strong" "//" "em" "__" "u" "--" "del" "^^" "sup" ".." "sub"] | |
foreach [bal html] markup [format text bal html] | |
where format is a function I've written. | |
Geomol 8-Feb-2009 [1910] | REBOL has a build-markup function. |
kib2 8-Feb-2009 [1911x2] | really ? |
So mine overwrited Rebol's one ? | |
Geomol 8-Feb-2009 [1913x3] | It may have changed in recent version. Let me check... |
You have build-tag, to-tag and build-markup. | |
Functions to help you make markup text. | |
Izkata 8-Feb-2009 [1916] | Does hash! work with nested blocks? |
Geomol 8-Feb-2009 [1917x2] | >> build-tag [a b 1] == <a b="1"> |
Izkata, I don't know. | |
kib2 8-Feb-2009 [1919x4] | powerful. |
a: 1 | |
build-markup "toto<%a%>" | |
so that's string interpolation too :) | |
Izkata 8-Feb-2009 [1923] | just tested, looks like it doesn't they way I mean: >> type? second Z: make hash! [One [F1 {Hi} F2 {Bye}] Two [F1 {Yes} F2 {No}]] == block! However, this works: >> Z/2: make hash! Z/2 |
Geomol 8-Feb-2009 [1924] | It seems, it does, if you do it like this: >> t: make hash! compose [a (make hash! [a 43 b 34]) b (make hash! [a 34 b 87])] == make hash! [a make hash! [a 43 b 34] b make hash! [a 34 b 87]] >> type? t/2 == hash! >> t/b == make hash! [a 34 b 87] >> t/b/a == 34 |
Izkata 8-Feb-2009 [1925] | yeah |
Geomol 8-Feb-2009 [1926] | kib, yes |
Izkata 8-Feb-2009 [1927] | When you mentioned it was faster, I got curious, as I need speed for some data mining algorithms I'm implementing in Rebol for a class |
older newer | first last |