REBOL

REBOL3 - Rebol School (Rebol School [web-public])

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

#UserMessageDate
4111Evgeniy PhilippovUh. In Red, everything is possible with any bindings23-Jan 15:40
4110KajSince you'd have to switch languages anyway, you could also consider Red with the GTK+ binding23-Jan 15:15
4109KajIn R3/View, but it's currently buggy and limited to Windows and Amiga23-Jan 15:14
4108Evgeniy PhilippovIs there a possibility for cyrillic/Russian at Rebol/View except for pixelart drawing the characters?23-Jan 11:47
4107EndoScientific notation of numbers and automatic reformating time! values (00:00:00 --> 0:00) are the most annoying parts of REBOL for me. It would be more useful if it doesn't happen when FORMing.18-Jan 21:31
4106MarcoThe function by Nick is a little slow since I have a lot of numbers. This is faster but not very fast:

format-decimal: func [x /local e q] [ x: form x if find x "E-" [ e: to-integer next next q: find x "E-" clear q remove find x "." if #"-" = first x [x: next x] insert/dup x "0" e insert next x "." ] head x ] The idea from Ladislav is nice but I would like most a more "rebol" solution.

18-Jan 19:16
4105EndoUnder Checklists / Code Snippets.17-Jan 15:43
4104EndoI've also put a format-number function that I use on Checklists on Altme. It works well for me. >> format-number 1 / 3 == "0.333333333333333"17-Jan 15:39
4103LadislavYou can also check

http://www.rebol.org/view-script.r?script=printf.r

16-Jan 20:11
4102MarcoThanks. The one from Nick should be ok.16-Jan 19:10
4101GreggI have a general FORMAT func I use, but it's quite heavy as it handles a lot of things.16-Jan 19:08
4100Gregghttp://www.rebol.org/view-script.r?script=format-decimal.r16-Jan 19:06
4099GreggMany people have examples and funcs out there for it.16-Jan 19:04
4098GreggYou have to do it yourself.16-Jan 19:03
4097Marcoeithout = without16-Jan 18:58
4096MarcoIs there a way to avoid conversion of numbers to scientific notation by mold? >> mold 0.004 == "4E-3"

or have you a function to convert back a string representing a number with exponent to one eithout it?

16-Jan 18:58
4095ChristianEnve, there's TOO-MANY-REFINES in R2:

>> cause-error 'script 'too-many-refines none ** Script Error: Too many refinements

4-Jan 10:13
4094BrianHThat error is apparently not in R2 though, sorry.28-Dec 16:30
4093BrianHnve, there is a built-in error that might be better for you to use. Try this: >> cause-error 'script 'bad-refines none ** script error: incompatible or invalid refinements28-Dec 16:24
4092nve@Henrik : thanks a lot !28-Dec 10:57
4091EndoGrahamC: Thanks. I'll keep that in mind.28-Dec 8:56
4090GrahamCEndo, launch with parameters stopped workng years ago. So, we had to move to call instead28-Dec 8:51
4089Henrik>> a: func [/b /c] [if all [b c] [make error! "Only one refinement can be used."]] >> a == none >> a/b == none >> a/c == none >> a/b/c ** User Error: Only one refinement can be used. ** Near: make error! "Only one refinement can be used."28-Dec 8:11
4088HenrikThat is not possible, but you can determine presedence of use in the function body, so the outcome would be the same, or you could make an error, if both refinements are used.28-Dec 8:04
4087nveI want to declare a function with several rafinments by only one can be selected : myfunc: func [/r1 /r2] [...] myfunc/f1 or myfunc/f2 I don't want to allow : myfunc/f1/f227-Dec 23:47
4086EndoOk, now I see. If I have a encapped script and need to launch a new REBOL process to execute another script (not encapped), is it the correct way, CALL my exe with a command-line argument to execute the other script?27-Dec 23:14
4085GreggI haven't done that for commercial products where I would have to redistribute REBOL; only systems where the environment is controlled and REBOL is in use/licensed.27-Dec 23:07
4084GrahamCyou don't need key if encapped.27-Dec 23:06
4083EndoYou put rebol.exe into your encapped file? Or into the same folder? And how do you put license.key to enable /Pro features?27-Dec 23:05
4082GreggIn cases where I need to launch REBOL from encapped, I have included config options; sometimes on a per-command basis, so I can launch a specific version of REBOL for different needs.27-Dec 23:02
4081GreggYes.27-Dec 23:00
4080Endo@Pekr - @Gregg: Thank you. For encapped files, system/options/boot points to encapped .exe right?27-Dec 22:52
4079GreggI standardized on using CALL some time back, as RUN and LAUNCH weren't available or consistent in all REBOL versions. system/options/boot makes using CALL easy for LAUNCH-like behavior.27-Dec 22:50
4078PekrNot sure launch can do that, or if there was not related any bug. But - you might use CALL, it is now free ....27-Dec 13:19
4077EndoI'm using R2 2.7.8.3.127-Dec 12:50
4076EndoIs it possible to send command -line arguments to the new REBOL process using LAUNCH? launch "test.r" ;this one works launch "-s test.r" ;REBOL starts in TRACE ON mode (I don't know if %test.r will start or not, too much trace log to wait) launch "--secure allow test.r" ;shows USAGE and doesn't start %test.r launch "-q test.r" ; trace mode again.27-Dec 12:50
4075BrianHThe main built-in function that takes advantage of the flexibility is FUNCT, which copies the spec and body before it does its collection of locals and binding to the static local object. In R2, the spec and body are copied again after that by the MAKE action, doubling the copying overhead. In R3, they aren't.24-Dec 19:46
4074BrianHThe inconsistency between R2's and R3's spec and body copying behavior during MAKE function! was an efficiency issue. The startup code of R3 uses a non-copying version of FUNC, and this speeds up startup quite a bit. However, the function builder mezzanines copy the spec and body, moving the copying behavior from the MAKE action to the mezzanine code - it's still about as fast because the actual copying is done by the same native code. As a side benefit, we get a bit more flexibility when we need it, especially when you don't leak references to the original spec and body that were passed to the MAKE action. MAKE module! does the same non-copying behavior for the same reason, though MODULE doesn't make a copy because the body is generally even bigger, and is not saved at all in the constructed module.24-Dec 19:36
4073BrianHThe inconsistency between R2 and R3 is because R3's reflection model was changed to be more secure, and easier to sandbox. In R3 you can't get a reference to the real spec and body of a function after the function is created, at least from non-native, non-debug code. That is why the hack above required saving a reference to the spec from before the function was created; if you don't do that, you won't be able to get at the spec or body afterwards if your security settings are set to the defaults (and turned on - that's another story).24-Dec 19:14
4072BrianHHELP uses WORDS-OF to show the arguments at the top, but uses SPEC-OF to get the detailed argument help below. The spec returned by SPEC-OF doesn't have any effect on the execution of the function - it's just documentation.24-Dec 19:04
4071BrianHJanko, don't worry, I got it. The message beginning with "In C1 and C2 you are " was in answer to your question.24-Dec 18:59
4070Steevein R2, one can't prevent MAKE to reconstruct functions. in R3 you,can do such by using COPY instead.24-Dec 11:14
4069Jankoabout my example code, I didn't explain it good enough. I am not giving them arguments intentionally .. I will make better example.24-Dec 10:32
4068JankoBrian: interesting inconsistency. I have no idea how come it happens, I would assume help somehow uses words-of to show arguments so it couldn't happen :)24-Dec 10:31
4067BrianHNote: In R2, if you use the old-style reflectors to get at the spec then you can replicate the R3 weirdness because it returns a reference to the original spec. The SPEC-OF reflector is much safer, even in R2, because it returns a deep copy instead. Have I mentioned lately just how bad it is to use the R2-style ordinal reflectors instead of the R3 style *-OF reflectors?24-Dec 7:06
4066BrianHIt doesn't work that way in R2. Changes to a reference to the argument spec block don't change the function after it's created. Like this: >> a: [a] b: make function! a [print a] >> change a 'b == [] >> source b b: func [a][print a] >> words-of :b == [a]24-Dec 6:52
4065BrianHNote the inconsistency in the help? That's the weird part.24-Dec 6:47
4064BrianHWhat's weirder (only tested in R3 so far): Once the function is created its argument words are bound to the internal function context, and bindings are by position in the context (though BIND determines this position from the name at binding time). That means that after the function is created, the displayed argument block is just documentation - the real argument list is the function context. This means that if you create the function using MAKE directly and keep a reference to the spec block, then change that spec block, the changes don't affect the function's behavior or what WORDS-OF returns. Like this:

>> a: [a] b: make function! reduce [a [print a]] >> b 1 1 >> change a 'b == [] >> b 1 1 >> source b b: make function! [[b][print a]] >> words-of :b == [a]

>> help b USAGE: B a

DESCRIPTION: (undocumented) B is a function value.

ARGUMENTS: b

24-Dec 6:46
4063BrianHIn C1 and C2 you are creating new functions and assigning them to their 'b fields. In C3 you are just making a rebound copy of the function created in C1, which still has an [a] argument block. Changing the value of the object field a doesn't change the argument list of the function assigned to the object field b after that function has been created.24-Dec 6:36
4062BrianHYou need to provide parameters to those /b functions.24-Dec 6:25
4061JankoPlease look here instead: http://pastie.org/3065592 -- the point is when I extend c1 with c3 and define a I want that b which I didn't redefine takes the a from c3 not c1 where it was created (which I do understand is normal behaviour). Is this even possible?24-Dec 6:08
4060Jankoah .. I didn't copy the first line.. I will copy this to some page rather than again here.24-Dec 6:05
4059JankoI have one binding + object question that is beyond me.. .this code represents it: > c2: make c1 [ a: [b] b: func a [ print b ] ] >> c1/a == [a] >> c1/b ** Script Error: b is missing its a argument ** Where: open-proto ** Near: c1/b >> c2/a == [b] >> c2/b ** Script Error: b is missing its b argument ** Where: open-proto ** Near: c2/b >> c3: make c1 [ a: [b] ] == [b] >> c3/a == [b] >> c3/b ** Script Error: b is missing its a argument ** Where: open-proto ** Near: c3/b24-Dec 6:04
4058JankoI am using rebol for quite few years now and I didn't know it :)24-Dec 6:03
4057KajYes, COMPOSE flattens outer blocks23-Dec 23:27
4056Jankotoday I discovered maybe fairly obvious thing about rebol, that was bugging me for long time and I thought there is no solution: compose [ ([]) ] == [] compose [ ([ 1 2 3 ]) ] == [ 1 2 3 ]

I just assumed taht compose functions the same way as reduce and never looked in details. And there were many instances where I would need such behaviour and I had to invent worse solutions because I didn't think it was possible with rebol.

I had it as one sign that rebol is not as mature as lisps because there you have @to deconstruct list in such a manner. But now I see we have even cleaner solution also.

23-Dec 20:58
4055EndoThanks a lot.21-Dec 14:21
4054Steevehttp://www.rebol.org/view-script.r?script=window-util.r21-Dec 14:16
4053EndoThere is already a ticket on RAMBO #3660. Any easy way?21-Dec 13:53
4052EndoIs there a easy way to set REBOL Console title other than "REBOL/View"? I want to give output to console but cannot change the title.21-Dec 13:39
4051Steevebtw, in R2, forskip is a mezz (may be slow)20-Dec 16:21
4050Steevein R3: >> append context [] [a 1 b "c"] == make object! [ a: 1 b: "c" ]20-Dec 16:15
4049Jankoand I was thinking that there has to be something default already made .. thanks! I will create some func our of your code20-Dec 14:05
4048Jankoah.. i forgot about change function, so my solution was more ugly20-Dec 14:03
4047GeomolOne way:

data: [ a 1 b "c" ] forskip data 2 [change data to set-word! data/1] data: make object! data

I don't know, if there is a simpler function call, but you could wrap that into your own new function.

20-Dec 14:02
4046Jankois there already any way to turn block to object like data: [ a 1 b "c" ] ===> data: make object! [ a: 1 b: "c" ] so I could >> do bind [ print a ] data ; or do I have to do that "manually" ?20-Dec 13:56
4045OldesAlso for me it's more easier to put scripts on github than rebol.org as most of scripts are build from multiple files.3-Dec 20:13
4044OldesI guess it could be even more minimalized.. this subset was enough for my needs. As you can see in the parsed routines, there is much more what can be done, but it requires time to work on it. Also I don't consider R3 evolving so I stoped experimenting with it and in the free time I would rather play with Red (but Red is missing decimal support so it cannot be used with bindings like FMOD or imageMagick)3-Dec 20:09
4043Marco@Oldes: Is that set minimal ?! Are there much more things to translate? Why don't you put it on rebol.org?3-Dec 19:36
4042OldesFor imageMagick you can find useful parsed specs for magick_wand and pixel_wand routines https://github.com/Oldes/R3-extension-iMagick3-Dec 18:55
4041OldesI'm mainly using ImageMagick in a real live (R2) - here is a minimal set of routines - https://github.com/Oldes/rs/blob/master/projects/imagick/minimal/imagick.r3-Dec 18:52
4040GrahamCOldes and R3 https://github.com/Oldes/R3-extension-FMOD3-Dec 18:31
4039GrahamCI thought someone had done fmod already ? Was it pekr or anton ?3-Dec 18:29
4038MarcoI don't know where to post this request, so I put it here: I am translating some .h files of useful shared library to rebol ( fmod,sdl,opengl) so if you know of a useful-multiplatform-publi-shared library please give me lonks to binaries, .h files and test programs, thanks.3-Dec 18:18
4037AwiThanks Kaj, I really appreciate it.1-Dec 1:15
4036KajOSM-GPS-Map is thus simpler to roll out, but it is GPL instead of LGPL, so it can't be used in closed applications30-Nov 19:48
4035KajChamplain is much more complete and generic, except maybe the GPS track functionality. However, it uses Clutter, so OpenGL, so that must be available on your target platform30-Nov 19:47
4034Awi@Kaj: Sorry, a little of the topic. For the future, I'm planning to replace the Rebol 2 UI side of my app to use libchamplain or osm-gps-map. Hopefully I can already use red by then (currently python is in my mind). Which one do you think is more mature and easy to use? My app would only display OSM tiles and draw some objects and lines on it. Thanks for your opinion and pointing me into these libraries.30-Nov 5:01
4033AwiHenrik, Kaj, Marco, thanks for the help, I will look into those. Sorry for the late reply.30-Nov 4:47
4032Marco@Awi: http://www.rebol.org/view-script.r?script=threaddemo.r&sid=w2hg26-Nov 19:12
4031KajThere's the minor issue that I still have to make them, so I hope it will work :-)25-Nov 2:08
4030DockimbelLooks good :-)24-Nov 23:45
4029Kajhttp://www.geofreedomday.nl/2011/Red-System.html24-Nov 16:46
4028KajNot sure if this will be usable for you, but I have Red bindings to two OSM GTK+ libraries lined up that I will present at the GeoFreedomDay meeting December 1024-Nov 16:38
4027HenrikAwi, maybe this is useful:

http://www.colellachiara.com/soft/Libs/async-http.r

24-Nov 8:45
4026AwiHi, I am trying to write a Rebol app that download some .png map tiles from OpenStreetMap, and display them. Since Rebol does not support multithreading, while downloading every map tile, the user will face a non responding screen, which is not very nice. Is there a known trick to download in background, or something like that? Many thanks..24-Nov 7:32
4025PekrIIRC, Max worked on R3 interfacing to .Net for some commercial entity. Not sure what' the current state, nor if it is going to be released to the public ...23-Nov 23:11
4024DockimbelYou're welcome, thanks for bringing that interesting topic. ;-)23-Nov 21:37
4023SingyWell guys, I gotta go now, but thanks for all your help and for the stimulating discussion!23-Nov 21:33
4022Dockimbel(but we're moving out of Rebol Schoold channel topic)23-Nov 21:32
4021DockimbelPARSE support: certainly! Supporting .Net as a target for Red compilation (more accurately: for Red/System compilation) is in the roadmap, but not a high-priority though.23-Nov 21:32
4020BrianHIn that case, reimplementation starts to look pretty good, or maybe even a Red port if it gets PARSE support :)23-Nov 21:30
4019BrianHAs someone who uses MS SQL Server a lot, being able to call R3 from .NET could lead to stored procedures written in REBOL, maybe :)23-Nov 21:28
4018SingyIt will be interesting to see how Doc pulls it off then when he gets to that stage in Red (interfacing to .Net I mean). I love REBOL but as a netwok admin who lives in a world of Windows being able to interact with all things Windows from REBOL would be heaven :))23-Nov 21:25
4017BrianHThat's how the Iron* languages did it :)23-Nov 21:22
4016SingyLOL - not much chance of that then!23-Nov 21:22
4015BrianHYou would have to rewrite REBOL from scratch to run it in the DLR.23-Nov 21:21
4014SingyHosting the Common Language Runtime - as per that last article sounds interesting - I wonder how large that would be. What about running REBOL in the DLR like iron python etc. Is such a thing doable? Or is that a blasphemous though to REBOlers?23-Nov 21:21
4013DockimbelBut, as for C++ wrappers, you need to statically make the bindings to given managed functions.23-Nov 21:15
4012DockimbelIt seems to be possible to write C wrappers for managed code too: http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-interop/5678/Can-Unmanaged-Code-call-LoadLibrary-on-a-managed-DLL23-Nov 21:14
4011DockimbelI meant using a powershell script for writing a server that would receive commands from a REBOL client through TCP. The REBOL client could then hide the powershell commands inside adequate REBOL functions, making it feel more natural.23-Nov 21:14
4010SingyUsing a powershell script definitely works because I have tried it - I just used: call "powershell scriptname.ps1" and it worked. But of course I need to know 3 languages to do this - REBOl, powershell and .Net.23-Nov 21:11
4009Dockimbel(using a TCP channel)23-Nov 21:06
4008DockimbelMaybe you could just make a simple powershell script for making it work as slave for REBOL.23-Nov 21:05
4007DockimbelFrom REBOL, you could set up a TCP communication channel with a .Net app to pass commands and receive data. You can achieve that using plain REBOL code or using a messaging library like 0MQ.23-Nov 21:04
4006DockimbelDoing a quick search on this topic (as it's interesting also to me for Red), it seems that LOADing a .Net library is at least possible from C++: http://stackoverflow.com/questions/757298/loading-managed-c-dll-from-plain-c-program-via-loadlibrary23-Nov 21:02
4005SingyThanks Doc. However, is there a way to tap into .Net from REBOL? As a network admin it would be useful at times. I know you can use call to draw upon powershell which in turn can use .Net but that seems a bit convoluted. Also I can use wmic via call as well. Any other thoughts on REBOL and .Net integration?23-Nov 20:58
4004Dockimbel"make routine!" only works on LOADable libraries, so you guessed right, you cannot do that for managed code.23-Nov 20:50
4003SingyI have another question - probably a dumb one - can you use make routine! to tap into .Net or is this impossible because it is a managed language?23-Nov 20:09
4002SingyWell - looks like I might be living with it for a few more yet - grins.23-Nov 20:04
4001Dockimbel/SHOW is a late addition to CALL, we used to live with the DOS window for years.23-Nov 20:03
4000SingyYes I think it is a bug, because the whole point of /output is to not use shell window but to capture the data that would be sent to it and use it instead in your program. Anyway - at least this is a workaround for now. Thanks for your input guys :))23-Nov 20:01
3999Dockimbel(the hanging, not the blank window).23-Nov 19:59
3998DockimbelIt's probably a REBOL bug.23-Nov 19:59
3997Dockimbel/SHOW is for showing the shell window, it's blank because the output is captured by REBOL.23-Nov 19:58
3996SingyCool! Yes it does. Thanks Doc, but strange why it should need that - especially when the ugly blank console window now pops up.23-Nov 19:56
3995DockimbelWith a shorcut, it hangs too, but if you add a /SHOW refinement to CALL, it works.23-Nov 19:55
3994DockimbelLet me try with a shortcut on 2.7.6...23-Nov 19:49
3993DockimbelWith Pekr's command-line, it hangs on once the ping finished.23-Nov 19:48
3992SingyDock the shortcut target line, when run in a cmd console runs the program fine. The only time it does not run is when I try to run the same command from the shortcut!23-Nov 19:48
3991DockimbelWorks here on Windows 7 (using Singy's command-line). I'm using REBOL 2.7.6 though, so it might be another issue with CALL native in 2.7.8.23-Nov 19:46
3990BrianHIt works without start though, even if you do call/show. Maybe it's a bad interaction with start, Pekr.23-Nov 19:43
3989Pekrhmm, I tried call/output "start ping 10.10.10.10 -n 2" tmp: copy "", and R2 hangs too ....23-Nov 19:31
3988SingyC:\Users\Ken\Dropbox\Rebol\rebol.exe -s "$(FilePath)" The intial directory is: $(FileDir)

I'm using REBOL 2.7.8.3.1

23-Nov 19:31
3987BrianHWhat's the command in Crimson Editor for running a file of that type?23-Nov 19:29
3986SingyTried it - it still hangs, bizarre!!23-Nov 19:22
3985SingyWhen you use the /input, /output, /error, or /console refinements you automatically set the /wait refinement. -- according to the docs, but I will try it anyway :)23-Nov 19:20
3984Pekrtry using call/wait/output. Your above code should work though ...23-Nov 19:16
3983SingyC:\Users\Ken\Dropbox\Rebol\rebol.exe -s C:\Users\Ken\Dropbox\Rebol\ping-servers.r23-Nov 19:15
3982PekrWhat's your shortcut command?23-Nov 19:14
3981Singyip: ["DC1" 10.75.48.14 "DC2" 10.75.48.11 ]

foreach [name address] ip [ tmp: copy "" print join "Pinging " name print "***********************************************************" call/output reform ["ping " address " -n 2"] tmp print [head clear find/last tmp "Ping"] ]

When I run it via a shortcut (on Windows 7) it prints this:

Pinging DC1 *****************************************

and then it just hangs until I force it close.

Any ideas why running it via a shortcut would do this when running it via Crimson it works fine???

23-Nov 19:05
3980SingyWhen I run this program via Crimson Editor it works perfectly:23-Nov 18:57
3979todun@Sunanda, thanks again for pointing that out.8-Oct 10:23
3978Sunandathe resetting happens at the places where you see ... xxxx/text: "" ;; (changes the value in the field) show xxx ;; (redisplays the field on screen)8-Oct 9:24
3977todun@Henrik, thanks.8-Oct 8:06
3976Henrikyes, also that. I thought you would be interested in the source as well.8-Oct 7:29
3975todun@Henrik, do you mean 'help set-face' ?8-Oct 7:29
3974todun@Henrik, thanks. will do.8-Oct 7:28
3973Henrikif you use:

source set-face

you can see what it does

8-Oct 7:26
3972Henriktry SET-FACE and CLEAR-FACE instead of setting and clearing face/text directly.8-Oct 7:26
3971todun@Sunanda, thanks. Let me play with it to see where the info view reseting takes place.8-Oct 7:22
3970Sunandaquestion-database: [ ["Doctor who?" "Oops -- silence has fallen"] ["Is there a doctor in the house?" "Yes -- his name is Gregory"] ]

next-question: func [ ;; function to find and display the next question ][ question-database: next question-database if tail? question-database [question-database: head question-database] question-field/text: first first question-database answer-field/text: "" show question-field show answer-field ]

;; code to define and run the panel unview/all view/new layout [ across question-field: field "" answer-field: field "" return answer-button: button "show answer" [ answer-field/text: second first question-database show answer-field ] next-button: button "Next question" [ next-question ] ]

;; open code to start it running next-question do-events

8-Oct 7:18
3969SunandaThe code in the next post demonstates most of the mechanics of what you are asking for:8-Oct 7:17
3968todunFor example, if I press question button(displays the question in an info view), and then I press answer button(which displays the corresponding answer), when next I press question, I want the answer info view to go back to being blank. How can I do this? thanks.8-Oct 6:40
3967todunIs there anyway to clear an info view after a button is pressed?8-Oct 6:39
3966todun@Henrik, @GrahamC, thanks.6-Oct 21:27
3965GrahamCR/View incorportes R/Core6-Oct 17:42
3964Henrikgraphics related stuff is not possible in REBOL/Core.6-Oct 16:07
3963todun@Geomel, thanks. Also, is it allowed for me to use REBOL/Core when doing stuff in REBOL/View?6-Oct 15:49
3962GeomolPass! I'm not enough into your problem to point you into a direction. But go on and read some more of the docs, and you should be able to help yourself some more:

http://www.rebol.com/docs/core23/rebolcore.html http://www.rebol.com/docs/dictionary.html

6-Oct 15:09
3961todunI don't want to use REPEAT because I only want to do it while I press the button6-Oct 14:42
3960todun@Geomol, INDEX? will tell me its position, but the circular series link I sent you talks about how to always go around and around the series. I want to do the same with the lines of a file, but I'm not sure how to do it without using REPEAT6-Oct 14:41
3959GeomolThings like INDEX? will tell you, where you are in a series. And you can easily save rebol code/values to disc using the SAVE function, and load them again with the LOAD function.6-Oct 14:37
3958todunWhat I mean is that, if I read the file and end my read at a particular location before closing the GUI, does REBOL allow you to presist your state across executions of the program?6-Oct 14:32
3957todunDoing a file access and then storing the state of your access, writing that to file, seems quite difficult to formulate in REBOL, for me anyways.6-Oct 14:31
3956todun@Geomol, thanks for clearing that up6-Oct 14:30
3955GeomolBecause those blocks are action facets described here: http://www.rebol.com/docs/view-guide.html#section-17

When you interact with a style, in this case a button, those blocks are evaluated as if they were normal REBOL code, so the rules of the layout dialect doesn't rule there.

6-Oct 14:29
3954todunbut I want to be able to always go round around the list, go round around the file and also write to file the current location I am at.6-Oct 14:29
3953todunmy ultimate goal is to deal with circular lists. Using this doc, I can make one:http://www.rebol.net/cookbook/recipes/0017.html6-Oct 14:28
3952todunI mean to ask, why does it work?6-Oct 14:25
3951todun@Geomol, so why don't I put the DO[...] around code inside the btn blocks that are not like VID commands?6-Oct 14:25
3950todunI stand corrected. Maybe that didn't make sense to me at the time, or I skipped that part of the doc.6-Oct 14:24
3949GeomolYes, it does. At: http://www.rebol.com/docs/view-guide.html#section-446-Oct 14:20
3948todun@Geomol, I've looked at that doc. It doesn't specifically tell you anywhere what to do with the dialect when you want to introduce foriegn coding to the dialect.6-Oct 14:19
3947todun@Geomol, oh ok. let me change that now.6-Oct 14:18
3946GeomolTo know, how to use the LAYOUT dialect, read the doc: http://www.rebol.com/docs/view-guide.html

That's what we do.

6-Oct 14:18
3945todun@Geomol, that dialect description is helpful. What context can I use a dialect, the VID in this case, and how do I know what data-types to use and what external things to the dialect to use(or not to use)?6-Oct 14:17
3944GeomolEh, did you put the new DO block around all the content inside your LAYOUT block? I just suggested, you should put it around the first 3 lines.6-Oct 14:17
3943todun>> do %circular_series.r ** Script Error: btn has no value ** Where: forever ** Near: show-one: btn "Show answer" [ one-position: ++ current-position line: pick lines one-position result/text:...6-Oct 14:16
3942todun@Geomol, when I run the script with the DO include, I get the following:6-Oct 14:16
3941GeomolBut try put the DO [..] block in, as I suggested, and tell us, if it works then.6-Oct 14:15
3940GeomolIn your example, you use the LAYOUT dialect, and you have to follow the rules of that dialect.

A dialect is a sequence of datatypes, that hold a certain meaning, because they're used in a certain context.

6-Oct 14:15
3939todunin the context of my problem, my getting this error?6-Oct 14:14
3938todun@Geomol, ok. In this context, what does dialect mean?6-Oct 14:14
3937todunalso you say I put "other stuff" and such. I'm guessing this means I'm mixing code in a non-kosher way. From a paradigm-like sort of way, how to I separate out my code in REBOL way or the correct way?6-Oct 14:13
3936GeomolWhat does the english word "book" mean?

Is it "a book" you can read in, or is it "book a ticket". You see, the same word can mean more than one thing. Same in REBOL.

6-Oct 14:13
3935todun@Geomol, what about dialects ?6-Oct 14:12
3934GeomolSure, but that's another DO. :) Think dialects. I know, it's hard at first.6-Oct 14:11
3933todunDO6-Oct 14:11
3932todun@Geomol, when I call the file in the CLI, I use do6-Oct 14:11
3931GeomolTry change your block so it starts:

button-press?: layout [ do [ lines: read/lines %question-list.txt current-position: 1 ; len: length? lines ] ...

6-Oct 14:10
3930todunwhat do I need to do to make it in the VID dialect?6-Oct 14:08
3929todun@Geomol, @Pekr, thanks. I am trying to make flashcard display. However I want to do it myself so that I see all the places where I hiccuped.6-Oct 14:08
3928GeomolDO in the VID dialect is described here: http://www.rebol.com/docs/view-guide.html#section-446-Oct 14:02
3927GeomolA quick guess would be, that the code will work, if you put DO [ ... ] around the code in the beginning of the block after LAYOUT.6-Oct 14:01
3926GeomolWe all went through those times, where we needed to realize, what dialects are, so don't give up.6-Oct 14:00
3925PekrIt would be probably better if you would describe what you want to do, then someone might write the code right from the scratch :-)6-Oct 14:00
3924GeomolThe dialect is called VID in this case. Read: http://www.rebol.com/docs/view-guide.html6-Oct 13:59
3923GeomolUh, I think, you make the mistake, that the interiour of the LAYOUT block is actually a dialect. You put all kind of code in it.6-Oct 13:58
3922todunbutton-press?: layout [ lines: read/lines %question-list.txt current-position: 1 ; len: length? lines

show-one: btn "Show answer" [ one-position: ++ current-position line: pick lines one-position result/text: line show result ]

show-soon: btn "Soon" [ soon-position: does [current-position: current-position + 5] line: pick lines soon-position result-soon/text: line show result-soon ] result: info " " result-soon: info " " ]

6-Oct 13:56
3921todun@Geomol, restarting rebol didn't me.6-Oct 13:56
3920Geomol:D Post along!6-Oct 13:56
3919todun@Geomol, how many lines is too long?6-Oct 13:55
3918GeomolA mistake is sometimes, that part of REBOL was changed, as everything can be redefined. If that's the case, you can try restart REBOL and see, if the error is still there.

And yes, you can post code, but most don't like it, if it's too long.

6-Oct 13:53
3917todunCan I post code here or something so you can see what I'm doing right or wrong?6-Oct 13:47
3916todun@Geomol, no. This worked before.6-Oct 13:44
3915todun@Pekr, thanks. Will see if that can fit into my implementation.6-Oct 13:43
3914Pekrtodun - a little bit more dynamic version of counter:

counter: func ['var add-value][if not value? var [set var 0] set var (get var) + add-value]

counter x 10 ; --- x does not have to exist, and if is inicialised and set to 0

6-Oct 13:09
3913GeomolMaybe there are some strange data in the file?6-Oct 13:01
3912todunWhat does a misplaced item error mean? I get it when I try to read a file like so:

lines: read/lines %file.txt

6-Oct 12:59
3911todun@Geomol, good to know. thanks.6-Oct 12:50
3910GeomolAnyway, pretty much everything is possible in REBOL, so just specify as precise as you can, what you want, and someone will come up with an idea how to do it.6-Oct 12:49
3909todun@Geomol, thanks. That is perfect.6-Oct 12:48
3908Geomol>> counter: does [x: x + 5] >> x: 0 == 0 >> counter == 5 >> counter == 10

Or do I misunderstood?

6-Oct 12:48
3907todunso everytime I call counter it should result in 5, 10, ...6-Oct 12:47
3906todunis there a way to add 5 to a variable anytime it is called? for example x: 0 .... counter: x + 56-Oct 12:46
3905todun@Kaj: Ok thanks.6-Oct 5:27
3904KajPlease follow the many tutorials linked from the REBOL site5-Oct 23:46
3903todun@Kaj, ok. do you have an example in mind?5-Oct 23:45
3902KajActions within the GUI dialect are regular REBOL code, so they can be anything5-Oct 23:44
3901KajPerhaps, but an alert usually has its own little dialog GUI5-Oct 23:43
3900todun@Kaj, oh I see. So an action like an Alert?5-Oct 23:42
3899KajNo, as I say, we don't usually use MVC as such. Any View example shows how to specify some GUI with some actions5-Oct 23:42
3898todunKaj, I have looked at several REBOL tutorialss and I cannot seem to be able to make them do exactly what I wanted, hence my pining for a paradigm like MVC.5-Oct 23:42
3897todun@Kaj, can you point me to a sample program that has these features you speak of?5-Oct 23:41
3896KajIf you have little experience with all the forms of MVC, it's better to forget it and just follow the REBOL tutorials5-Oct 23:41
3895KajFor simple programs, that code is often so small that we tend to write it out directly in the GUI dialect5-Oct 23:39
3894KajThe GUI dialect has places for actions. That's where your model and controller functions would go5-Oct 23:38
3893KajWhat you call idiom would mostly be the View dialect. That's specifically for specifying GUIs5-Oct 23:38
3892todun@Kaj, Also, when I have a Model with multiple parts that are best represesnted as functions themselves, how can I make it available to the view(these "sub-functions")?5-Oct 23:37
3891todun@Kaj, I've not used MVC much myself, but the rumor out there is that it's one way to go. So when you say connect them, what do you mean?5-Oct 23:36
3890todun@Kaj, thanks. This is begining to make sense. The view is like a template, something static the user will see. The MODEL, is a function, the controller coordinates with Model and View somehow.5-Oct 23:35
3889KajModel and controller would be functions, that you can then connect to the View GUI5-Oct 23:33
3888KajA view is typically a template. In REBOL, it would be a piece of View dialect5-Oct 23:32
3887todun@Kaj, ok. So I can just write all my VIEW as a function. Repeat the same for Model and CONTROLLER? How will I then combine them?5-Oct 23:30
3886KajJust write the three MVC parts and then fit them together5-Oct 23:28
3885KajThere's not much idiom for this, like in general in functional languages, because for such a small program, not much code is needed in REBOL5-Oct 23:28
3884todun@Kaj, what is idiomatic REBOL to approach my problem? How do I make sense of it?5-Oct 23:25
3883KajIt's a good approach to want to design a first REBOL GUI program in MVC parts, but I think you'll find when you fit them together, that the resulting code would blend together. We don't really talk in MVC terms about View code5-Oct 23:24
3882todun@Kaj, I just reposted. Oops.5-Oct 23:06
3881KajThe answer is in there, so I don't think you'll have to repost :-)5-Oct 23:05
3880todun@Kaj: do I repost the question there or is this information someplace online?5-Oct 23:04
3879KajLook in the !QM QuarterMaster group here5-Oct 23:03
3878todunhow can I do MVC(Model View Controller) in REBOL? Thanks.5-Oct 22:35
3877todun@PeterWood, ok. thanks. I will try that.5-Oct 12:58
3876todun@Henrik, thanks for the tip.5-Oct 12:57
3875Henrikwe usually simply say "let's talk in group X", if a specific topic is inappropriate for the current group.5-Oct 12:44
3874todun@Kaj, I have no idea what the conventions are here or what all the different rooms mean. I assumed that my questions in "I'm new" were not meeting the requiremetns of the room so I posted here. Sorry if I'm tresspasing on some rule here.5-Oct 12:39
3873PeterWoodSo I believe the answer to todun's issue is the need to use the binary refinement of write to stop REBOL adding a newline at the end of the file.5-Oct 12:39
3872PeterWoodHere is the correction:

>> write %a.txt "12345^/" >> read/binary %a.txt == #{31323334350A} >> write/binary %b.txt head remove back tail read %a.txt >> read/binary %b.txt == #{3132333435}

5-Oct 12:38
3871PeterWoodJohn: It isn't it was my mistake.5-Oct 12:37
3870KajPlease don't cross-post, thanks5-Oct 12:09
3869todun@PeterWood, thanks for the suggestion. I will try that.5-Oct 12:06
3868todunHow do I make the data loaded from the file change to another token in the file when I click another button?5-Oct 12:06
3867todunHow do I make a file containing tokens on each line be displayed one at a time in an "info" field (.ie. non-modifiable view, just readable) on the view when I click a button?5-Oct 12:05
3866GeomolPeter, on what system is #{0E} a newline?5-Oct 8:46
3865GeomolThe example with trim/tail does remove the newline from the end here.5-Oct 8:44
3864PeterWoodCan you show the last few characters of your file here?5-Oct 8:23
3863PeterWoodThe code that I gave does remove a newline from the end of a file:

>> read/binary %a.txt == #{31323334350E} >> write %b.txt head remove back tail read %a.txt >> read/binary %b.txt == #{3132333435}

5-Oct 8:20
3862todun@GrahamC, how do I accomplish this?5-Oct 7:35
3861GrahamCYou should be able to open/direct, skip to the end and write a space or null to the end5-Oct 7:04
3860todunPeterWood: Thanks . sadly that didn't work either. though the other issues are greater at this point.5-Oct 5:44
3859PeterWoodTry:

write %b.txt head remove back tail read %a.txt

(I think that trim doesn't treat a "newline" as whitespace)

5-Oct 4:46
3858toduntrim/tail did not work for me.5-Oct 3:41
3857todunThen when I quit the view, I will have the last line read be the starting point.5-Oct 3:40
3856todunSo one button will let me go 5 lines in the file. Another 20 lines etc.5-Oct 3:37
3855todunMy intention is to have a button that I will press that will tell me what the next line to read and display will be.5-Oct 3:37
3854todun@Ashley Thanks. I will try that. Also, do you know how I can display each line of a file in an "info" field when using "view layout"?5-Oct 3:36
3853Ashleywrite %b.txt trim/tail read %a.txt5-Oct 3:27
3852todunmy last attempt to connect to the room failed...5-Oct 1:10
3851todunis there a way to remove the newline at the end of a file?5-Oct 1:09
3850todunis there a way to remove the newline at the end of a file?5-Oct 0:42
3849todunhello.5-Oct 0:41
3848Marco@Henrik I have a mix of "settable" and "unsettable" values (eg. the color of a "box") and I don't use your kit (at the moment).21-Aug 18:56
3847Geomol:) Nice way to put it, Henrik!21-Aug 9:30
3846HenrikMarco, my response to you seems to have scrolled away. Did you get it?21-Aug 9:16
3845shadwolfrebol school is yet another self satisfactory idiom used by those self proclamed gurus21-Aug 9:14
3844shadwolfrebol school my ass you don't even know how to do a dialect or to properly use parse21-Aug 9:13
3843shadwolfrebol school is void since the core stuff designing rebol isn't populated PARSE21-Aug 9:13
3842shadwolfand trust me I'm teared ... I stupidly love rebol and all the things rebol tryed to create --- but I like nenad's guts to get ride of your doing the same thing .... cause that was you really deserve21-Aug 9:00
3841shadwolfso far for me all of you failled only nenad succed in a thing and it was doing something else than rebol21-Aug 8:58
3840shadwolfsunanda I want to talk with you ... like I want to talk to robert and to any self proclamed gurus acknoledged by carl21-Aug 8:57
3839shadwolfand trust me if you give me the power on rebol.org change is gona happend21-Aug 8:56
3838shadwolfsunanda I won't go to vent cause this will just allow you to once again ignore me ... so please answer or even blame me and offer the means to redem myself21-Aug 8:55
3837shadwolf7 years later sunanda can you say here to me that rebol.org isn't a pain in the ass for script subscribers ?21-Aug 8:54
3836SunandaShadwolf -- you are off-topic for this group. Please switch to ~vent. Thanks!21-Aug 8:54
3835shadwolfand I liked all the improvement done to rebol.org .... sunanda really but the core thing "script submition" never improved21-Aug 8:53
3834shadwolfsunanda don't take me wrong .... even carl don't use rebol.org he use github as a rebol.org how can you stand this ?21-Aug 8:52
3833shadwolfmy comment to rebol,org sunanda in 2004 was obvious can't you do a form for the very heavy header submision ? ahnd in 2011 it's not done ...21-Aug 8:51
3832shadwolfbut since 2004 it was your baby and no one had to give a comment on it21-Aug 8:50
3831shadwolfwhen you fail guys you need someone to tell you so honnestly without any corner and you know if you ask me I woudl be the very first in contributing21-Aug 8:49
3830shadwolfand sunanda understand me .. I like you ... I appreciate you like I appreciate cyphre and robert munch or carl ,,,21-Aug 8:48
3829shadwolfit takes me than 30 mitnute to submit a rebol script ! you failled!21-Aug 8:47
3828shadwolfsunanda I tryed to talk to you even to offer to you help to make rebol.org better you ignored me those past 6 years buddy so keep doing it you website is a shame it tasks more than 30 hours to submit a scrit you failled21-Aug 8:46
3827shadwolfi think to appriaciate my work ability only the people close to me can ... like maxime or steeeve ..... I really like steeeve ... and maxime and if it was up to me to do r3gui I choose them with a set of feature... I would had to the experience ashley truter telling him to do what he did in the rebGUI begining and forgetting on the over optimised code redused habite he developped later on this project<d21-Aug 8:45
3826SunandaShadwolf -- you are off-topic for this group. Please switch to ~vent. Thanks!21-Aug 8:44
3825shadwolfI can't beleive rebol get such a pathetic endign21-Aug 8:40
3824shadwolfcause I always was the faster developer in what ever goal was assigned me and you all know as professionals that the faster to do the job gets the job ----21-Aug 8:40
3823shadwolfthis until this very day is the raw phylosophy carl sassenrath passed to me and that I in my everyday life applyed .. and it made me so far really successfull21-Aug 8:39
3822shadwolfdo rebol is a waste of time ? wel kind of .... but the thing that rebol teach the nooby wanabee programer i was in 1998 is to keep it simple and to focus onm the goal ....21-Aug 8:38
3821shadwolfamd trust me none of them are rebol21-Aug 8:36
3820shadwolfyou are talking with a guy that master more than 20 programing languages and mekes that ability to manage them his everyday leaving21-Aug 8:36
3819shadwolf@marco you should learn perl or python your perspective about rebol rebol would change21-Aug 8:34
3818shadwolfi realy which you could put the whole blame on me and then geting ride of me have this brillant successfull rebol we all want21-Aug 8:34
3817shadwolflike if ignoring me would make rebol a success .... damn if it was so easy ...21-Aug 8:32
3816shadwolfand notice this .., to all of my asks they so far do like I wasn't existing21-Aug 8:32
3815shadwolfunfortunatly for most of the gurus around now I was part of the last decade rebol action so they can't fool me with stupid talks21-Aug 8:31
3814shadwolfso all you now are proud of is a negation of a working solution offering to rebol REAL multi tasking ... how dumb is that21-Aug 8:30
3813shadwolfsooooooooooo then Carl came out of the blue and replyed to that brasin storming with you don't need multitasking ... since there is asynchronous processing and which produced uniserv and cheyene!21-Aug 8:29
3812shadwolffrancois jouan a french rebol long time member answered with a master piece of code that I published in the early time of the rebol.org21-Aug 8:28

Return to Index Page