• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp250
r3wp2441
total:2691

results window for this page: [start: 101 end: 200]

world-name: r4wp

Group: #Red ... Red language group [web-public]
BrianH:
19-Oct-2012
It's helpful to make a conceptual distinction between the host interface 
and the extension interface, even though for R3 they are currently 
related to each other and share a lot of the same code.


For the host interface, the host is the OS (more or less) and provides 
an execution environment that the R3 runtime runs on like a program 
(this is all metaphorical, but I'm sure you get it). The OS in this 
case could be something like Windows, Linux, some microkernel, whatever, 
or it could be an application or application plugin like Eclipse, 
Visual Studio, Notepad++, Excel, Firefox, whatever.


For the extension interface, R3 is the OS, the extension-embedded 
module is the program that runs on the OS, and that program calls 
the extension's native code like a library. The program source is 
returned by the extension's RX_Init function, and that program then 
wraps the native library code. The module source is loaded like a 
normal script (slightly hacked after loading to make it a better 
wrapper), so the script could be embedded in binary data along with 
non-Rebol stuff just like with normal scripts. You could even have 
Red and Rebol scripts in the same file (if they use the same embedding 
method) so you the data the init function returns can be like a Red/Rebol 
fat binary, metaphorically.


Given this, Red could either be (or compile) a host for R3; or it 
could be (or compile) a runtime library that implements the same 
host interface as r3lib, making it a drop-in replacement for R3; 
or it could be (or compile) an extension that R3 is a client of, 
returning R3 code that calls calls the compiled Red code; or it could 
be an alternate extension container, for extensions that return both 
Red and R3 code from the same init function, which would call the 
Red code returned, which would in turn call the same native code. 
The two languages could be integrated at any point in the stack, 
along with other languages.
BrianH:
19-Oct-2012
Btw, you can't run applications for Linux on Unix without a compatibility 
library either. Bringing MS into it is just an insult.
BrianH:
19-Oct-2012
For that matter, I expect to make my own Rebol spinoff language that 
will follow a completely different system model than either Red or 
Rebol, and the only reason to do so is because those other languages 
don't cover that situation (otherwise I would have been more active 
in Red so far). Being different justifies their existence; interoperating 
with each other justifies their cooperation :)
BrianH:
20-Oct-2012
With compressed scripts, you can either have raw compressed data, 
or binary! syntax compressed data, after the header and an optional 
trailing newline. If you have raw binary data and a length header 
then it is only decompressed until the end of the length (with DECOMPRESS/part). 
The option of binary! syntax is useful for block-embedded scripts 
or scripts posted in a text environment, and it doesn't really combine 
well with the length header so that is ignored in this case; one 
of them had to take precedence (until I get TRANSCODE/part) so I 
picked compression. It is more likely that the length header and 
raw compressed data would be combined, anyways, For compressed scripts, 
the checksum applies to the decompressed binary data.
DocKimbel:
28-Oct-2012
The difference lies in the PE header, the sub-system required to 
run the app needs to be set to either 'console or 'GUI.
Pekr:
1-Nov-2012
Yes, I don't like the AVG either, I just have to use it :-) In my 
last company we used Slovakian ESET NOD - much better imo ...
Andreas:
15-Nov-2012
Ladislav, I fully agree. I don't think that "0 points backwards" 
is particularly elegant either, but I'm willing to explain it ("0 
points to the element before 1") and find it much better than having 
to explain when and why you have to very careful with computing indices, 
or even debug (R2) code that was written unaware of this fact.
Andreas:
15-Nov-2012
DocKimbel: yes, either `first skip foo -1`, or `pickz foo -1`, or 
`foo/-1st`.
BrianH:
16-Nov-2012
Andreas, oh good, whew. In R3 we're already having to replace all 
system options that affect MOLD with options to the MOLD function 
itself. It would be a shame to have to do the same for all of the 
indexing functions. Nonetheless, that meaning of BASIS? doesn't make 
sense for the name either, so I don't like it.
BrianH:
16-Nov-2012
Remember, R3's behavior isn't done either. There's a standing consistency 
bug, for instance. If we come to a consensus, R3 is likely to adopt 
it too.
BrianH:
16-Nov-2012
(sorry, there's two standard ways to pluralize index and I don't 
use either consistently)
BrianH:
16-Nov-2012
Note that with R3-style bounds checking, the none value is considered 
to be roughly the same as a hole in the data. PICK past either end 
returns none. That means that PICK 0 returning none is basically 
a statement that there is a hole in the middle of the series that 
is just before the current position, and moves along as the series 
position moves along. Now, try to come up with a way to explain to 
newbies that this phantom hole in a series makes sense, or is a good 
idea.
Arnold:
17-Nov-2012
Completely agreed 0 does not exist, even not for computers. A computer 
with 0 memory does not have memory at address 0 either :)

Counting starting at 0 is nonsense. No matter who and how many times 
it is explained. In human/fysic world we only put letter 1 in envelope 
1, letter 2 in envelope 2 etcetera, there is no letter 0 to put into 
envelope 0. It is only a confusing trick to start at 0. (I know you 
can look at memory like a binary tree) In these days of plenty of 
memory, I say let location 0 unused. Besides for who was REBOL meant 
initially? People. Scientists not computerscientists. Let those struggle 
with C and the likes. 1-base is one of the big plusses REBOL has 
over the majority of other languages. (enough bikeshedding from me 
today)
Andreas:
17-Nov-2012
If you (ab)use integers to stand in for ordinals, you have to decide: 


- either "nice" ordinal behaviour (-1 preceding 1 for indexing), 
compromising on the integer aspect


- or "nice" computational behaviour (0 preceding 1 for indexing), 
compromising on the ordinal aspect
DocKimbel:
17-Nov-2012
I wouldn't allow negative integers in path in such case. I would 
either come up with an non-ambiguous syntax to handle path notation 
or forbid it too.
BrianH:
17-Nov-2012
Which means that either Doc prefers path syntax over function syntax, 
or path syntax was implemented first, or both. Nonetheless, it's 
real code of any significant complexity, so it probably includes 
backward index use.
Ladislav:
17-Nov-2012
If I'm given PICKZ and POKEZ, I couldn't care less about the poor 
souls suffering from trying to use path syntax with negative indices

 - if I know you well, you would actually explain to them the advantages 
 of the simple approach (especially when being asked about some index 
 arithmetic problem), and I am sure that the "reasonable souls" would 
 join you soon, and the others would either stop programming in the 
 language or follow suit as well.
Ladislav:
20-Nov-2012
just a note: there is absolutely no need to support the end! datatype. 
REBOL doesn't support it either, in fact.
BrianH:
20-Nov-2012
Kaj, rebcode! isn't really in R2 anymore either. But the mechanism 
that was used to make rebcode fast in R2 has been implemented in 
R3, and it used by the R3-GUI dialect. Anyone could implement their 
own rebcode if they like, even with improvements. That mechanism 
would be worth supporting in Red.
Kaj:
22-Nov-2012
parameter: 35

fibonacci: func [
	n		[integer!]
	/local	a
][
	either n < 2 [
		n
	][
		a: fibonacci n - 1
		a + fibonacci n - 2
	]
]

prin "Fibonacci "
prin parameter
prin ": "
print fibonacci parameter
BrianH:
23-Nov-2012
Almost. It doesn't "replace" the word in all contexts, it registers 
another spelling for the word in the place where word symbols are 
stored, then when you refer to the word with either spelling it will 
point to the *same* word.
However, if you write code like this: alias 'print 'stampa

then that code, just by being loaded, creates two words in the user 
context with those two spellings. So when the ALIAS function links 
the two spellings then there is a conflict in the user context, where 
"stampa" refers to both the word 'stampa and is an alias for the 
word 'print and at runtime you can't really tell which word you mean. 
If the system resolves this conflict by resolving to the alias then 
you have overriden the original word, which makes ALIAS a security 
exploit. If it resolves to the original word then ALIAS simply doesn't 
work. Either way, the function needs to go away ASAP.
Kaj:
23-Nov-2012
parameter: 40

fibonacci: func [n [integer!]] [
	either n < 2 [n] [(fibonacci n - 1) + fibonacci n - 2]
]

prin "Fibonacci "  prin parameter  prin ": "
print fibonacci parameter
Pekr:
30-Nov-2012
Well, as for me, it is easy as that - f*ck off native controls :-) 
What does that really mean today? I have really no intention seeing 
GTK or other crap. Either use your own GUI, or HTML, that's almost 
the only standard, which will prevail anyway. We should ask ourselves 
- how relevant is e.g. the Gnome GUI guide? And who cares in the 
big picture? So - for easy embedded stuff, just give me a small GUI 
system, for bigger picture, give me a  HTML5. I e.g. don't understand, 
why Kaj tries to port something like Enlightenment. I really miss 
the big picture. Who and why should ever use it? For personal purposes, 
or some specific stuff - why not, but that's not imo a strategic 
direction ...
Pekr:
30-Nov-2012
Doc starts with a kind of dialect - some midd level. Kind of what 
Henrik called top-down, but with good thinking ahead. you mostly 
write VID-like dialect, which would get (not necessarily 100% automatically) 
compiled to target platforms. So on Android, it looks like andorid, 
etc., but also - for small embedded - either html5, or View ...
Gregg:
30-Nov-2012
So on Android, it looks like andorid, etc., but also - for small 
embedded - either html5, or View ...

That sounds like what Doc is proposing.
Steeve:
7-Dec-2012
I cut my script and got the same error with just the following:

Red []
;*** Bottom-up-heapsort ***
heapify: func [s start len comp /local step sav inc][
	inc: 0
	sav: s/:start
	;-- search terminal leaf.
	step: start
	while [len > step: 2 * step][
		++ inc
		unless comp s/(++ step) s/:step [-- step]
	]
	either step = len [++ inc][step: shift step -1]
	;-- bottom-up, search insertion point
	loop inc [
		unless comp s/:step sav [break]
		step: shift step -1
		-- inc
	]
	;-- bottom-up swap
	loop inc [						;-- chain swap
			s/:step: also sav sav: s/:step
			step: shift step -1
	]
	s/:step: sav
]
DocKimbel:
21-Dec-2012
I have added a new function type today: routine!. It allows to write 
a Red/System function in a Red program. The compiler will marshal 
(or type-cast) the arguments back and forth automatically.

Here is the Fibonacci example rewritten as a routine:

Red [ ]

fibonacci: routine [
    n          [integer!]
    return: [integer!]
][
    either n < 2 [
        n
    ][
        (fibonacci n - 1) + (fibonacci n - 2)
    ]
]


The function body is Red/System code, so it will run at full Red/System 
speed.


Integer! and logic! values are converted automatically, other Red 
datatypes are passed boxed but type-casted as Red/System counterparts 
(as defined in the Red runtime). Hint: floats will be converted automatically 
too.

So, passing and processing a block! series would look like this:

Red [ ]

add-one: routine [
    blk       [block!]
    return: [block!]
    /local value tail int
][
    value: HEAD(blk)
    tail: TAIL(blk)
	
    while [value < tail][
        if TYPE(value) = TYPE_INTEGER [
                int: as red-integer! value
                int/value: int/value + 1
        ]
        value: value + 1
    ]
    RETURN(blk)
]


I haven't yet released the code, it needs a bit more work, it should 
be ready by tomorrow.


The purpose of routine! datatype is to provide access to ultra-fast 
and low-level code for Red program in a simple way. The design is 
not yet fully set in stone, so suggestions and comments are welcome.
Gerard:
26-Dec-2012
@Doc : About the R2/R3/Red console enhancements, I've always missed 
the MS way to move/select  from left to right (on a word by word 
basis - MOVING on a word-by-word is CTRL+left / right Arrow and adding 
the SHIFT key in combination with the CTRL means SELECT - it's that 
simple) but going to the beginning or ending of the line is at least 
a welcome start ... if we want to go this way - and then going right 
or left on a character basis - as is for now!  And for right-handed 
ppl it would also be welcome to restore the old MS way of handling 
the current left-handed ppl to do CTRL-X / C / V  - which were CTRL-DEL 
or SHIFT-DEL / CTRL-Insert / SHIFT-Insert - but this kind of thing 
I can add myself when time comes ... it's just a matter of being 
more productive - it's far from being a "caprice des Dieux". For 
opponents : If you've never experimented it - you then never used 
it either on a regular basis and you can't catch why I regret this 
not being supported anymore in recent MS software too ... but this 
is deceptive either from them since it costs so few to leave it there 
in the first place. However I must admit that on my iPhone and other 
mobile tools I will miss it in anyway - until I code my own keyboard 
for this use too !!!
BrianH:
3-Jan-2013
Having issues be immutable and unique could lead to lower memory 
usage, Kaj. Sure, you wouldn't be able to garbage collect them, but 
additional copies of the same issue wouldn't add any additional memory. 
Plus, you can't necessarily GC strings either - only when you don't 
need to keep references to them anymore. It may depend on the app 
whether it's more efficient to have issues be strings or words.
DocKimbel:
4-Jan-2013
The main use for keywords is preprocessing directives. We are used 
to #include, #if, #either, ... rather than ##include, ##if, ##either, 
... which look quite bad. I prefer to reserve the lighter syntax 
for the most frequent use-cases, which are keywords.
Kaj:
11-Feb-2013
cycle: func ["Cycle a series through its index."
	'series [word!]
	/local s
][
	either tail? s: get series [
		set series  next head s
		first head s
	][
		set series  next s
		s/1
	]
]
Gregg:
11-Feb-2013
I believe REBOL allows either order, so it's just the docs that say 
it has to be that way.
Gregg:
11-Feb-2013
This would be a great question for Carl, as to why he did it the 
way he did it in REBOL. That is, allowing either order.
Bo:
4-Mar-2013
Either I didn't know that or I forgot.  Thanks for reminding me!
BrianH:
6-Mar-2013
Kaj in !RebolBot: "I think that only works in Red, refinements starting 
with a number :-)"


Refinements that start with a number work in R2 and R3 as well. Path 
elements aren't refinements though, they're regular words or other 
values. If you find any basic data syntax differences between Red 
and R3 in datatypes that they have in common, report them: they're 
either a bug in R3 or in Red, or possibly in both.
BrianH:
6-Mar-2013
I didn't test it, but not all differences between Red and R3 are 
bugs

 - where they are in comparable datatypes, they are. Syntax compatibility 
 in the the compatible datatypes is a necessary feature. If they aren't 
 compatible, it's a bug. The only question is whether it's a Red bug 
 or a R3 bug. It could be either.
BrianH:
6-Mar-2013
For non-comparable datatypes it's not a bug, of course. And semantic 
differences may not be bugs either.
BrianH:
6-Mar-2013
Boron is basically like R2, but with a Lua/R3-like library model 
with a different FFI from either, at least in terms of its major 
semantic model. Syntactically Boron has gone out of its way to adopt 
more C-like features here and there. The LGPL argument is more a 
personal and social thing as far as I am concerned, it's not the 
reason for the language design choices. You can tell the reason for 
the language design choices just be seeing which choices were made 
(assuming a reasonably intelligent person).
Pekr:
7-Mar-2013
That is understandable, but it almost feels like a push - either 
do it R3 way, or it is your bug :-)
BrianH:
7-Mar-2013
Pekr: "That is understandable, but it almost feels like a push - 
either do it R3 way, or it is your bug :-)"


Not always. R3 isn't done yet either. Remember, we're still catching 
up with a 2-year backlog of pending design changes. Some of its design 
experiments have turned out to be bad ideas for reasons that weren't 
known at first, or in some cases discovered by Red. So sometimes 
R3 is the one that needs fixing, and much sooner because R3 is going 
to get to 3.0 long before Red's design is set.


There are real advantages for Red and R3 to declare that incompatibility 
in comparable situations should be considered a bug, especially then 
it comes to syntax, and sometimes when it comes to semantics (ie 
indexing). But I don't assume that either R3 or Red in in the right. 
More often these incompatibilities are a sign of things that haven't 
been fully thought through, and once they are it could be R3 or Red 
that needs fixing, or in some cases both.


But, in the scale of history, Red is much earlier on in its design 
process than R3 is. R3 is more towards the end, closer to release. 
So that means that any changes that might break the *core* semantics 
or syntax of user code need to be made very soon, before 3.0 comes 
out and sets the standard. Red can afford to make those changes later 
because it isn't anywhere near the point of standardization. So if 
there are design flaws in R3 that might be comparable to something 
that would affect Red, they need to be fixed earlier in R3 (not by 
the Red people unless they're into that). And it would be useful 
for Red if people would participate in the R3 design discussions 
for stuff that would affect Red too because Red would benefit from 
the discussions regardless of compatibility, and also benefit from 
being compatible with the results.
Ladislav:
7-Mar-2013
implementations of things that PARSE users frequently need to do 
but usually get wrong, such as CHANGE, INSERT, REMOVE, IF, THEN, 
AND, NOT, QUOTE and DO

 this is where I *must* disagree. THEN seems to be infrequent, CHANGE, 
 INSERT and REMOVE are not frequent either according to my experiences 
 (nor they should be frequent), DO is a typical "one user feature".
BrianH:
7-Mar-2013
I agree about THEN though (that was a Carl thing), and to some extent 
DO. For DO in particular I have seen people request help doing stuff 
like that frequently enough, but they either give up or are capable 
enough to not get it wrong.
Kaj:
8-Mar-2013
So either the only specification is some salt, or you actually benchmark 
the readers to see who gets it and who doesn't
Group: Announce ... Announcements only - use Ann-reply to chat [web-public]
Bas:
7-Jan-2013
Please put in your agenda the weekend of saturday the 26th and sunday 
the 27th of january. Then we will have the DevCon 2013 in De War 
'Place for Pioneers' in Amersfoort, the Netherlands. This year we 
will combine the Syllable Winter Conference with the DevCon, Conference 
for the REBOL Programming Language Family, as they have much overlap. 
Presentations will be done by Nenad Rakocevic and Kaj de Vos. We 
are open to other guest speakers and presentations? Entrance is free, 
but donations are very much appreciated. Keep an eye on this website:
http://devcon.esperconsultancy.nl/(will be updated soon)
and this Twitter-account:
https://twitter.com/devc0n

It is easily reachable by airplane (Schiphol, Amsterdam Airport) 
and by international trains. 

It's an old matches factory marked 'Spullenmannen', which is now 
being used by artists.

DE WAR


DE WAR is a breeding ground for art, technology and sustainability 
in Amersfoort, and is host to  a wide range of activities. Since 
2002 the Spullenlab has been the headquarters of Spullenmannen, an 
artists\u2019 collective making theatre, installations, visual art, 
and purposeless contraptions. A  shared office space was set up in 
2006, with different working places, a meeting room, and other facilities 
shared by a number of cultural enterpreneurs. The OpenTOKO workshops 
started in 2008, as a series of \u2019open knowledge\u2019 workshops 
on the connection between art and technology. Since 2010, DE WAR 
has also been housing FabLab Amersfoort, TransitieLab, and Studium 
Generale Amersfoort.  Moreover, a performing space for small theatre 
productions has been set up in 2011.


DE WAR has been established in the old match factory on the river 
Eem.  The factory complex dating back in 1881 has, besides from other 
activities, operated as a production facility of the Dutch colour 
dye industry, and is also known by the name of its last owner, Warner 
Jenkinson. Nowadays owned by the municipality of Amersfoort,  the 
factory complex faces an uncertain future, either to be demolished 
or to be renovated. Besides DE WAR several other offices and ateliers 
are housed within the same factory complex.


DE WAR is initiative  of PLAN B, at the address KLEINE KOPPEL 40, 
3812 PH in Amersfoort,
Kaj:
19-Jan-2013
There's no error! yet, either, so READ returns NONE on error. WRITE 
returns a true/false value indicating success
Kaj:
30-Jan-2013
In the line field, you can enter either a local file name or a URL, 
so the editor can be used both on local files and files on remote 
servers
Kaj:
1-Feb-2013
With Doc's latest Red fixes, I was able to write a very simple IDE 
in the GUI dialect:

http://red.esperconsultancy.nl/Red-GTK/dir?ci=tip&name=examples


You can write either regular Red code or GUI dialect code, and execute 
it with respectively the Do or View button. Do executes the code 
in the interpreter, so no compilation is needed, but the current 
limitations of the interpreter apply.


The code is only 25 lines, but at Brian's request, I'll post that 
in the #Red channel.
Kaj:
20-May-2013
I made an SDL backend for my Red/System OpenGL binding:

http://red.esperconsultancy.nl/Red-OpenGL/dir?ci=tip


SDL with OpenGL is available on most platforms, and depending on 
your system, it supports hardware acceleration. So you can now choose 
between software rendering with the TinyGL engine through PicoGL, 
and hardware acceleration or software rendering with the Mesa3D engine 
through SDL. The two example programs can be compiled with either 
backend.
Geomol:
17-Jul-2013
New World alpha release at
https://github.com/Geomol/World


- Added better networking using cURL library, libcurl (OS X and Linux)
- Added tasks incl.:
	- task! datatype
	- task-id! datatype
	- TASKS native function
	- task? and task-id? mezzanines

 - Task support for many functions incl. HELP, SOURCE, FIRST, SECOND, 
 PICK, COMPILED? and DISASM
	- KILL mezzanine to call TASKS/KILL

- Added inter-task communication using SEND and RECEIVE native functions
- Added support for messages to WAIT as: wait 'message

- Added preemptive multitasking using TASKS/TICKS to specify number 
of Virtual Machine instructions per task run (default is 200)

- Added timers for tasks triggered by WAIT native and READ native, 
when reading from url
- Task yield can be achieved by: wait 0
- Changed ;{ } comment syntax to ;( )
- Parens can now span several lines at the prompt
- Added system/console/paren
- Added support for pressing <Esc> to stop execution of main task

- Sending input via pipe to World started with a script will activate 
input without echo and without <tab>-completion etc.. (Not sure how 
and if this works under Windows.)
- Added support for picking 'Re and 'Im of complex numbers
- Better implementation of TRY

- New test versions of IF and EITHER, that can take other than block! 
arguments
- Added more tests
Group: Rebol School ... REBOL School [web-public]
Sujoy:
10-Oct-2012
uniserve/boot works fine after these steps, but...

** Script Error: Cannot use path on none! value
** Where: process-task
** Near: if any [
    zero? shared/pool-max
    shared/pool-max > shared/pool-count
] [fork]
either
Sujoy:
10-Oct-2012
damn! no luck.

>> ls
BSD-License.txt  change-log.txt   clients/         docs/
handlers/        libs/            protocols/       services/
uni-engine.r
>> uniserve-path: %./
== %./
>> do %uni-engine.r
Script: "UniServe kernel" (17-Jan-2010)
Script: "Encap virtual filesystem" (21-Sep-2009)
== true
>> uniserve/boot
booya
.

http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/business/rss.xml
** Script Error: Cannot use path on none! value
** Where: process-task
** Near: if any [
    zero? shared/pool-max
    shared/pool-max > shared/pool-count
] [fork]
either
Ladislav:
23-Nov-2012
Example:

    print either a < 0 ["a is small"] ["a is big"]
Ladislav:
23-Nov-2012
This is more likely the code you might use:

foreach record results [

    either (first record) = (second record) [print ["they are equal:" 
    first record]] [print ["Alert!"]]
]
Cyphre:
23-Feb-2013
;key1 - contains public and private keys
rsa-key1: rsa-make-key
rsa-generate-key rsa-key1 1024 3

;key2 - contains only public key
rsa-key2: rsa-make-key
rsa-key2/e: 3
rsa-key2/n: rsa-key1/n

;data to ecrypt encrypt 
data: copy/part checksum/secure mold now/precise 16

;encrypt data using the key2 (with pub key only)
crypt-key: rsa-encrypt rsa-key2 data


;decrypt data(that have been encrypted using key2) using the key1(needs 
to contain private key)
data2: rsa-encrypt/private/decrypt rsa-key1 crypt-key

either equal? data data2 [
	print "decrypted data match the original - decription passed"
][

 print "decrypted data differs from the original - decryption failed"
]
PatrickP61:
7-May-2013
So here is my code that is giving me some trouble:

file-list:	[]

read-dir:	func	[
	dir	[file!	]
	] [
	foreach file read dir [
		file: either dir = %./ [file] [dir/:file]
		append file-list file
		if dir? file [
			read-dir file
	]	]	]

inp-dir: request-dir/path	what-dir 

unless inp-dir [ask	">>> No directory selected, cannot proceed  (Enter)" 
 quit ]
cd :inp-dir


read-dir inp-dir		; <-- does not work as expected, must use cd and 
what-dir instead
;read-dir what-dir
new-line/all file-list on
print mold file-list
PatrickP61:
8-May-2013
Hey all, I'm having such a good time learning again!


I've got some code to generate a print ruler, but I think it could 
be cleaned up a lot more.   

If some of you have a quick moment, could you take a quick look and 
advise me on how to shorten this code.

ruler1: copy ruler2: ""
idx: 0
loop 110 [
	idx: idx + 1
	append ruler1 "_"
	append ruler2 last-digit: last to-string idx
	if last-digit = #"5" [
		clear back tail ruler1
		append ruler1 "+"
		]	
	if last-digit = #"0" [
		either idx < 99 [clear back back tail ruler1]
			[clear back back back tail ruler1]
		append ruler1 to-string idx
		]
	]
replace/all ruler2 "0" "_"
print ruler1
print ruler2



____+___10____+___20____+___30____+___40____+___50____+___60____+___70____+___80____+___90____+__100____+__110

123456789_123456789_123456789_123456789_123456789_ 123456789_123456789_ 
123456789_123456789_ 123456789_123456789_
Bo:
8-May-2013
Actually, the first method I posted above is easier to understand 
for a lot of nested statements.  Compare this real line of script 
from one of my programs.

The way I normally write it:

browse probe rejoin copy [http://www.respectech.com/log/show-invoice.cgi?user=
username "&pass=" password "&submit=" replace/all client "&" "%26" 
"&invno=" invnum either amtdue [rejoin ["&notice=1&amtdue=" to-decimal 
amtdue "&daysdue=" daysdue]][copy ""]]

Lisp-y:

browse (probe (rejoin (copy [http://www.respectech.com/log/show-invoice.cgi?user=
username "&pass=" password "&submit=" (replace/all (client) ("&") 
("%26")) "&invno=" invnum (either amtdue [rejoin ["&notice=1&amtdue=" 
(to-decimal amtdue) "&daysdue=" daysdue]][copy ""])])))


Heirarchical (takes a lot more space, but is easier to follow -- 
however, doesn't have the parameter enforcement of parens):
browse
	probe
		rejoin
			copy
				[
					http://www.respectech.com/log/show-invoice.cgi?user=
					username
					"&pass="
					password
					"&submit="
					replace/all
						client
						"&"
						"%26"
					"&invno="
					invnum
					either
						amtdue
						[
							rejoin
								[
									"&notice=1&amtdue="
									to-decimal
										amtdue
									"&daysdue="
									daysdue
								]
						]
						[
							copy
								""
						]
				]
Ladislav:
9-May-2013
Similarly,

		either idx < 99 [clear back back tail ruler1]
			[clear back back back tail ruler1]
		append ruler1 to-string idx

can be written as

		change skip either idx < 99 [-2] [-3] to-string idx
Ladislav:
9-May-2013
err, I lost a part of the expression:


    change skip tail ruler1 either idx < 99 [-2] [-3] to-string idx
Ladislav:
14-May-2013
As to notes about HEAD, I realize now that I confused INSERT and 
APPEND

 - APPEND used in a similar way as above would not need HEAD either
Gregg:
28-May-2013
parse-int-values: func [

    "Parses and returns integer values, each <n> chars long in a string."
    input [any-string!]

    spec [block!] "Dialected block of commands: <n>, skip <n>, done, 
    char, or string"
    /local
        gen'd-rules ; generated rules
        result      ; what we return to the caller

        emit emit-data-rule emit-skip-rule emit-literal-rule emit-data
        digit= n= literal=
        int-rule= skip-rule= literal-rule= done= build-rule=
        data-rule skip-rule
][

    ; This is where we put the rules we build; our gernated parse rules.
    gen'd-rules: copy []
    ; This is where we put the integer results
    result: copy []

    ; helper functions

    emit: func [rule n] [append gen'd-rules replace copy rule 'n n]
    emit-data-rule: func [n] [emit data-rule n]
    emit-skip-rule: func [n] [emit skip-rule n]
    emit-literal-rule: func [value] [append gen'd-rules value]
    emit-data: does [append result to integer! =chars]

    ; Rule templates; used to generate rules

    ;data-rule: [copy =chars n digit= (append result to integer! =chars)]
    data-rule: [copy =chars n digit= (emit-data)]
    skip-rule: [n skip]

    ; helper parse rules
	digit=: charset [#"0" - #"9"]
    n=: [set n integer!]
    literal=: [set lit-val [char! | any-string!]]

    ; Rule generation helper parse rules
    int-rule=: [n= (emit-data-rule n)]
    skip-rule=: ['skip n= (emit-skip-rule n)]
    literal-rule=: [literal= (emit-literal-rule lit-val)]
    done=: ['done (append gen'd-rules [to end])]

    ; This generates the parse rules used against the input

    build-rule=: [some [skip-rule= | int-rule= | literal-rule=] opt done=]


    ; We parse the spec they give us, and use that to generate the

    ; parse rules used against the actual input. If the spec parse

    ; fails, we return none (maybe we should throw an error though);

    ; if the data parse fails, we return false; otherwise they get
    ; back a block of integers. Have to decide what to do if they
    ; give us negative numbers as well.
    either parse spec build-rule= [
        either parse input gen'd-rules [result] [false]
    ] [none]
]
Group: Databases ... group to discuss various database issues and drivers [web-public]
Pekr:
4-Jul-2013
Or differently, has anyone worked with excel files via ODBC, using 
either R2 or R3? I tried Graham's code, which works for .xls files, 
but not .xlsx files. When I convert my file to .xls, R2 returns - 
not enough memory :-(

p: open [
     scheme: 'ODBC

     target: "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=c:\path-to-file\file.xls"
]
conn: first p
insert conn "select * from [Sheet1$]"
result: copy conn
Pekr:
4-Jul-2013
well, I have even old latest Carl's view.exe, does not work either 
... lost battle here ... not fluent with recompile of ODBC DLL, does 
not imo guarantee, that loading it in R3 will actually work. I wonder 
if there was any change to import function or to extension mechanism 
itself ...
Group: !REBOL3 ... General discussion about REBOL 3 [web-public]
Cyphre:
18-Dec-2012
Well, to save you some time you should get the R3 form repository 
either from Andreas or me on github. These repos are work in progress 
for Win/mingw at the moment (maybe others have simmilar repos as 
well)
Pekr:
20-Dec-2012
MaxV - that's an old song - Altme will be used by those, who want 
to use it, easy as that, no? Yes, public forum should be available, 
but please let's ppl use what they like or are used to. Some of us 
simply prefer IM nature, so we will either use Altme or IRC. That 
does not mean, that we will not participate in a forum, or mailing 
list. I can bet, that if ML was still active, many of us here would 
contribute. I quite miss ML a bit :-)
Maxim:
21-Dec-2012
Max, the problem is that most web tools actually suck... not because 
their developpers are bad... but because the web, as a platform sucks... 
in all regards.   its slow, super complex, apps break up every other 
month, and even the basic framework on which the web is layers was 
NEVER meant to be used like it, so even that is corrupted to start 
with.  Also, the apps we use keep changing from under our feet, which 
as a user we have NO control, and it gets very tiresome... it seems 
like every other time I log on to any of the bigger web sites, its 
changed, and I'm lost... again.


I have not seen a single altme-like product which I could chat in 
**real-time** with many people in groups as we do here.   its always 
either super slow, very slugish, insanely complex or insanely dumb. 
 


The only platform which has some appeal so far is the Stack Overflow 
engine, which has a pretty good architecture... but man would it 
be sooo much better if it wasn't built over web technologies...
Henrik:
22-Dec-2012
You can't inline URLs either.
Andreas:
23-Dec-2012
I fear that with the pull request as-is, even basic script execution 
is broken:
$ cat foo.r 
REBOL [] print 42
$ ./r3 foo.r 

** Script error: select does not allow integer! for its series argument
** Where: make either either -apply-
** Near: make system/standard/script [
    title: select first code '...

>>
GrahamC:
9-Jan-2013
digit: charset [ #"0" - #"9" ]
alpha: charset [ #"a" - #"z" #"A" - #"Z" ]
idate-to-date: func [ date [string!] /local day month year zone]
[

 either parse date [ 5 skip copy day 2 digit space copy month 3 alpha 
 space copy year 4 digit space copy time to space space copy zone 
 to end ][
		if zone = "GMT" [ zone: copy "+0" ]
		to date! rejoin [ day "-" month "-" year "/" time zone ]
	][ none ]
]


if headers/last-modified [info/date: attempt [ idate-to-date headers/last-modified] 
]
		
seems to work
GrahamC:
16-Jan-2013
So, if you're reading a HTTP form, you can either use GET or POST 
 ....
GrahamC:
19-Jan-2013
>> do %test-module.r
Module: "Untitled" Version: 0.0.1 Date: none
** Script error: new-word word is not bound to a context

** Where: set function! do -apply- make catch either either -apply- 
do
** Near: set 'new-word none
BrianH:
20-Jan-2013
Either that or don't have global settings at all, have the settings 
passed in a structure to the SEND function. Global settings are overrated.
BrianH:
8-Feb-2013
If you have any code that uses SET block! block! or SET object! block!, 
and the values block might possibly have unset values in it, then 
*your code is buggy*. If you want the unset values to be assigned, 
you should be using SET/any. If you want the unset values to trigger 
errors (a fair assumption, since you're using SET instead of SET/any), 
those errors are currently *not* being triggered because of a bug 
in R3. Either way, check your code.
Andreas:
17-Feb-2013
AdrianS: I don't think BrianH downvoted your question. But whoever 
did (I didn't either) probably has a point, as it's a very broad 
and open question. SO generally prefers more specific questions based 
on actual problems, so that it's reasonably clear when an answer 
is practical.
AdrianS:
22-Feb-2013
Ping me either here or on SO chat if you would like the two files.
BrianH:
28-Feb-2013
It's actually pretty easy to see how they managed it. It was:

- A multi-language IDE (not a programming language, people already 
get those for free)
- With a GUI with an emphasis on modern graphic design (pretty!)
- With a fancy demo (more pretty!)

- With an initial focus on programming languages and development 
platforms that are already popular (built-in customer base)


Powerful IDEs are some of the only development tools that people 
are still willing to pay money for (i.e. Visual Studio). Most people 
can't choose what language they write in, but they more often can 
choose their IDE. And for crappy-but-IDE-friendly languages, an IDE 
can make all the difference in your productivity. They're not as 
helpful for really powerful extensible languages like Rebol or Perl, 
unless the language is so bad that just about anything would help 
(Perl). Plus, since an IDE is an end-user app you can afford to GPL 
it, since the only stuff built on it are add-ons - that doesn't work 
for programming languages unless they have a clear distinction between 
user code and built-in code that is distinct enough to not violate 
the GPL distinctions, because most of the competition is permissive 
- and without the GPL restrictions there is nothing to sell, so there 
is no business model to get a return on investment.


It's nice to point to other open source projects and say "See! We 
could have done that!" but unless those are comparable projects their 
success isn't comparable either.
Gregg:
3-Mar-2013
What was wrong with the R2 text?

  "Return single value from series."


But the doc string for 'value isn't helpful with regard to series 
values either.

I would make it a bit more readable though.

  Return a single value from the series.
BrianH:
7-Mar-2013
For instance, most developers need to have support for either SQL-like 
databases, or NoSQL databases (according to many different data models), 
or both, but they are not compatible with each other even in theory 
once you get out of SQL world.
Bo:
8-Mar-2013
No, I haven't had a chance to work on it yet.  Tomorrow's not looking 
very good for programming time, either.  Maybe Sunday I'll have a 
chance to take a look at it.
MarcS:
10-Mar-2013
But are they reliable? I can't see reference to either __APPLE__ 
or __MACH__ in the codebase
Andreas:
10-Mar-2013
For NONE I see the following options to fix the crash right away: 
either remove the NONE feature altogether (removing functionality 
that currently sometimes works on Win32), or use http:// on POSIX 
(as a not totally reliable workaround), or move the early exit to 
the POSIX specific code (creating a cross-platform incompatibility 
between Win32 and POSIX platforms).
BrianH:
11-Mar-2013
I'm OK with that, since the alternative is either an endless loop 
or conditional code to avoid error trapping. But it needs to make 
sense conceptually.
Gregg:
11-Mar-2013
Do either of you (Brian or Ladislav) know if there's a good FOR test 
suite in the REBOL base?
BrianH:
12-Mar-2013
I think that we have two conflicting values here:

* Do what I *say*, since you can't read my mind to know what I mean

* Trigger errors when you run into something almost definitely wrong 
as a favor to the developer


In the case of FOREACH, it triggers an error for an empty words block 
and doesn't allow none because that block is part of the control 
structure, not the data (which we do allow empty or none for). In 
the case of a block of only set-words, that also doesn't really advance, 
but at least you get a reference to the series so you could in theory 
be doing something (that you should probably use WHILE to do instead), 
so not triggering an error in that case is iffy, you could make an 
argument either way.


For FOR, the main factor for whether the loop would normally end 
(without BREAK or changing the index manually somehow) is whether 
the step > 0 if start < end, or step < 0 if start > end. So it's 
not whether it = 0.
BrianH:
12-Mar-2013
Right. One thing we need to consider is whether we want changes to 
the index in the code block to affect the index of the loop, or whether 
we just want to do that with BREAK. There are advantages to either 
model. If manual changes to the index are ignored, it becomes safe 
to change in your code. If they aren't ignored, it becomes another 
way to affect the loop in your code.
Bo:
12-Mar-2013
Maxim: Right now, I would use something like the following:

x: 1
endval: length? b
until [
	either s1/:x = b [
		do something
		x: x + 1
	][
		do something2
		x: x + 5
	]
	x >= endval
]
Henrik:
12-Mar-2013
I don't see it in the experimental 64 bit build either.
DocKimbel:
12-Mar-2013
Bo: you could rely on FORALL and series positions instead of carrying 
numerical indexes around:

forall b [
    offset: either b/1 = pick s1 index? b [
        do something
        1
    ][
        do something2
        5
    ]
    b: skip b offset
]
BrianH:
13-Mar-2013
ASSERT/type means that typechecks don't have to be considered expensive 
anymore. Value checks still require EITHER and other conditional 
functions though.
Gregg:
15-Mar-2013
>> for i 10 5 -1 [print i]
** Math Error: Math or number overflow
** Where: for
** Near: either max-int - bump <
Ladislav:
15-Mar-2013
aha, I swapped the condition, try with either negative? bump, please
Marco:
16-Mar-2013
my contribution to loop-for discussion:
	for-step: func [
		{simplified for}
		[catch]
		'word [word!]
		start [number!]
		end [number!]
		step [number!]
		body [block!]
		/local op result
		][
		do reduce [to set-word! :word start]
		if step = 0 [throw make error! "step parameter cannot be = 0"]
		op: either step > 0 [:lesser-or-equal?][:greater-or-equal?]

  while [op get word end][set/any 'result do body set word (get word) 
  + step] get/any 'result
	]
	for-step i 1 3 1 [print i]
Marco:
16-Mar-2013
another contribution:
	use [count inc start end op][
		count: inc: start: end: op: 0	
		in-range: func [
			[catch]
			'word [word!]
			start [number!]
			end [number!]
			/bump step [number!]
			/local result
			] [
			if inc = 0 [

    if step = 0 [throw make error! "step parameter cannot be = 0"]
				count: start

    either start > end [inc: -1 op: :greater-or-equal?][inc: 1 op: :lesser-or-equal?]
				unless none? step [inc: step]
			]
			set word count

   result: either op count end [count: (get word) + inc true][false]
			if not result [count: inc: start: end: op: 0]
			result
		]
	]
	i: 0 ; define a var
	while [in-range i 1 3] [print i]
Gregg:
16-Mar-2013
Brian, on efficiency, LOOP (right now) just does this at the top:

  either integer? spec [native-loop spec body] [...


So that's all the overhead there is to delegate to the native loop.
Gregg:
31-Mar-2013
I have an updated SPLIT-PATH, modeled on Ladislav's implementation 
where it holds that

   file = rejoin split-path file


This does not match current REBOL behavior. His version arguably 
makes more sense, but will break code in cases like this:

	%/c/test/test2/ 
	REBOL      == [%/c/test/ %test2/]
	Ladislav's == [%/c/test/test2/ %""]


Ladislav's func only seems to go really wrong in the case of ending 
with a slash an that's the only slash in the value which return an 
empty path and entire filespec as  the target.

Schemes (http://) don't work well either.


REBOL also dirizes the file path if it's %. or %.., which Ladislav's 
does not. e.g.

	[%foo/ %../]  == split-path %foo/..
Gregg:
31-Mar-2013
split-path: func [

 "Returns a block containing a path and target, by splitting a filespec."
	filespec [any-string!]
	/local target
][
	either any [
		; It's a url ending with a slash. This doesn't account for
		; formed URLs. To do that, we would have to search for "://"
		all [slash = last filespec]
		all [url? filespec  slash = last filespec]
		; Only one slash, and it's at the tail.
		all [target: find/tail filespec slash  tail? target]
	][
		reduce [copy filespec  copy %""]
	][
		target: tail filespec
		if slash = last target [decr target]
		target: any [find/reverse/tail target slash  filespec]
		reduce [copy/part filespec target  to file! target]
	]
]
Group: !R3 Building and Porting ... [web-public]
Arnold:
21-Dec-2012
There are plenty of possibilities here. 

Either port VID and have to deal with it's flaws and the history 
with it
or go the path of the RebGUI
or redo VID 

I have read somewhere that Carl expected someone to come up with 
something better than VID. 

I like VID yet it has its oddities, like when positioning elements 
using 'at. It could be improved in some of its behaviours, if you 
import it you may be hindered by this aspect, and it may get harder 
than restarting with a restricted base set of widgets.
Robert:
25-Dec-2012
I think the first thing to look at is the structu sizes. Either press 
it back to fit 32bit size, or expand it into 64bit space. Not sure 
what kind of side-effect this will have.
Group: Community ... discussion about Rebol/Rebol-related communities [web-public]
AdrianS:
31-Dec-2012
Ladislav, I agree about the level of activity not being as useful 
if the number of contributors is not specified, but for now this 
will have to do. The way to do this is through some reasonably smart 
scripting that can obtain a better breakdown of posts by user, either 
through scraping or some sort of API, if available.
Kaj:
30-May-2013
Carl couldn't get into Trello, either
101 / 26911[2] 345...2324252627