REBOL3 - Core (Discuss core issues [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
15441Steevehey ?13-Jan-10 14:26
15440Henrikdoes anyone have a rebol based bracket checking tool? preferrably something that can be integrated into a diagnostic tool.13-Jan-10 13:52
15439WuJianGood stufff9-Jan-10 12:47
15438Jankoas anyone tried to run cheyenne or rebol on sheevaplug ( http://www.globalscaletechnologies.com/t-sheevaplugdetails.aspx )9-Jan-10 10:49
15437Henrikrephrasing that: not "easiest way", but easiest to use in the end.9-Jan-10 8:27
15436HenrikFrom all this, the easiest way would be to produce a dialect that does its own escaping, so you don't have to write JS at all.9-Jan-10 8:25
15435TerrySteeve, it's cumbersome.. I spend more time joining and escaping than anything else.9-Jan-10 7:24
15434TerryShould probably put this in rant.. but just spent the last hour wondering why my function wasn't working

result: sofp 'firstname'

the solution? change the single quotes to double.. aye carumba

9-Jan-10 7:22
15433SteeveI say it again, you didn't give us the real output. Doing some assumptions, i got this.

varA: { \'hello\'s ^{Worlds \';} varB: { 'and ^{so "on'; } print rejoin [{<button onclick="alert('} varA {');">CLICK ME</button>} varB ]

<button onclick="alert(' \'hello\'s {Worlds \';');">CLICK ME</button> 'and {so "on';

So where is the burden ? i don't see one

9-Jan-10 0:19
15432Terryvia AJAX9-Jan-10 0:11
15431TerryIf it was a smple matter of replacing variables with values.. i have some °7° code that does that. The problem is well formed javascript to send back to the DOM.9-Jan-10 0:10
15430TerryAlthough, i would be impressed if it didn't choke while trying to escape stuff.9-Jan-10 0:07
15429GreggI need a spec first. ;-)9-Jan-10 0:05
15428GreggNeeds a different name too, as Ladislav has a nice BUILD func that works on blocks.9-Jan-10 0:04
15427TerrySpend 6 :)9-Jan-10 0:04
15426GreggWell, what do you in five minutes? ;-)9-Jan-10 0:03
15425Steeveyes seems a little messy Greg ;-)9-Jan-10 0:02
15424GreggNow, that's norribly naive, and doesn't work because of that. e.g. it needs a space before the $ marker, so a var at the beginning of the text gets missed.9-Jan-10 0:02
15423Greggbuild: func [ {Return text replacing $tags with their evaluated results.} content [string! file! url!] /quiet "Do not show errors in the output." /local out eval value ][ content: either string? content [copy content] [read content] out: make string! 126 eval: func [val /local tmp] [ either error? set/any 'tmp try [do val] [ if not quiet [ tmp: disarm :tmp append out reform ["***ERROR" tmp/id "in:" val] ] ] [ if not unset? get/any 'tmp [append out :tmp] ] ] parse/all content [ any [ end break | " $" [copy value to " " | copy value to end] (eval value) | copy value [to " $" | to end] (append out value) ] ] out ]9-Jan-10 0:01
15422SteeveTerry, i don't think your output must be { \'hello\'s {Worlds \';

...and prints...

'and {so "on'; }

And yet, that's what you show us actually

9-Jan-10 0:00
15421GreggThere has been talk in the past of including a substituion function, REWORD being the R3 func for it. In R2 we have build-markup, which shouldn't be hard to hack, but I don't know of a version that anyone has done for a given substitution syntax.8-Jan-10 23:55
15420Terryno comments.. that's functioning php.. and if you don't escape it, it doesn't function as JS8-Jan-10 23:55
15419Steevedon't mess it with escaping characters or comments.8-Jan-10 23:53
15418SteeveI just can't figure the exact string output you want.8-Jan-10 23:50
15417TerryShow me the 'simpler way'8-Jan-10 23:39
15416Terryum.. i don't think that was the point8-Jan-10 23:39
15415SteeveI see nothing you can't do with rebol, so what ?8-Jan-10 23:06
15414Terryso.. the result is a button that alerts..

\'hello\'s {Worlds \';

...and prints...

'and {so "on';

after the button

8-Jan-10 22:39
15413Terry(output is JS)8-Jan-10 22:37
15412Terry<<< is a here-doc in php8-Jan-10 22:37
15411Terry$varA =<<<VA \'hello\'s {Worlds \'; VA;

$varB =<<<VB 'and {so "on'; VB; $n=<<<HD <button onclick="alert('$varA ');">CLICK ME</button> $varB HD;

echo $n;

8-Jan-10 22:36
15410Claudeterry: var={coucou} print rejoin [{hello + } var { ŕ vous}]8-Jan-10 22:03
15409Steevedid you tried REWORD ?8-Jan-10 22:03
15408SteeveTerry, show use case you think is cumbersome and we'll show you a simpler way (i hope)8-Jan-10 21:43
15407Steevethere is plenty of functions to do such, the simple one is the one you can do8-Jan-10 21:41
15406Henrikwell, how else would you do it? I guess you need kind of an escape sequence to evaluate a word or something.8-Jan-10 21:40
15405TerryThat's not too bad, but when you start including single quotes, double quotes, multiple variable etc, it becomes more difficult8-Jan-10 21:39
15404TerryRebol

var: "Hello World" print rejoin ["This is " var "in the sentence"]

8-Jan-10 21:38
15403Terryie: Comparing to PHP

$var = "Hello World";

echo "This is $var in the sentence";

8-Jan-10 21:37
15402TerryIs it just me, or does anyone else find JOIN and REJOIN cumbersome?8-Jan-10 21:36
15401DockimbelBIND on a block! does a full recursive traversal of the block! and for each word! found, does a fast lookup in the target context (probably hashed). So the cost is directly proportional to the size and depth of the argument block!.8-Jan-10 14:06
15400DockimbelObject! and function! have different creation and usage semantics, AFAIU, they share a common internal parent datatype, context!. So, context! (which is not directly accessible) should be "cheaper". Objects and functions have different purposes, so this might be like comparing apples and oranges...in a closed blackbox.8-Jan-10 13:58
15399Dockimbel"if rebol binds hidden ctx to function body" => It's the other way around, "binds body to ctx". BIND will only link the words that match those defined in the target context, to that same context, nothing more.8-Jan-10 13:48
15398Jankoif function uses objects and bind internally or something like that, then objects in rebol and bind should be cheap right? and then an object is cheaper than function ?8-Jan-10 13:31
15397Jankook .. query/clear will find me seek out leaking globals so this problem has got a solution in a way8-Jan-10 13:30
15396Jankohm.. if rebol binds hidden ctx to function body then it really can't do anything to trigger warning on global words. (if I understand things aroung bind correctly)8-Jan-10 13:29
15395Jankohuh.. plenty of info, might need some time to process this to get all that you two meant .

but I did already know first :foo second: foo stuff (I was playing with rebol to js compiler) and I did know that context is object

8-Jan-10 13:27
15394Henriktrying:

source context

might be a revelation too.

8-Jan-10 12:27
15393DockimbelJanko, a function is a context! value like objects. You can use the following mental analogy to see how it is related :

foo: func ["for demo" a [integer!] /local b][...]

would be *roughly* equivalent to constructing an object like that :

foo-def: make object! [ hidden-ctx: make object! [a: none local: none b: none] body: [...] spec: ["for demo" a [integer!] /local b] ]

The body is bound to the 'hidden-ctx context at function creation. When calling 'foo, the interpreter will set the 'hidden-ctx object words values according to passed arguments and refinements and then DO 'body.

There's no differences on how REBOL treats "arguments" and "local words", it's part of the illusion. The /local refinement is used by *convention* only, to set "local words", you could just decide to use any other refinement for the same job. Here's an example :

>> a: func [/local b][print b] >> a/local 5 5

Additionnaly, when you apply the ordinal natives on a function! value, you get :

>> first :foo == [a /local b] ;=> the hidden context words

>> second :foo == [...] ;=> the function body block

>> third :foo == ["for demo" a [integer!] /local b] ;=> the original spec block

8-Jan-10 12:27
15392HenrikJanko, try:

http://blog.revolucent.net/2009/07/deep-rebol-bindology.html

8-Jan-10 12:27
15391JankoDoc .. thanks a lot for that query word ... it' awesome to see on a page what all got set in the process.. this will help me the to make code more strong A LOT!

Doc.. how does the runtime binding to function local words work? func is probably not a mezzaine or something where we could peek into what it does with /local words ?

Henrik: I need to learn more about them and how to use them .. are there any good docs to read about what contexts are used for maybe?

8-Jan-10 11:54
15390Henrikjanjo, you'll find that using contexts will help you solve these problems. it's the next best thing to modules.8-Jan-10 11:46
15389DockimbelDetecting at runtime is the only way. So, you could write your funcstrict function using this 'query trick, but that would cost you 2 'query calls each time the function is called...8-Jan-10 11:46
15388Jankocool! I was looking at system/words but had no idea how to see my words in there ! didn't even know for query word so far .. cool8-Jan-10 11:41
15387Dockimbel>> query/clear system/words == [end! unset! error! datatype! context! native! action! routine! op! function! object! struct ! library! port! any-type! any-word!... >> context [set 'a 5] >> query system/words == [a]8-Jan-10 11:36
15386DockimbelJust remembered about querying system/words, that would give you a mean to detect new global words.8-Jan-10 11:34
15385JankoI am changing to using a context now for all words that are defined outside functions on rps pages to make them local to that pageload8-Jan-10 11:25
15384JankoHenrik: but I don't want to make each function a context (probably:) ) .. I have to admit I don't know much about contexts .. only that it's like object8-Jan-10 11:23
15383JankoI imagine when you now set some word in some function it looks at /local words and it it's there it creates a local word, if not it just sets a word (globaly).. let's say that there is funcstrinct that in second case just throws an error (probably something like that could be made in rebol itself)8-Jan-10 11:22
15382Henriksetting no global words: use a context8-Jan-10 11:21
15381Jankoyes analysis could be hard or impossible if you look at more unusual things you can do.. but at least so that all.

about second, maybe you mean the same.. but I just want that my certain functions set no global words, at least not directly with word: ~expr~ or set 'asd set [ asd asd ] ..

8-Jan-10 11:21
15380DockimbelBtw, R3 modules would minimize this issue to the local module only.8-Jan-10 11:19
15379DockimbelRegarding capturing of globally defined words in a local context, as Gabriele likes to say : "for every code you would write that would work for you, I can write an example code that will break it" ;-)8-Jan-10 11:15
15378DockimbelAFAIK, static code analysis cannot be used on REBOL source code to infer the runtime behaviour accurately , word! values can be constructed and dynamically bound at runtime. Same reason why REBOL is not compilable.8-Jan-10 11:13
15377Jankoit would be very helpfull if rebol could let you define functs that would warn you if you used or defined any global words ..

I suppose my programs are 100% more uncertain because I forget to include some of the words I defined in words as local. If some 'funcstrict' for example would warn me of any such mistake I would sleep much better. Other but worse option is that there would be some lint like tool that would look at code and warn you of these

8-Jan-10 10:47
15376RebolekHm, I understand that now:

>> a: [1] == [1] >> reduce [a append a [1]] == [[1 1] [1 1]]

Interesting. I never knew that.

7-Jan-10 0:18
15375RebolekThis works as I expected: >> a: [1 2] == [1 2] >> compose/deep [[(a)] [(swap a next a)]] == [[1 2] [2 1]]7-Jan-10 0:12
15374Rebolek>> a: [1 2] == [1 2] >> reduce [a swap a next a] == [[2 1] [2 1]]

Why it doesn't return [[1 2] [2 1]] ?

7-Jan-10 0:10
15373Grahamhttp://www.rebol.org/view-script.r?script=color-code.r6-Jan-10 0:51
15372Grahamanyone got a code color rinser for R source?6-Jan-10 0:48
15371BrianHI'm not waiting.5-Jan-10 19:08
15370GrahamCan't wait forever ...5-Jan-10 19:08
15369BrianHNo, let's not.5-Jan-10 19:05
15368GrahamOk, let's create a new r3 group ...5-Jan-10 19:04
15367BrianHReichart hasn't yet restored the right group.5-Jan-10 19:04
15366Grahamand this is in the wrong group ...5-Jan-10 19:03
15365Grahamwe non gurus need to wait for the gui .. or is it out now??5-Jan-10 19:03
15364BrianHIf non-gurus can't use the GUI, it's a design flaw that needs to be fixed.5-Jan-10 19:02
15363BrianHIf you are interested in the GUI, get involved. We *really need* non-gurus - the GUI is designed for them.5-Jan-10 18:58
15362james_nakThanks Graham.5-Jan-10 18:56
15361BrianHThere will be no miracle that will bring the GUI or database to the first R3 release - they just aren't done yet, and can't be done with the level of community involvement that the alpha releases have engendered. Too many critical people are waiting for a beta or full release before they will even start to get involved. Fortunately we are on the rapid release model, so there is no such thing as a "final" or "full" feature set, just the feature set of a particular release.5-Jan-10 18:55
15360Claudei just want to see more info and screen on the new GUI of R3 (i am very curious :-) )5-Jan-10 18:53
15359Claudei am just like an end user on R3. and for me i am not a guru like you and others !!!!!5-Jan-10 18:52
15358Claudethank you for your effort on R3 and R25-Jan-10 18:50
15357Claudethank you for your effort on5-Jan-10 18:50
15356BrianHIt's a little flexible - outside circumstances have affected the timing already.5-Jan-10 18:49
15355Claudedo you have a plan for the beta realase ? one week, month,5-Jan-10 18:48
15354BrianH"some miracle" in this case meaning a community member with the time volunteering to do the work.5-Jan-10 18:48
15353BrianHR3 Status: The beta will come out without GUI, database or (unless there is some miracle) SSL.5-Jan-10 18:46
15352BrianHThe R3 GUI is still in development. The database model hasn't even been designed yet. You can make wrappers for ODBC and MySQL if you want to write the extensions - Robert has already started doing so for SQLite. Once device extensions are supported, we can start to get to work on the database model.5-Jan-10 18:44
15351Claudewhat about R3 status ? make uptodate R2 is very fine but i would prefer a R3 version with GUI and ODBC or MYSQL ..................;5-Jan-10 18:36
15350GrahamIf the firewall is off, but no one is listening ... then you'll get a closed port same as if the firewall is on, and someone is listening...5-Jan-10 18:30
15349Grahamwhat the code checks for is if anyone is listening at a certain port ...not whether the firewall is open or closed.5-Jan-10 18:30
15348james_nakThanks Doc.5-Jan-10 16:50
15347DockimbelCheyenne has such opened listen port detection capabilities (added recently), you can extract the code from the SVN repo (search for 'list-listen-ports function) : http://code.google.com/p/cheyenne-server/source/browse/trunk/Cheyenne/misc/win32.r

Linux and OS X versions are also available in %misc/unix.r and %misc/macosx.r

5-Jan-10 16:47
15346james_nakThanks Graham and Sqlab. One step further if you please. What would you suggest the steps would be to test the code. Right now when I run the test I get no opened ports. I've turned the firewall off and on but the results are the same. I've been studying the nettools.r code and thinking that maybe I'm not thinking this right. What I want to know is if a certain port will allow it to be open so that this particular application has can use.it. What is happening is customers are installing the app and having trouble because these certain ports are unavailable. What I wanted to create was a quick and easy pre-install test to verify these ports were open. This partly due to the fact that they way the software was written it doesn't tell you that a closed port is the problem. It simply stops worting. I appreciate the feedback you have given.5-Jan-10 16:42
15345Graham'prin5-Jan-10 9:16
15344Grahamor shorten it to 'prn ...5-Jan-10 9:15
15343sqlabof course, you can also omit the print5-Jan-10 9:15
15342Grahamfor i 1 ...5-Jan-10 9:14
15341Grahamfor i 65536 1 [ attempt [ print i close open join tcp://server: i append opened i ] ]5-Jan-10 9:13
15340Grahamhow about

attempt [ print i close open join tcp://server: i append opened i ]

and do without the p, and the all ....

5-Jan-10 9:12
15339Grahamoh .. I isee it doesn't5-Jan-10 9:11
15338sqlabI do not follow ?5-Jan-10 9:11
15337Grahamwon't attempt always return the same value?5-Jan-10 9:10
15336sqlabdo you regard the all [..] ?5-Jan-10 9:09
15335Grahamif you want to only see those successfully opened, I would put the 'append after server: i5-Jan-10 9:08
15334Grahamwon't opened contain all the i's?5-Jan-10 9:07
15333sqlabThis should work, where server is the ip adress or dns name of the relevant machie

opened: []

for i 1 65536 1 [ all [ print i attempt [p: open join tcp://server: i ] attempt [close p] append opened i ] ]

5-Jan-10 9:04
15332Grahamif you want to check if there is a server port listening then you can do

open tcp://localhost:8881

and if you want to see if that port is open to the outside, then you need to use another PC to probe that port address

5-Jan-10 6:19
15331Grahamall that does is trying to open a server port5-Jan-10 6:18
15330james_nakSmart guys. This may seem elementary but I need to check if certain ports are open on a windows machine. For example, port 8881. I use something like error? try [close open to-url "tcp://:8881"] (building these strings with various port numbers). My problem is I don't know how to check if it is working. I turn on the firewall and it doesn't seem to make a difference. Perhaps my thinking is all wrong and all I am doing is checking within the firewall. Any thoughts?5-Jan-10 5:51
15329GreggVery nice Graham!4-Jan-10 18:35
15328RebolekPavel, yes it is. But you can say that binary! is subset of vector! - 8bit unsigned vector. With vector! You can generate for example 16bit signed stream and then just add WAV/AIFF header. So vector! is superior to binary! from this point of view.4-Jan-10 14:36
15327PavelRebolek How much differ vectors from binary in sound application isn't it pure record of numbers only?4-Jan-10 14:32
15326PekrWhole document is here - http://rebol.com/r3/docs/project.html .... there are even some sound related changes planned, although with lower priority ...4-Jan-10 13:49
15325PekrHigh priority for Vector says - Basic vector! conversions and ops ... dunno how Carl sticks to the published project plan though ...4-Jan-10 13:49
15324RebolekPekr, vectors are really great. But they need few improvements and bugfixes here and there. I wrote a document what doesn't work and should some time ago (has been two years already? I think so). I haven't looked at them recently, so maybe they're improved already. I should check my R3 AIFF/WAV loaders/savers wheter they work as they have been the best test for vectors I had.4-Jan-10 13:32
15323PekrRebolek - do vectors help you with sounds? There are some high-priority changes planned for vectors for the 3.0 beta IIRC.4-Jan-10 13:24
15322RebolekAnton, I'm glad to hear that. In which way are you interested to use it in sound/music generation? One of my first thoughts was howe to use this together with Sintezar. It should probably be used for oscillator wavetables generation... I'm not sure.4-Jan-10 13:21
15321PekrAnton - still experimenting with sound? Maybe R3 Extension based on fmod is waiting for you to bring it to REBOL? :-)4-Jan-10 13:20
15320AntonBolek, that's very interesting for me because I was searching for just such a declarative dialect for sound generation and music composition.4-Jan-10 13:15
15319Grahamspell: func [ check [string!] /local req result suggestions ][ req: reform compose copy [ <spellrequest textalreadyclipped="0" ignoredups="1" ignoredigits="1" ignoreallcaps="0"> <text> (check) </text> </spellrequest> ] result: load/markup read/custom https://www.google.com/tbproxy/spell reduce [ 'POST req ] either parse result [ tag! tag! tag! set suggestions string! tag! tag! end ][ parse suggestions none ] [ none ] ]

>> spell "rebol" connecting to: www.google.com == ["reboil" "rebel" "reboils" "Reebok" "rebook"]

4-Jan-10 10:05
15318GreggI think that's the point Steeve. Looking for new ways to express things, that may be useful, and may inspire more useful adaptations.4-Jan-10 5:26
15317SteeveWell it's interesting as a study dialect. But to be honest guys, i don't see the interest to have them in Rebol. Because we can do much of the use cases rebolek showed us with one or two lines of rebol code. And i don't need to say that it will got lightning speed by comparison

But anyway, It's lot of fun to do such things with Rebol.

3-Jan-10 22:16
15316BrianHI was talking about the functional-language filter operation, not Bolek's (much cooler) FILTER :)3-Jan-10 21:42
15315Rebolekwell, add the missing "]" ;)3-Jan-10 21:41
15314RebolekBrian: FILTER is REMOVE-EACH on steroids.

Gregg, Doc: Thanks! What I'm working on right now is this:

divisor: func [x][filter serie [1 .. x][zero? x // i]] prime?: func [x][equal? 2 length? divisor x filter [1 .. 50][prime? x]

this must work.

3-Jan-10 21:40
15313BrianHThe REBOL equivalent of the functional-language operation fiter is REMOVE-EACH.3-Jan-10 21:05
15312DockimbelRebolek: thanks for the link, lots of good food for thought here. That would be great to support it at native level (using a R3 extension). I also wonder how much of it could be implemented efficiently using 'map-each and 'apply. Anyway, this could be a really great addition to R3 (or even R2). Keep up the good work.3-Jan-10 20:07
15311GreggCool Bolek.3-Jan-10 19:37
15310RebolekI was reading http://www.chalicegames.com/swym/SwymWebIntro.html and some concepts were interesting to me(especially ETC), so I made REBOL equivalents:

http://box.lebeda.ws/~rebolek/rebol/swyv.r

There's a documentation in the script, so just few examples of what it can do:

SERIE:

>> serie [etc 1 2 4 .. 20 cycle [1 2 3] length 5 iterate [x: x + 10] from 10 5] == [1 2 4 8 16 1 2 3 1 2 10 20 30 40 50]

COMPARE:

a: [1 2 3 4 5 6 7 8 9] b: [2 4 6] >> compare a b [some a > every b] == true >> compare a b [one a > every b] == false

FILTER:

>> filter serie [iterate [x: x + 1] 10 ] [[x > 2] [x < 5]] == [3 4] >> filter etc [3 6 9] 100 [x > 250] == [252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300] >> filter serie [1 .. 10] [[x > 5][zero? x // 2]] == [6 8 10]

It's written in R3 but should also work in R2 (not tested). It's not optimized so if you're interested in it, feel free to do whatever you want to improve it (more patterns that ETC can recognize...).

3-Jan-10 10:43
15309Gabrieleand, how many of them do something like: var: unless ...22-Dec-09 10:36
15308SunandaThere are 45 scripts on FREBOL.org that appear to use UNLESS (there may be a few false positives in this -- if, say, the word UNLESS has been reused): http://www.rebol.org/search.r?find=unless+[b]20-Dec-09 13:15
15307GabrieleBrian, how many scripts on rebol.org use the result of UNLESS?20-Dec-09 8:24
15306BrianHSorry Bolek, I should have been more specific. I meant Steeve's POP proposal and the CONCAT example wouldn't work (for reason's stated above). Gabriele's IT proposal and Steeve's sample implementation of it would work a little, but would need modification.20-Dec-09 1:01
15305RebolekBrian, Steeve's examp;e works, you just have to do >>secure none20-Dec-09 0:15
15304BrianHOh, and suffix-map is used by the codec system, afaik.19-Dec-09 23:48
15303BrianHThe reason Steeve's proposal doesn't work is because the result of the prior expression is thrown away, not pushed on a stack.19-Dec-09 23:47
15302BrianHPaul, you won't need stack tricks to get user-defined operators in R3 - we'll just use user-defined op! functions.19-Dec-09 23:46
15301BrianHGabriele, UNLESS has been around for many years - just not used by many people because of personal preference. They used the slower IF NOT instead.19-Dec-09 23:44
15300BrianHIT would need to search up the stack to find the nearest appropriate function call frame - it doesn't just apply to the next call up.19-Dec-09 23:42
15299SteeveWith R3, currently we can do...

>> it: does [first stack/args 2] >> if 1 + 1 [print it] 2

19-Dec-09 16:05
15298SteeveIf it was possible, the 'IT function could be emulated like this: IT: does [push pop] ; pop the and repush the last stacked value (just to read it without modifying the stack).19-Dec-09 15:38
15297SteeveBrian, even if the Rebol's VM is not a true stack machine. It has a data stack, so that, the POP function could be emulated in some way. A forth kernel, is nothing else than that. To simulate a stack machine on a processor that is not designed that way initially. However, your response suggests that the cost would be high.19-Dec-09 15:30
15296Paulwha tis the suffix-map in REBOL used for?19-Dec-09 14:56
15295PaulYeah that is fine Henrik.19-Dec-09 14:49
15294Henrikwell, this allows you to put together any condition for the item you want to stop at, so I think it's OK. it's something else, if the code pattern occurs very often (never used this one).19-Dec-09 14:49
15293PaulI guess that is my point. I would think we simply would have one function that does that.19-Dec-09 14:47
15292Paulyeah Henrik, I'm suprised that we need to combine functions though to achieve that.19-Dec-09 14:46
15291Henrikit must be the same block, not just an identical one19-Dec-09 14:43
15290PaulSteeve, I love your thinking about the pop function. I have wanted that feature before for operators myself.19-Dec-09 14:43
15289Henrika: [b c d] copy/part a find a 'd == [b c]19-Dec-09 14:43
15288Henrikyou can do that with copy/part, as long as the /part is the same block19-Dec-09 14:42
15287PaulSeems such usefulness that it would be built in - so I keep thinking I'm missing something.19-Dec-09 14:42
15286PaulThis function returns a copy of everything until it finds the value specified and then it breaks.19-Dec-09 14:41
15285Paulno as that would just put the initial values in the series19-Dec-09 14:40
15284Henrikarray/initial?19-Dec-09 14:39
15283PaulIsn't something like this code already built-in in REBOL and I'm just missing it:

copy-to: func [series [series!] arg /local cpd d][ cpd: make type? series 10 foreach item series [ either not-equal? arg item [insert tail cpd item][break] ] cpd ]

19-Dec-09 14:31
15282GabrieleRe: IT - the problem in looking up the stack is knowing which argument to look it up. I guess the first would work and be useful enough, though.19-Dec-09 9:17
15281GabrieleBrian: a lot of code uses IF returning none, agreed, on UNLESS i'm not really sure, it's quite new. besides, it's not like R2 scripts run unchanged on R3; but anyway i was just thinking out loud, not really proposing anything.19-Dec-09 9:16
15280GreggI have an old IF-IT function, which just does a bind/copy. I used it a bit when I first wrote it, but it hasn't become a part of my daily life.18-Dec-09 22:00
15279JankoI have to admit I was also thinking about some simple stack capabilities few times :) (I came back to rebol from factor)18-Dec-09 21:50
15278BrianHYour Forth focus is showing :)18-Dec-09 21:20
15277BrianHSteeve, R3 evaluation doesn't work that way - it's not a stack machine.18-Dec-09 21:20
15276BrianHGabriele had two ideas - I liked one of them: IT :)18-Dec-09 21:19
15275Steeveyeah, i didn't understood what u meant :-)18-Dec-09 20:47
15274Maxim(those two sentences should have been two posts)18-Dec-09 20:46
15273MaximI like Gabriele's idea. I am one of those that has been using the if/unless return value for years, and quite often.18-Dec-09 20:45
15272Steevethe stack function can return the prvious stacked value, but without removing it from the stack18-Dec-09 20:38
15271SteeveI don't know how the values evaluated are stacked by the VM. But i see the advantage of having a POP function. We could easly create postfix functions. e.g: CONCAT: func [v][join pop v]

>> "a" concat "b" =="ab"

All sort of new operators would be easy to construct

18-Dec-09 20:34
15270BrianHNo, it would have to search back. Simply popping wouldn't be enough. What I'm really interested in is seeing if I can add CASE support.18-Dec-09 19:05
15269Steevea sort of native POP function18-Dec-09 19:03
15268BrianHThe value returned by IT would not be evaluated, so that you can work with active values safely.18-Dec-09 18:58
15267BrianHR3-only of course.18-Dec-09 18:41
15266BrianHThe advantage to this approach is that it would be error-throw-safe, as well as thread-safe, and require no changes to IF or UNLESS :)18-Dec-09 18:40
15265BrianHGabriele, it occurs to me that if IT was native it could look up the stack to get its value. I'll try writing a (security hole) REBOL version of the function later today - it would require debug privileges to run so that it can call the STACK function.18-Dec-09 18:37
15264BrianHIt doesn't always apply to the task at hand though. The IF and UNLESS return values have been applied to the general R3 control flow model, as have the changes to the ordinal return values, map! behavior, ...18-Dec-09 18:32
15263BrianHI prefer CASE too, and have rewritten many mezzanines to use it :)18-Dec-09 18:30
15262SteeveFor complex control flow rules, i rather prefer CASE. Most of the time, combitations of ALL ANY, can be replaced by a CASE structure (which is faster and more readable)18-Dec-09 18:22
15261Steevei use it too,but not so much18-Dec-09 18:16
15260BrianHIt is mostly used in combination with ANY and ALL for control flow.18-Dec-09 18:16
15259BrianHMore every day. Every time another developer learns about this (5+ year old) trick they start using it. It's even used in mezzanines.18-Dec-09 18:15
15258SteeveA *lot* ? somewhat exaggerated :-)18-Dec-09 18:12
15257BrianHA *lot* of code uses the trick of having IF or UNLESS return none when the condition is not met, so your other suggestion is unlikely.18-Dec-09 18:10
15256BrianHIT could be a function that returns the thread-local top of the stack of implied subject values. IF would then push a value on that stack, and pop the value off when it returns. Might be tricky to make error-throw-safe, but easy to make thread-safe :)18-Dec-09 18:08
15255Gabrielejust thinking out loud...18-Dec-09 5:21
15254Gabrielewhile thinking about that, i also thought that maybe UNLESS should return the "condition" value when it is "true". we use this all the time with ANY:

x: any [select block value "default"]

maybe it would be more readable as:

x: unless select block value ["default"]

18-Dec-09 5:20
15253GabrieleI guess it could trip some users, otoh, we have many things that trip some users.18-Dec-09 5:18
15252Gabrielei don't think there would be that much code to add in the actual native. the same thing could be done to other similar control functions.18-Dec-09 5:17
15251Gabrieleso, I thought, can we avoid the bind/copy in any way?

actually, i think we can. some people would run in horror maybe, and Brian will complain about it not being thread safe (we still have no threads though), but what about the native was changed to do something like:

func [condition block /local it*] [ set/any 'it* get/any 'it it: :condition also if :condition block set/any 'it get/any 'it* ]

18-Dec-09 5:15
15250Gabrielei was just thinking again about the idea of IF (etc.) keeping a reference to the condition argument for you, that is, so that instead of writing:

if x: select block value [do-something-with x]

you can write:

if select block value [do-something-with it]

The reason people say it's not worth it is usually that of having to bind/copy the block - you don't want that in every IF call and probably not even in the ones where it would be useful (and, there's really no other name you could use for the function).

18-Dec-09 5:10
15249PavelThanks for info Maxim.16-Dec-09 7:55
15248Maxim(the callback framework is currently called wired)15-Dec-09 21:49
15247Maximthis way we can create rebol code directly from strings and native data very easily.

there is currently a size limit on executed strings, its a simple question of optimisation. this means we can't use the wiredf function for creating large datasets via strings (for now).

but I'm already doing stuff like:

wiredf("rogl-event-handler make wr-event [new-size: %p]", win-w, win-h);

calls rebol's do with %p replaced by a pair, using 2 ints. this is a varargs function.

15-Dec-09 21:48
15246MaximI am also building little helper funcs like a REBOL datatype centric version of sprintf which acts a bit like a C-side rejoin for REBOL.15-Dec-09 21:41
15245MaximI will be rebuilding the callback example with a much better/simpler design. but they work very well, basically I have mapped the Reb_Do_String() and Reb_Print() functions so that they can be called from within any extension.15-Dec-09 21:40
15244Pavelyes I've understand your anouncement this way15-Dec-09 21:23
15243Maximyou mean calling code from the host within extensions?15-Dec-09 18:28
15242PavelI'd glad to try, but internals are quite well hidden now. Anyway any hint about handle or crossreferencing from extension you have found Maxim?15-Dec-09 12:04
15241Maximyou seem to be already knowledged about this, so you'd be the best one to implement it IMHO (pavel).15-Dec-09 0:00
15240Maximwhen map! will added to extensions, you might be able implement an example for us and Carl might consider adding your code directly in the host or r3lib if you agree to it. :-)14-Dec-09 23:59
15239PavelFor those interrested a Fastbit webpage is good source of docs.14-Dec-09 13:46
15238PavelTransfering memory based hash! (map! in R3) datatype into disk based shema automatically keeping the hash table computation and lookup hidden from user gives you a RIF. Holly grail of all rebollers :) long long time promissed, still waiting to be done. Anyway hash tables are always usually unsorted, when necessary to search in usually some type of additional index is used (B-tree for example), for simple information if the key is in the set, bitmap vectors are used with advantage, when the set is really big (and bitmap vector doesn fit into memory) comressed bitmap may be used and usually bitwise operations on those vectors are much quicker than on uncompressed. Thisi is why it should be used for bitset! datatype anyway. The number of byte aligned (BBC,Packbit,RLE)od word aligned (WAH) schemes exists. It is used in very large datasets when index also resides in disk file. Once again bitwise operation may be much quickier even in memory on those schemes.14-Dec-09 13:44
15237JankoMaxim: yes, I am aware that retrieving data from hashtables is really fast... I wasn't aware it will just as fast even with 1M records so I was quite amazed before when I tried it13-Dec-09 21:11
15236GrahamVon, I think I just mean that your password for emstp will have to be in the script ( if it is needed .. )13-Dec-09 19:00
15235Maximbut janko... if you test it, you will that hash tables are extremely faster at retrieving data... the larger the set the bigger the difference. on millions of records indexed with strings , it could be hundreds or thousands of times faster :-)13-Dec-09 18:12
15234Maxima: make hash! [ "33" 33 "44" 44 "55" 55] select a "33" change find a "44" ["88" 88] == make hash! ["33" 33 "88" 88 "55" 55]13-Dec-09 18:01
15233Maximappend works on hash tables. in fact they are exactly the same as if you where using blocks, except that the internal representation is different than what you look at through code.13-Dec-09 17:58
15232Maximyep.13-Dec-09 17:57
15231Jankohm.. I have a very newbie question .. do you most effectively add new pairs to hashtable by appending to it as a block ? can't figure out how to change a value .. set doesn't work that way13-Dec-09 17:53
15230Jankoaha, I see that it depends .. I increased the length of string and block increased in size while hash stayed the same13-Dec-09 17:42
15229Maximhehe13-Dec-09 17:41
15228JankoI am nevbie a little longer each day :)13-Dec-09 17:41
15227Maximin REBOL, we're a newbie a few minutes... every day.... even after a decade of using it ;-)13-Dec-09 17:40
15226Jankostats is a cool command , with many refinements also .. I didn't know about it13-Dec-09 17:40
15225Maximbut... filled up....

b: make hash! 5000010 m: stats loop 5000000 [append b copy random "1234567890" append b random 10000000] print stats - m == 188430448

here its half the space.

a ha! depending on the string input... hash tables can actually be smaller... :-)

13-Dec-09 17:39
15224Janko:)13-Dec-09 17:39
15223Janko>> a: stats b: make block! 1000 repeat i 1000 [ append b random "abcdef" random 100000 ] print stats - a 48671 >> a: stats b: make hash! 1000 repeat i 1000 [ append b random "abcdef" random 100000 ] print stats - a 8145413-Dec-09 17:39
15222Maximhum... lets see: ;-)

a: stats b: make block! 5000010 print stats - a == 80001039

a: stats b: make hash! 5000010 print stats - a == 80005071

13-Dec-09 17:34
15221Janko(it does, cool :) I was looking at processes to see how much it will eat)13-Dec-09 17:34
15220Jankohm.. does stats return ram used??13-Dec-09 17:31
15219JankoMaxim .. thanks a lot for your answers.. very interesting .. I know from distance how hashtables work internally but I don't know details.. should a block take roughly the same space as hashtable of the same block (in rebol) or factor(s) different?13-Dec-09 17:31
15218Maxim(oops 'strings and pairs' > 'string and *integers*' )13-Dec-09 17:02
15217Maximbut when things are in the millions, sometimes using a disk-based on-demand caching algorithm is fastest... it really depends on the application.

cause think of it this way. every byte used by each element becomes a MB so adds up quickly.

5 million pairs of (10 byte) strings and pairs... is just about 350MB !

>> b: make block! 5000010 >> m: stats == 84172417 >> loop 5000000 [append b copy random "1234567890" append b random 10000000] == ["5862713409" 4765171 "2546013987" 2726704 "9528013746" 3565380 "4591302786" ... >> stats - m == 348435008

13-Dec-09 17:01
15216MaximI've had REBOL use up over 700MB of RAM without isues or dramatic speed drops... but having millions of items, make sure you pre-allocate your hash-table, cause if you keep-appending to the same table for each entry, it will get exponentially slower.13-Dec-09 16:36
15215Maximhash tables for such a big set are the only way to go... they will be magnitudes faster on access.13-Dec-09 16:34
15214Janko(let's say I want to use key-value (string-int) pairs for 5M words .. hash tables are probably more memory consuming for such a big set of data?)13-Dec-09 15:20
15213Jankocould you create something like a trie in rebol or would you have to go lower level for it to be normally eficient?13-Dec-09 15:18
15212sqlabIf you write with different rebol instances into the same file at the same time, you are out of luck. I13-Dec-09 12:24
15211Henriksometimes empty lines occur as well13-Dec-09 11:07
15210Henrikwould there be instances where write/lines/append would write a quarter or half a line? I'm logging tests of several script instances into the same file and write/lines/append sometimes produces only half a line in the log.13-Dec-09 11:06
15209VonGraham, you mentioned that I should encode the password. Is this in case someone hacks into my host? If I use the encloak function, couldn't someone also find my readable key in the script and then decloak my password using Rebol?13-Dec-09 9:33
15208Maximand who said we coudn't make profit by reboling ;-)13-Dec-09 3:50
15207GrahamThanks Von .. will certainly encourage others to help you out :)13-Dec-09 3:49
15206VonDone, I've submitted via PayPal :-) Thanks for your help, I get can some rest now :-) Thanks Maxim for your help also!13-Dec-09 3:45
15205Graham.. help pay .. not pay for the whole lthing!13-Dec-09 3:42
15204Grahamgreat .. can pay for my new USB LCD monitor :) sales@compkarori.co.nz :)13-Dec-09 3:40
15203VonHey, I'd be happy to send some $, if it means speeding up my learning curve! I'll PayPal some money over, seriously!13-Dec-09 3:39
15202Grahamtoo slow ...13-Dec-09 3:38
15201Maxim(hahaha was gonna say... "bills in the mail" ;-)13-Dec-09 3:37
15200GrahamMy paypal account is ...13-Dec-09 3:36
15199Maximthe best developper community in the world :-D13-Dec-09 3:36
15198VonWow, that's it! :-) I've spent almost 10 hours trying to resolve this and I had the wrong smtp relay, duh me! I really appreciate your help!13-Dec-09 3:35
15197Grahamlimit of 1000 email per day13-Dec-09 3:32
15196Grahamthis is the correct smtp server relay-hosting.secureserver.net13-Dec-09 3:30
15195Grahamyou have to use this .... http://help.godaddy.com/article/107313-Dec-09 3:29
15194Grahamyeah ..port 25 is being blocked13-Dec-09 3:27
15193Maximthat looks like an outgoing firewall issue.13-Dec-09 3:26
15192Vonlog.txt: Content-Type: text/plain

Net-log: ["Opening" "tcp" "for" "esmtp"] Net-log: [none "220"] ** User Error: Server error: tcp connection failed ** Near: smtp-port: open [scheme: 'esmtp] either only

13-Dec-09 3:25
15191GrahamI get this

>> set-net [ sales@coolexample.com smtpout.secureserver.net ] >> send someone@gmail.com "testing" Net-log: ["Opening" "tcp" "for" "esmtp"] connecting to: smtpout.secureserver.net Net-log: [none "220"] Net-log: {220 p3plsmtpa01-02.prod.phx3.secureserver.net ESMTP} Net-log: [["EHLO" system/network/host] "250"] Net-log: "250-p3plsmtpa01-02.prod.phx3.secureserver.net" Net-log: "250-AUTH LOGIN PLAIN" Net-log: "250-8BITMIME" Net-log: "250 PIPELINING" Net-log: ["Supported auth methods:" [login plain]] Net-log: ["MAIL FROM: <sales@coolexample.com>" "250"] Net-log: "250 Sender accepted." Net-log: ["RCPT TO: <someone@gmail.com>" "250"] ** User Error: Server error: tcp 553 Sorry, that domain isn't in my list of allowed rcpthosts.

13-Dec-09 3:20
15190Grahammake it a cgi script and see what is written to %log.txt13-Dec-09 3:19
15189Grahamtry this

rebol [] echo %log.txt set-net [ sales@coolexample.com smtpout.secureserver.net ] trace/net on send self@somewhere.com "test"

13-Dec-09 3:18
15188Grahamif sendmail works .. maybe you can use

set-net [ localhost sales@coolexample.com [

13-Dec-09 3:14
15187VonI have to create one but the GoDaddy system says that I'll have to update my database name due to the conversion.13-Dec-09 3:13
15186Grahamfrom godaddy?13-Dec-09 3:13
15185Grahamdo you have a shell account?13-Dec-09 3:12
15184VonIn the past I've always used /usr/sbin/sendmail to send e-mails via cgi but I'm lost on how to do it via Rebol.13-Dec-09 3:12
15183Grahamwell, then you need to a trace/net to see where the issue is13-Dec-09 3:11
15182VonI've supplied all necessary info in set-net, which includes username and password.13-Dec-09 3:10
15181Grahamand if you're not on your ISP ... it probably won't even let you send the email13-Dec-09 3:10
15180Grahamso you need to encode the password somewhere if you're going to use a script13-Dec-09 3:09
15179Grahamesmtp requires a password13-Dec-09 3:09
15178Grahamwell, doesn't it ask you for a password??13-Dec-09 3:08
15177VonIt works when I send an e-mail from my home laptop but not on my hosting account.13-Dec-09 3:08
15176VonI have the following smtp in my set-net: smtpout.secureserver.net13-Dec-09 3:06
15175Maximset-net is the rebol networking setup function. it is usually run on install and is stored in your user.r13-Dec-09 3:05
15174Maximso, von, if you have a godaddy mail account setup, you can connect to its smtp server directly.

is your hosted machine's set-net function setup to connect to something like smtp@godaddy ?

13-Dec-09 3:04
15173Grahamgodaddy has it's own smtp server13-Dec-09 3:01
15172VonDoes this mean, I'll need to use perl: sendmail?13-Dec-09 2:59
15171VonSMTP Relay lets you send email messages through your email account using your existing email service. For example, you can continue to use Microsoft Outlook to compose, receive, and send email messages, but the actual email messages are processed through our SMTP relaying services. This lets you bypass ISP restrictions on your outbound email messages and allows you to use your professional looking "sales@coolexample.com" email address rather than a general “sales@ispname” address.13-Dec-09 2:58
15170Maximits possible GoDaddy has an smtp relay you can connect to, which will accept connections from the hosted machine. your internet provider will not allow anyone else than its own allocated ips to make an smtp connect... for sure.13-Dec-09 2:48
15169VonYes, it's a shared hosting account; my provider is GoDaddy.13-Dec-09 2:46
15168Maximwhen you say hosting account, you mean a server on the net with its own dns/ip which is different than the ip being served to you by your access provider... yes?13-Dec-09 2:44
15167VonEven though I'm able to send e-mails from my home computer via rebol console using my host's SMTP Relay?13-Dec-09 2:40
15166Maximthat is ... if I understand your setup correctly.13-Dec-09 2:35
15165Maximyou'd have to setup an smtp server on the hosting account.13-Dec-09 2:35
15164VonSorry for the redundant posts. Altme was updating and msg board wasn't being updated at the time. I thought I was losing the info.13-Dec-09 2:34
15163Maximmost smtp servers do ip filtering on the input. this allows them to know who is sending the email to them and will only allow ips they serve to connect.

since your hosting account is probably on a remote server, it won't be allowed to send data via your home smtp server account.

13-Dec-09 2:34
15162VonHello! I'm having trouble with my hosting account to send via e-mail a cgi form response. I can get rebol to post the data to the page, I just can't get it to send the data to me via e-mail. I'm able to send e-mails from my laptop but when I use the same set-net settings on my host account I get the following error: ** User Error: Server error: tcp connection failed ** Near: smtp-port: open [scheme: 'esmtp] either only13-Dec-09 2:30
15161VonHello! I'm having trouble with my hosting account to send via e-mail a cgi form response. I can get rebol to post the data to the page, I just can't get it to send the data to me via e-mail. I'm able to send e-mails from my laptop but when I use the same set-net settings on my host account I get the following error: ** User Error: Server error: tcp connection failed ** Near: smtp-port: open [scheme: 'esmtp] either only13-Dec-09 2:30
15160Von** User Error: Server error: tcp connection failed ** Near: smtp-port: open [scheme: 'esmtp] either only13-Dec-09 2:30
15159VonHello! I'm receiving the following error when processing a cgi form to send an e-mail of the response. I correctly can send from my laptop, Rebol/Core -- command line, with my set-net settings in user.r but when I do the same thing on my hosting account I get the following error:13-Dec-09 2:30
15158Henriklooks like the change was made between 2.7.5 and 2.7.6.12-Dec-09 9:29
15157HenrikI'm debugging some code here and found that the ARRAY mezzanine has at some point been rewritten during R2 versions. Does anyone know when this happened?11-Dec-09 16:26
15156GrahamJust testing my script that logs into hotmail with gmail instead .. to download new email, and detach any attachments. Seems to be working now.11-Dec-09 8:27
15155Grahamheaders: import-email email either parse headers/content-type [ thru "boundary=" opt {"} [ copy boundary to {"} to end | copy boundary to end ]][ print ["Boundary string:" boundary] ][ boundary: none ]11-Dec-09 8:17
15154GrahamHmm. Boundary won't have a value if the parse fails ... so

either parse ... [

][ boundary: none ]

11-Dec-09 8:16
15153GrahamI discovered this when trying to detach files from gmail where there is not quote used, whereas hotmail uses the quote in the boundary string.11-Dec-09 8:13
15152Grahamthe first line is redundant, and the second line can be changed to a parse ...

if parse headers/content-type [ thru "boundary=" opt {"} [ copy boundary to {"} to end | copy boundary to end ]][ ;remove back tail boundary print ["Boundary string:" boundary] ]

which I think fixes it.

11-Dec-09 8:12
15151GrahamLooks like Sterling's fix in that thread is also incorrect. The problem is here

boundary: headers/content-type if boundary: find/tail boundary {boundary="} [ remove back tail boundary print ["Boundary string:" boundary] ]

where it looks for boundary=" but fails to take into account where there is not "

11-Dec-09 8:10
15150GrahamSee http://www.mail-archive.com/list@rebol.com/msg07169.html11-Dec-09 8:09
15149GrahamLooks like Sterling's detach.r script in the library to detach attachments from emails has a bug.11-Dec-09 8:06
15148eFishAntwow, thanks guys, for the "launch buffet" I was hungry, and you gave me to eat.11-Dec-09 2:50
15147sqlabOk, this way launch works as I would expect launch {-sq" test.r arg1 arg2 }10-Dec-09 14:32
15146sqlabI use call too in my scripts, but the question was for launch.)10-Dec-09 10:01
15145GrahamLaunch is broken that's why Gabriele is suggesting using call instead10-Dec-09 9:57
15144sqlabwith launch you can probably come next to what you want with launch {-s --do " script.r arg1 arg2"}10-Dec-09 9:52
15143Gabrielewhen you use file! call does a to-local-file automatically, and wraps it in quotes.10-Dec-09 9:19
15142GabrieleSteve: call reduce [system/options/boot %myscript.r "argument1" "argument2"]10-Dec-09 9:18

Return to Index Page