r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

MikeL
4-Apr-2011
[1244]
OK I am just doing something stupid and will clear that up soon.
Henrik
11-Apr-2011
[1245]
is there a good way to use mingw with CALL? I need to call git through 
msysgit, while using ssh keys. From what I can find, this looks almost 
impossible.
Ashley
11-Apr-2011
[1246]
OK, this is freaky:

>> system/version
== 2.7.8.2.5
>> a: list-env
== [
    "TERM_PROGRAM" "Apple_Terminal" 
    "TERM" "xterm-color" 
    "SHELL" "/bin/bash" 
    "TMPDIR" "/var/folders/6O/6OnXy9XG...
>> help a
A is a block of value: [
    "TERM_PROGRAM" "Apple_Terminal" 
    "TERM" "xterm-color" 
    "SHELL" "/bin/bash" 

    "TMPDIR" "/var/folders/6O/6OnXy9XGEjiDp3wDqfCJo++++TI/-Tmp-/" 
    "Apple_PubSub_Socket_Render" "/tmp/launch-BrITkG/Render" 
    "TERM_PROGRAM_VERSION" "273.1" 
    "USER" "Ash" 
    "COMMAND_MODE" "legacy" 
    "SSH_AUTH_SOCK" "/tmp/launch-HlnoPI/Listeners" 
    "__CF_USER_TEXT_ENCODING" "0x1F5:0:0" 

    "PATH" {/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin} 
    "PWD" "/Users/Ash" 
    "LANG" "en_AU.UTF-8" 
    "SHLVL" "1" 
    "HOME" "/Users/Ash" 
    "LOGNAME" "Ash" 
    "DISPLAY" "/tmp/launch-U0Gaqw/org.x:0" 
    "_" "/Users/Ash/REBOL/rebol"
]
>> length? a    
== 18
>> select a "USER"
== "Ash"
>> select a "HOME"
== none
GrahamC
12-Apr-2011
[1247]
Have you lost your home?
Sunanda
12-Apr-2011
[1248]
Length? a should be 36 given the above code....
Does this list you all the env variable names?:
    foreach [x y] a [print x]
james_nak
12-Apr-2011
[1249x2]
Same weird behavior here. All the words that print out with Sundanda's 
loop return values all the other's don't.
Actually with my list-env, everything up to PATHEXT works with select 
but apparently nothing after.
GrahamC
12-Apr-2011
[1251]
and what happens if you mold/all it?
BrianH
12-Apr-2011
[1252x3]
Have you tried using SELECT/skip ... 2?
I get the same results on Windows. When I assign a block with the 
same contents to a directly, it all works. It looks like LIST-ENV 
is building a bad block.
No such error in R3, but LIST-ENV returns a map! there, so it wouldn't 
have the same error.
Maxim
18-Apr-2011
[1255]
my discovery of the day:

>> same? rebol system
== true
onetom
19-Apr-2011
[1256]
just stumbled upon it yesterday too :) accidentally. i havent noticed 
that im not in bash and typed rebol
onetom
20-Apr-2011
[1257]
>> map-each e [] [e]
** Throw Error: Return or exit not in function
** Where: map-each
** Near: return any [output make block! 0]


is it a known bug? im new to cure code. i don't even know where to 
look for it. can some one help? (it works in r3)
Dockimbel
20-Apr-2011
[1258]
CureCode: http://curecode.org/rebol3/view-tickets.rsp

Click on "Search" filter type, type "map-each" in input field, then 
hit [Find].
onetom
20-Apr-2011
[1259]
hmm.. that's only for R3. this error is for R2 only.
BrianH
20-Apr-2011
[1260]
Onetom, that error has been reported already and fixed in R2/Forward, 
but it hasn't made it into R2 yet. Here is the revised MAP-EACH:

map-each: func [

 "Evaluates a block for each value(s) in a series and returns them 
 as a block."
	[throw catch]

 'word [word! block!] "Word or block of words to set each time (local)"
	data [block!] "The series to traverse"
	body [block!] "Block to evaluate each time"
	/into "Collect into a given series, rather than a new block"

 output [any-block! any-string!] "The series to output to" ; Not image!
	/local init len x
][
	; Shortcut return for empty data
	either empty? data [any [output make block! 0]] [
		; BIND/copy word and body
		word: either block? word [
			if empty? word [throw make error! [script invalid-arg []]]

   copy/deep word  ; /deep because word is rebound before errors checked
		] [reduce [word]]
		word: use word reduce [word]
		body: bind/copy body first word
		; Build init code
		init: none
		parse word [any [word! | x: set-word! (
			unless init [init: make block! 4]
			; Add [x: at data index] to init, and remove from word
			insert insert insert tail init first x [at data] index? x
			remove x
		) :x | x: skip (

   throw make error! reduce ['script 'expect-set [word! set-word!] type? 
   first x]
		)]]
		len: length? word ; Can be zero now (for advanced code tricks)
		; Create the output series if not specified
		unless into [output: make block! divide length? data max 1 len]
		; Process the data (which is not empty at this point)

  until [ ; Note: output: insert/only output needed for list! output
			set word data  do init

   unless unset? set/any 'x do body [output: insert/only output :x]
			tail? data: skip data len
		]
		; Return the output and clean up memory references
		also either into [output] [head output] (
			set [word data body output init x] none
		)
	]
]
onetom
20-Apr-2011
[1261]
BrianH: thanks, but where can i find such info normally, beside in 
ur brain?
BrianH
20-Apr-2011
[1262]
R3 chat #837 is where the R2/Forward project is normally stored. 
I'll be putting it in github as well as soon as I can figure out 
how to export or replicate the change history.
onetom
20-Apr-2011
[1263]
the change history of what? r3 file storage?
BrianH
20-Apr-2011
[1264x3]
Revisions to R2/Forward since the initial release to DevBase.
There is a similar bug in many of the R3 mezzanine control functions 
(the opposite, actually), but fortunately most of R2's mezzanine 
control functions were converted to native in R3, so the bug doesn't 
affect much.
The revised mezz-series.r (relative to the 2.7.8 SDK source) is in 
R3 chat #8008 - that's the number of the particular version, which 
you can see by going to #41 (R2/Mezzanines) and doing a LF command.
onetom
20-Apr-2011
[1267]
these numbers are like the memory locations in home computers... 
spectrum, c64 (i didn't have an amiga..) in DOS 8000 was the HDD 
bios start, i think..
BrianH
20-Apr-2011
[1268]
The chat interface uses numbers as a deliberate design choice because 
it is easier to memorize and refer to a number than it is to a path 
or message ID. You can even write a message number in #8008 form 
in another message and it can be followed like a hyperlink to the 
message of that number. You can also do the hyperlink trich to CureCode 
tickets using the bug#539 form, which will take you to http://issue.cc/r3/539
(that R3 bug I mentioned above).
GrahamC
26-Apr-2011
[1269]
Anyone have this ? http://www.fm.tul.cz/~ladislav/rebol/peekpoke.r

It's not on Ladislav's site anymore at that url
Geomol
26-Apr-2011
[1270x3]
Is there a point in allowing refinements like this?

/1a
REBOL also allow decimal! refinements like:

/1.2

but treat it like an integer refinement.


Some further thoughts: Can refinements be categorized in two groups, 
integer refinements and word refinements? If yes, then the refinement 
datatype maybe should be two different datatypes?
Hm, maybe what I call integer refinements shouldn't be allowed at 
all, as I see no point in them. I can't get the desired path using 
integer refinements as in:

>> to-path [blk /2]
== blk//2

The correct way is:

>> to-path [blk 2]
== blk/2

So if integer refinements are useless, what's the point?
Rebolek
26-Apr-2011
[1273]
John, I'm not sure I understand. Aren't you confusing path with refinement?
Geomol
26-Apr-2011
[1274x3]
No, they're different. I know. You can use refinements to build paths, 
else refinements are used in functions. REBOL allow what I call integer 
refinements, as the scanner doesn't give error. I ask why is that?
Or, maybe we can't actually use refinements to build paths, now I 
think of it. :-)
I can cook it down to: Why would REBOL allow refinements like:

/1
/1a
/1.2


My guess is, it's a side effect of how the scanner handle paths with 
integers, like: blk/1

So shouldn't refinements have the same rules as words, like the core 
manual suggest?
Rebolek
26-Apr-2011
[1277]
Ah, now I understand. It's probably a "bug" in scanner.
Geomol
26-Apr-2011
[1278x3]
Because those refinements are allowed, you can write:

f: func [/2] [ ... ]

But that kinda makes no sense.
No kidden, people get confused:

>> f: func [/2] [if 2 [print "It's 2!"]]
>> f
It's 2!
>> f/2
It's 2!

I can even write

>> f/3
It's 2!
In R3, at least we get:

>> f: func [/2] [if 2 [print "It's 2!"]]
>> f
It's 2!
>> f/2
** Script error: incompatible refinement: 2

But the refinement is still valid.
Ladislav
26-Apr-2011
[1281]
Graham, see:

http://www.fm.tul.cz/~ladislav/rebol/library-utils.r
Henrik
26-Apr-2011
[1282]
I'm having problems renaming a file on a USB stick with R2 under 
Windows. It reports "cannot access". R3 does not have this problem. 
Can anyone reproduce this?
Geomol
26-Apr-2011
[1283x2]
I did this under OS X with R2:

>> write %/Volumes/NICOM/test.txt "Testing..."
(and the files was produced, then)
>> rename %/Volumes/NICOM/test.txt %/Volumes/NICOM/test2.txt
** Access Error: Cannot rename test.txt

So an error.
With R3, it works here.
Henrik
26-Apr-2011
[1285]
ok, that is interesting. possibly file system related?
Geomol
26-Apr-2011
[1286]
Possibly, as rename works on HD in R2.
Henrik
26-Apr-2011
[1287]
the mezz source says that if the file is not found, then it can't 
be accessed.
Cyphre
26-Apr-2011
[1288]
Henrik, I have no problem with renaming a file on USB stick...tested 
under WindowsXP SP3
Geomol
26-Apr-2011
[1289]
Henrik, I can read the file with REBOL command READ in R2.
Henrik
26-Apr-2011
[1290x2]
perhaps it's a timing issue?
it works, if I open the port and find the file by hand
Cyphre
26-Apr-2011
[1292]
>> read %/f/
== [%data %KeePass/ %TrueCrypt/ %autorun.inf %test.r]
>> rename %/f/test.r %test2.r
>> read %/f/
== [%data %KeePass/ %TrueCrypt/ %autorun.inf %test2.r]
>>
Henrik
26-Apr-2011
[1293]
RENAME uses OPEN, not READ.