• 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
r4wp134
r3wp1094
total:1228

results window for this page: [start: 1201 end: 1228]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Gabriele:
20-Jul-2011
Oldes, try it with a skip of 3 or 4 to see why a block is returned. 
Not very handy in the 2 case though... but I guess there was a desire 
to avoid special cases.
Maxim:
20-Jul-2011
/skip return records
i.e.  
>> select/skip [1 2 3 4 5 6] 4 3
== [5 6]
BrianH:
20-Jul-2011
Fortunately the /skip in SELECT/skip is ignored for map! in R3, so 
you can just use it in both.
BrianH:
19-Sep-2011
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
		)
	]
]
Geomol:
12-Oct-2011
I suggest: skip ++ and use NEXT with call-by-word to do the same. 
Less functions to remember that way.
Endo:
12-Oct-2011
If it supports those actions, then it should be everywhere:

SKIP, ADD, DIV, NEXT, NEGATIVE, AND etc.. then it leads a overhead.
BrianH:
28-Oct-2011
Using R3 PARSE:
>> b: copy a parse b [any [change [set x block!] x | skip]] b
== [1 2 3 [4]]

>> b: copy a parse b [while [and change [set x block!] x | skip]] 
b
== [1 2 3 4]
BrianH:
28-Oct-2011
Or simpler:
>> parse copy a [return while [change [set x block!] x | skip]]
== [1 2 3 [4]]

>> parse copy a [return while [and change [set x block!] x | skip]]
== [1 2 3 4]
BrianH:
28-Oct-2011
The PARSE and WHILE versions above will work in all cases where you 
don't run out of memory, and for the deep versions when there are 
no cyclic references.

>> parse [[1] [2] [3 [4]] [[5]]] [return while [change [set x block!] 
x | skip]]
== [1 2 3 [4] [5]]

>> parse [[1] [2] [3 [4]] [[5]]] [return while [and change [set x 
block!] x | skip]]
== [1 2 3 4 5]
Geomol:
18-Dec-2011
x: mold 64#{
/9j/4faARXhpZgAATU0AKgAAAAgABwEPAAIAAAAESFRDAAEQAAIAAAAIAAAAYgEa
AAUAAAABAAAAagEbAAUAAAABAAAAcgEoAAMAAAABAAIAAAITAAMAAAABAAEAAIdp
is3eIoxUdG7n/9k=
}

copy/part skip x 3 -5 + length? x
Oldes:
26-Dec-2011
I have uploaded my latest EXIF-parser version at github - https://github.com/Oldes/rs/blob/master/projects/exif-parser/latest/exif-parser.r

To sort files you can use for example:

dir: %/e/DCIM/100CANON/
t: now/time/precise
result: copy []
foreach file read dir [
	error? try [
		ctx-exif/parse-file dir/:file
		exifdate: ctx-exif/get-tag-value 306
		repend result [exifdate dir/:file]
	]
]

sort/skip result 2

print ["sorted" (length? result) / 2 "files in" now/time/precise 
- t]
result

;>>sorted 120 files in 0:00:00.153
Endo:
3-Feb-2012
Thank you guys. I know the behaviour of charset in FIND. But I expect 
to skip the char that found, if I use /TAIL refinement as in using 
string.
Same for /LAST as Gregg said. It ignored for charsets. 
And also;
>> find/reverse "endo" charset "d"
== none
a bit confusing..
Oldes:
19-Feb-2012
in R3:
>> b: make map! ["a" "b" "b" "c"]
== make map! [
    "a" "b"
    "b" "c"
]

>> select b "b"
== "c"

in R2 I know only:
>> all [tmp: select/skip b "b" 2 first tmp]
== "c"
Oldes:
19-Feb-2012
I really would like to know, why the hell is the result with /skip 
refinement in block:/
Ladislav:
19-Feb-2012
MAP is an associative (Key <-> Value) data "storage". In R2 a correspoding 
way would be to use the hash! datatype, however, if you want to discern 
keys from values you need to use a separate Keys hash! and a separate 
Values block, otherwise you end up having Keys and Values intermixed. 
Your way of using the /skip refinement and a block is slower, however 
it searches only in Keys as well due to the /skip 2 use. When not 
used, it would search in Values.
Oldes:
19-Feb-2012
I know the theory:/ To have separate hashes for key and values would 
be even more complicated. I would be fine if the select/skip would 
not return a block which is simply stupid... or correct me if there 
is any reason for that. It's sad we cannot have map! in R2.
Oldes:
19-Feb-2012
I have the code:

get-attribute: func[name /local tmp][all [tmp: select/skip attributes 
name 2 first tmp]]

but it's so UGLY.
Oldes:
19-Feb-2012
Hm.. the reason for the additional block with the /skip is thi sone:
>> b: ["a" "b" "c" "d"   "b" "c" "d" "e"] select/skip b "b" 4
== ["c" "d" "e"]
Endo:
19-Feb-2012
Oldes: I was just about to write this, I asked is this a bug a few 
months ago, but no, it returns a block when you select with /skip 
because you can select more-than-one value if your skip size is > 
2 , otherwise you cannot get the further values. You select block 
of values when use /skip.
Group: Red ... Red language group [web-public]
Kaj:
20-Jun-2011
*** Compiler Internal Error: Script Error : first expected series 
argument of type: series pair event money date object port time tuple 
any-function library struct event
*** Where: opposite? 
*** Near:  [first select/skip opp-conditions cond 2]
Group: Topaz ... The Topaz Language [web-public]
Gabriele:
1-Dec-2011
I don't have string parsing in Topaz yet, but I wanted to illustrate 
how what Endo is asking in the Parse group would be much easier:

Topaz Interpreter - (C) 2011 Gabriele Santilli - MIT License
>> b: ["bla" 1 2 "bla"]
== ["bla" 1 2 "bla"]
>> parse b [collect any [keep number! | skip]]
== [1 2]
PeterWood:
2-Dec-2011
>> parse b [collect any [keep number! | skip]]
== [1 2]


Very interesting. What would be returned if the parse rule was more 
complicated and "failed" (ie would have returned false in REBOL).
Group: World ... For discussion of World language [web-public]
Geomol:
2-Dec-2011
I fear, that implementing unicode! datatype will mean, all series 
functions will have to deal with it separately, like LENGTH?, NEXT, 
SKIP, etc. Would it be an idea to make a unicode! datatype just to 
pass data back and forth and be able to view it somehow, but without 
support for all the series function?
Gregg:
2-Dec-2011
John, on range! values, do you envision transparent iteration/lazy 
generation support for them? I use the term 'bounds for what you 
call range! and my 'range is a series with the values filled in (with 
/skip support).
Geomol:
7-Dec-2011
World should accept REBOL [] as header to run R2, R3 scripts through 
it without editing these.

For now, it's possible to run REBOL scripts with this function:
do-rebol: func [file][do skip load file 2]
Group: REBOL Syntax ... Discussions about REBOL syntax [web-public]
Steeve:
23-Feb-2012
url! syntax (both R2,R3)
I've not created specific charsets, so the rule is more verbose.

- The first char! same as for word! (less "+-")
- Must contain at least one ':'
- "/" Allowed only after the first ":"
- Escape-uri allowed like in email!

url-syntax: [
	not digit not #"'" not sign word-char
	any [escape-uri | not termination-char not #":" skip]
	#":"
	any [escape-uri | #"/" | not termination-char skip]
]
Steeve:
23-Feb-2012
url-syntax: [
	[#"." not digit | not digit not #"'" not sign word-char]
	any [escape-uri | not termination-char not #":" skip]
	#":"
	any [escape-uri | #"/" | not termination-char skip]
]
Steeve:
23-Feb-2012
url-syntax: [
	not [digit | #"'" | #"." digit | sign] word-char
	any [escape-uri | not termination-char not #":" skip]
	#":"
	any [escape-uri | #"/" | not termination-char skip]
]
1201 / 122812345...9101112[13]