• 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
r4wp5907
r3wp58701
total:64608

results window for this page: [start: 4701 end: 4800]

world-name: r4wp

Group: #Red ... Red language group [web-public]
Bo:
29-Mar-2013
I tried to compile the OpenCV test script for Linux-ARM on a Windows 
system, and I get the following error:

*** Compilation Error: invalid import specification at: libopencv

Is this because I need OpenCV installed on Windows first?
DocKimbel:
29-Mar-2013
linked
 is a bad choice there, "encoded" will be more accurate.
Bo:
29-Mar-2013
OK.  Thanks!  I'll give that a try.
Kaj:
29-Mar-2013
You can also give console-pro a file or URL to DO on the operating 
system command line
Gregg:
29-Mar-2013
The zip doesn't want to download for me. Must be a sign I should 
run lean for the moment, and bug Doc for a few features. :-)
Gregg:
29-Mar-2013
I'm really impressed with all you've done Kaj. And since I'm going 
to start on a DLL interface shortly myself, I will no doubt bug you 
for advice.
DocKimbel:
30-Mar-2013
I will be mostly offline this weekend as I'm making a trip by the 
coast.
Gregg:
30-Mar-2013
Have a nice break Doc.
Gregg:
30-Mar-2013
I've hacked Ladislav's INCLUDE to let me build .red scripts, and 
I built a console with my mezzanines. When you get back, I'll chat 
with you about it, and send it to test. It compiles fine, but some 
funcs fail if compiled in. If I then paste them into the console, 
they work fine. e.g.

negate: func [n [number!]] [n * -1]
Gregg:
30-Mar-2013
zero?: func [n [number!]] [n = 0]
divisible?: func [a b] [0 = remainder a b]
even?: func [n [number!]] [zero? remainder n 2]
even?_a: func [n [number!]] [0 = remainder n 2]
even?_b: func [n [number!]] [divisible? n 2]
remainder: func [
	a [number!]
	d [number!] "Divisor"
][
	a - (d * (a / d))
]

zero? 0 == true
zero? 1 == false
remainder 10 3 == crash!
divisible? 10 3 == false
divisible? 10 2 == false  INCORRECT
even? 10 crash
even?_a 10 == false  INCORRECT
even?_b 10 == false  INCORRECT
Kaj:
30-Mar-2013
ZERO? is already implemented as a fast routine in my common deposit:
Kaj:
30-Mar-2013
Funny, it looks like you introduced a crash! type next to error! 
above :-)
Kaj:
30-Mar-2013
For performance in the interpreter, better write remainder as a - 
(a / d * d)
Kaj:
30-Mar-2013
Just checking. It's a relative notion
Gregg:
31-Mar-2013
In %boot.red, FOREACH says it only accepts a word, but it also seems 
to take a block of words just fine. Should block! be added to the 
word arg spec?
DocKimbel:
1-Apr-2013
That shouldn't be a problem because, it's on the symbol creation, 
before it gets a reference to a value...
DocKimbel:
1-Apr-2013
The issue is the value slots in the global contexts now always return 
TYPE_UNSET...will track it in a few minutes.
Gregg:
1-Apr-2013
That is, I would expect a hard crash of some kind in that case.
DocKimbel:
1-Apr-2013
Yep, but the fix is a bit longer.
Bo:
3-Apr-2013
Nevermind.  Windows search is a piece of garbage.  Wrote a Rebol 
search and found it right away in C-library.reds.
Bo:
3-Apr-2013
Seriously...how hard is it to write a search that actually works? 
 Microsoft has how many billions of dollars?
Kaj:
3-Apr-2013
Francois includes an old version of my C library binding. Newer versions 
use a different API on ARM to define on-quit
Bo:
3-Apr-2013
Yes, I had a copy of your newer C library binding.  I compared the 
relevant sections and added in the appropriate parts.  Now I have 
a different problem, possibly due to me not running a gui on my Raspberry 
Pi.  Don't know yet if OpenCV requires a GUI to operate or not.
Bo:
3-Apr-2013
undefined symbol: cvCreateCameraCapture


which is a component of highgui.reds, which I #include in my program.
Bo:
3-Apr-2013
Yes, he added a couple of items:

        ;added by F. Jouen
        ; is not a number? 
        isNaN: "isNaN" [
                value           [float!]
                return:		[logic!]   
        ]
        ;isinf - test for infinity
        isInf: "isInf" [
                value           [float!]
                return:		[integer!]
        ]
        ;// F. Jouen
Bo:
3-Apr-2013
Is there a how-to for Fossil?  I checked http://red.esperconsultancy.nl/Red-C-library/wiki
but don't see a how-to there.
AdrianS:
3-Apr-2013
Bo, wrt crappy built-in searching, I highly recommend the Everything 
search utility from voidtools. Best file search for Windows. Lightweight 
(no need for service), small, and quick. I've been using this for 
quite a while and I thought that development had unfortunately stalled, 
but, since the new year, it looks like it's being actively worked 
on again. I'm so happy! Yes, it is that nice!

http://www.voidtools.com
Bo:
3-Apr-2013
Kaj, I did a Google search on isNaN and cannot find a list of C libraries 
that don't support it (or that do).  Do you have any ideas on how 
to do this check?
Bo:
3-Apr-2013
AdrianS: Unfortunately, it won't work for me:

From their FAQ:
1.3 Does Everything search file contents?

No, "Everything" does not search file contents, only file and folder 
names.


I find that I search within file contents at least as much as for 
filenames.  It shouldn't be too hard to write a Rebol-based standalone 
exe that would do this.  I'll add it to my growing list of scripts 
to write.
Ladislav:
3-Apr-2013
Does Red already have a URL! datatype?
NickA:
4-Apr-2013
I believe Red can find a market:  http://www.drdobbs.com/jvm/the-quiet-revolution-in-programming/240152206?cid=DDJ_nl_upd_2013-04-03_h&elq=6510ad5ddf4b42adb5b3cd05ed730e24
DocKimbel:
4-Apr-2013
Yes, there's an opportunity for a language like Red with very broad 
possible usage.
Gregg:
5-Apr-2013
Quick tests inserting a string in a string work, but inserting a 
word or integer crash.
DocKimbel:
5-Apr-2013
Just clone a fresh copy in a temp folder and try recompiling the 
console.
DocKimbel:
5-Apr-2013
(or download a zip package)
Gregg:
5-Apr-2013
Downloaded a zip, built the console, still crashes.
DocKimbel:
5-Apr-2013
Not sure if I've mentioned it here before, but tomorrow I'm moving 
to a new place, on the shore, so I'll probably be offline the whole 
day.
Pekr:
5-Apr-2013
I thought I am the only one refressing the Github commit log several 
times a day :-)
Pekr:
5-Apr-2013
eh, too much of a beer - refreshing, I mean .....
DocKimbel:
5-Apr-2013
Guys, you can just subscribe to the commits feed, and preserve your 
keyboard a bit: 
https://github.com/dockimbel/Red/commits/master.atom
;-)
DocKimbel:
5-Apr-2013
Oldes: you're right, I'm becoming a bit too careless, I'll try to 
get something done at least tomorrow, then I'll go swim in the sea. 
;-)
DocKimbel:
5-Apr-2013
Will be 22°C tomorrow, a shiny day, water should be still a bit cold 
though. :-P
DocKimbel:
5-Apr-2013
Yeah, I just recover a few weeks ago from winter flu, time to play 
with another virus. ;-)
Gregg:
6-Apr-2013
If I do this in the console:


foreach word system/words [print [mold word tab mold type? get word]]

I get a long list of words, that end with this:
...
do-console      function!
red-prompt      unset!
mode    unset!
switch-mode     unset!
eval    unset!
code    unset!
result  unset!
cnt     unset!
mono    unset!
block   unset!
q       function!
red>>


Now, if I paste a bunch of code in the console and do it again, the 
newly added words all come back as type datatype!.  e.g.
...
block   unset!
q       function!
Title   datatype!
Author  datatype!
File    datatype!
Tabs    datatype!
any-function?   datatype!
...
DocKimbel:
7-Apr-2013
Gregg: looks like a bug related to the one fixed recently about system/words 
returning datatype! only.
Kaj:
7-Apr-2013
I'm moving to a new dual-core machine. When compiling Red, it uses 
only one core, so I'm considering using 0MQ to make use of the extra 
core
Arnold:
7-Apr-2013
A new dual core machine? Do they still manufactor those? 

I kind of had the idea the OS decides when to use more than one processor.
Kaj:
7-Apr-2013
Yep, it could dedicate a whole core to that :-)
Arnold:
7-Apr-2013
But seriously why not a machine that is more actual? Because you 
prove the minimalistic needs?
Oldes:
9-Apr-2013
It is not possible to create struct with function datatype as a member?
Gregg:
10-Apr-2013
Haven't checked to see if it's a known issue, but if I append/dup 
with a large number of elements it crashes. I'll try to track down 
the exact number. 75K does it, 65K does not (in a quick int append 
test).
Gregg:
10-Apr-2013
Ah, that would explain my errors Endo. I didn't include a header.
DocKimbel:
10-Apr-2013
For Red header, I've made it case sensitive on purpose as, unlike 
Rebol which is a very uncommon name, Red is very common, the risk 
of a false header detection is much higher (for scripts embedded 
in HTML, makedoc document, etc...). So the case-sensitivity would 
lower the number of false positives. An added benefit is that it 
forces users to write Red name correctly, so not RED or red.
DocKimbel:
10-Apr-2013
Endo, you could even make it a webservice that could be used with 
a simple WGET call from a command-line. ;-)
Gregg:
10-Apr-2013
On the header, having it be Red may lead to the most false positives. 
If it's at the top of a file, it would normally be capitalized.
Gregg:
10-Apr-2013
As long as it must be followed by a left bracket, you should be OK 
though.
Kaj:
10-Apr-2013
It was my understanding that string/rs-head returns a UTF-8 cache 
of a string. How can I get this value?


I'm trying to get UTF-8 back that I fed in. The problem I'm having 
is the following:

write %syllable.org.html read "http://syllable.org"

This writes out just one character instead of the expected file.
Gregg:
11-Apr-2013
My small test was for a FILTER function:

filter: function [
	"Returns all values in a series that match a test."
	series [series!]

 test [function!] "Test (predicate) to perform on each value; must 
 take one arg" ; TBD: any-function!
	/out "Reverse the test, filtering out matching results"
][
    result: copy []
    ; The lambda here is like QUOTE, but it evaluates.
    op: either out [:not] [func [val] [:val]]
	foreach value series [
		if op test :value [append/only result :value]
	]
	result
]
Gregg:
11-Apr-2013
Given the block size limit, I used a block with 60K elements in it:

b: append/dup copy [] [1 b #c "d"] 15000
Gregg:
11-Apr-2013
I have to loop >5 times before I see *any* delay in the console prompt 
returning. At 10 times, it seems to take about a second.
DocKimbel:
11-Apr-2013
I will have a look today at the reported Curecode issues, then I'll 
get back to Red coding, probably working first on the exception support 
for Red/System (in order to be able to implement EXIT/RETURN support 
for the interpreter).
Endo:
11-Apr-2013
Thank's for the feedbacks, making a webservice-red-compiler is a 
nice idea, but I made it for lazy people like me to be able to compile 
Red scripts easily. 

Doc: red-lang.org is on a Cheyenne server or a normal hosting service?
DocKimbel:
11-Apr-2013
So you just compiled tests/hello.red or did you use a custom script?
Gregg:
12-Apr-2013
Since it's early days in Red, I'm toying with a lot of ideas and 
revisiting old REBOL funcs as I port them. JS has an interesting 
spin on MAP. I thought I'd see how hard it would be to do in Red.
Gregg:
12-Apr-2013
; JS-like MAP. The order of args to the function is a bit odd, but 
is set

; up that way because we always want at least the value (if your 
func takes

; only one arg), the next most useful arg is the index, as you may 
display

; progress, and the series is there to give you complete control 
and match

; how JS does it. Now, should the series value be passed as the head 
of the
; series, or the current index, using AT?
map-js: func [

 "Evaluates a function for each value(s) in a series and returns the 
 results."
	series [series!]

 fn [function!] "Function to perform on each value; called with value, 
 index, and series args"
	/only "Insert block types as single values"
	/skip "Treat the series as fixed size records"
		size [integer!]
][
	collect [

  repeat i length? series [   ; use FORSKIP if we want to support /SKIP.
			keep/only fn series/:i :i :series ; :size ?
		]
	]
]
;res: map-js [1 2 3 a b c #d #e #f] :form
;res: map-js [1 2 3 a b c #d #e #f] func [v i] [reduce [i v]]
;res: map-js [1 2 3 a b c #d #e #f] func [v i s] [reduce [i v s]]
;res: map-js "Hello World!" func [v i s] [pick s i]
DocKimbel:
12-Apr-2013
An important note about such code: passing a function! as argument 
is not supported by the compiler yet, so this function could only 
work in the interpreter currently (from console or from a DO block).
Gregg:
12-Apr-2013
Good to know. Thanks. I'm trying to stay just a few steps behind 
you in what I try. :-)
DocKimbel:
13-Apr-2013
For Red/System fans, here's some new toy: exceptions! Here's a simple 
example for starting:
DocKimbel:
13-Apr-2013
A deeper nested example:

foo2: does [
	print "3"
	throw 100
	print "KO"
]

bar: func [[catch]][
	print "2"
	foo2
	print "KO"
]

print "1"
bar
print ["^/thrown value: " system/thrown lf]
DocKimbel:
13-Apr-2013
The implementation is done and I will push it in a few minutes. It 
required about 25 additional LOC to implement all such simple exception 
system (right, 25!). ;-)
DocKimbel:
13-Apr-2013
So, how does it work? When you need to interrupt the flow of code 
in a function in Red/System, currently you can just use EXIT/RETURN 
to make an early exit. But, sometimes, you need to go up through 
several nested calls, that's where the new THROW function comes handy. 
It will interrupt the execution and go up the call tree to find the 
first function that has the CATCH attribut set. It will then just 
resume execution after the last function call (from which the exception 
has been generated).


If no CATCH attribut is found, it will go up to global code and resume 
from there.
DocKimbel:
13-Apr-2013
THROW requires an integer! value. Such value represent the exception 
ID and is user-defined. After the resume from a caught exception, 
you can use SYSTEM/THROWN to read the passed exception ID and act 
accordingly (usually using a SWITCH dispatcher).
DocKimbel:
13-Apr-2013
Important thing to note: system/thrown needs to be manually reset, 
as the last thrown value will stay there if no exception occured. 
Such reset could be done before each call to a function that could 
generate an exception or after processing the thrown value.
DocKimbel:
13-Apr-2013
I could have added a much more sophisticated system with a true CATCH 
function, but this would have made the implementation way more complex 
and would have taken a lot more time. As I need it only for Red's 
interpreter, I think this way should be enough and will be usable 
by other Red/System programmers to enhance their own code.
DocKimbel:
13-Apr-2013
Thinking about it, it might be possible to allow an extended catch 
attribut with a integer value to specify the barrier value for catching 
exceptions (and avoid manual re-throwning), something like:

foo: func [[catch 100]][...]


would catch all thrown exceptions with a value <= 100 and let others 
pass up to caller.
DocKimbel:
13-Apr-2013
I've considered using a continuation approach for constant-time exception 
throwing (would also work from callbacks), but I didn't find a simple 
enough syntax for defining/using it without having to rely on CPS 
(Continuation-Passing Style) for every functions...

See http://en.wikipedia.org/wiki/Continuation-passing_style
DocKimbel:
13-Apr-2013
Another note: messing up with the stack (using push/pop) in a user-function 
is fine as long as you returned the stack clean before calling a 
function that could generate an exception. Failure to do so will 
result in a crash. It might be possible to make stack-unwinding for 
exception resistant to such cases, I will investigate that.
Gregg:
13-Apr-2013
That sounds great Doc. I collected your comments into a file in %Red/.
DocKimbel:
13-Apr-2013
Nope, see first example. This might be a bit non/counter-intuitive, 
I will see if I can improve that.
Arnold:
14-Apr-2013
Good progress. Nice of you to sum it up Gregg, makes the comments 
a whole lot more readable. Filename is a bit awkward though: "esceptions"
Gregg:
14-Apr-2013
I had a Spanish accent last night.
DocKimbel:
15-Apr-2013
Gregg, I've reconsidered the behavior of the [catch] function attribut, 
if I change it, some use cases become even less intuitive. For example, 
the single function use case (my first example above) performs quite 
intuitively. I think the  vague non-intuitive feeling at the beginning 
comes from our habits with CATCH native in Rebol, after using Red/System's 
way a bit, that feeling just faded away. Anyway, if you have suggestions 
for improvements, it's the right time.
Kaj:
15-Apr-2013
Doc, any idea how I can convert a string! passed into a routine! 
to UTF-8, or access a cached UTF-8 value?
PeterWood:
15-Apr-2013
Kaj, can you use string/mold inside the routine to create a c-string! 
?
PeterWood:
16-Apr-2013
The answer is not you can't as mold doesnt output a UTF-8 string.
DocKimbel:
16-Apr-2013
Kaj: cached UTF-8 string is available using str/cache if str is a 
red-string! value.
DocKimbel:
16-Apr-2013
We haven't yet implemented UTF-8 encoding functions in the standard 
library. It will be done during the I/O implementation (unless you 
have a strong need for it, then I'll have a look at it).
DocKimbel:
16-Apr-2013
After trying to use the new exception handling in the interpreter 
to implement EXIT/RETURN, I realized that the current behavior of 
the [catch] attribut is not suitable in a intensively recursive environment. 
So I had to change the moment the exceptions are caught to an earlier 
time. Now, it works like this:

	foo: does [
		print "3"
		throw 100
		print "KO"
	]

	bar: func [[catch]][
		print "2"
		foo
		print "4"
	]

	print "1"
	bar

will output: 1234


So, now the [catch] attribut resumes the execution at the current 
level, instead of the parent caller level like before.
DocKimbel:
16-Apr-2013
The catch flags position on stack has been changed to a safer place, 
so it's now resistant to a "dirty" stack left by user code (unbalanced 
PUSH/POP actions at the exception raising point).
DocKimbel:
16-Apr-2013
A [catch] flag will have no effect on exceptions launched from the 
same level (enables re-throwing exceptions).
DocKimbel:
16-Apr-2013
Not sure if you mean for exceptions or shared libs, so:
- Exceptions: I will push the upgraded ARM version in a few hours
- Shared lib: yes, we will support it on ARM too
Gregg:
16-Apr-2013
EXIT from a func exits the console. Is that intended?
DocKimbel:
16-Apr-2013
The console needs a [catch] somewhere to avoid such exceptions reach 
global code and exit from console.
DocKimbel:
16-Apr-2013
No need, I will process tonight as I need to do a bit more work on 
exceptions (like documenting them).
Gregg:
17-Apr-2013
You could still check system/thrown though, correct? And if you wanted 
to catch them, you could just have a MAIN func?
DocKimbel:
17-Apr-2013
Correct. Yes, it is possible to wrap all your global code in a MAIN 
func.
DocKimbel:
17-Apr-2013
Yep, C coder could feel easily at home. From what I've seen so far, 
people knowing C and Rebol can learn and use Red/System in a matter 
of hours. Even for pure C coders, learning Red/System should be trivial.
Kaj:
17-Apr-2013
Yes, you said you might speed it up if I have a big need for it, 
so I'm expressing my need
Kaj:
17-Apr-2013
I wanted to publish an article with examples on the birth of the 
interpreter and the porting of the bindings to Red, but if a simple 
READ WRITE example doesn't work, I think it's too early to talk about 
it
DocKimbel:
17-Apr-2013
I will have a look at it once shared libs are done, that's the best 
I can do for now.
4701 / 6460812345...4647[48] 4950...643644645646647