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

World: r3wp

[Core] Discuss core issues

Rebolek
3-Jan-2010
[15310]
I was reading http://www.chalicegames.com/swym/SwymWebIntro.html
and some concepts were interesting to me(especially ETC), so I made 
REBOL equivalents:

http://box.lebeda.ws/~rebolek/rebol/swyv.r


There's a documentation in the script, so just few examples of what 
it can do:

SERIE:


>> serie [etc 1 2 4 .. 20 cycle [1 2 3] length 5 iterate [x: x + 
10] from 10 5]

== [1 2 4 8 16 1 2 3 1 2 10 20 30 40 50]

COMPARE:

a: [1 2 3 4 5 6 7 8 9]
b: [2 4 6]
>> compare a b [some a > every b]

== true


>> compare a b [one a > every b] 

== false

FILTER:

>> filter serie [iterate [x: x + 1] 10 ] [[x > 2] [x < 5]]

== [3 4]

>> filter etc [3 6 9] 100 [x > 250]

== [252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 
300]

>> filter serie [1 .. 10] [[x > 5][zero? x // 2]]
== [6 8 10]


It's written in R3 but should also work in R2 (not tested). It's 
not optimized so if you're interested in it, feel free to do whatever 
you want to improve it (more patterns that ETC can recognize...).
Gregg
3-Jan-2010
[15311]
Cool Bolek.
Dockimbel
3-Jan-2010
[15312]
Rebolek: thanks for the link, lots of good food for thought here. 
That would be great to support it at native level (using a R3 extension). 
I also wonder how much of it could be implemented efficiently using 
'map-each and 'apply. Anyway, this could be a really great addition 
to R3 (or even R2). Keep up the good work.
BrianH
3-Jan-2010
[15313]
The REBOL equivalent of the functional-language operation fiter is 
REMOVE-EACH.
Rebolek
3-Jan-2010
[15314x2]
Brian: FILTER is REMOVE-EACH on steroids.

Gregg, Doc: Thanks! What I'm working on right now is this:

divisor: func [x][filter serie [1 .. x][zero? x // i]]
prime?: func [x][equal? 2 length? divisor x
filter [1 .. 50][prime? x]

this must work.
well, add the missing "]" ;)
BrianH
3-Jan-2010
[15316]
I was talking about the functional-language filter operation, not 
Bolek's (much cooler) FILTER :)
Steeve
3-Jan-2010
[15317]
Well it's interesting as a study dialect. But to be honest guys, 
i don't see the interest  to have them in Rebol.

Because we can do much of the use cases rebolek showed us  with one 
or two lines of rebol code.

And i don't need to say that it will got lightning speed by comparison

But anyway, It's lot of fun to do such things with Rebol.
Gregg
4-Jan-2010
[15318]
I think that's the point Steeve. Looking for new ways to express 
things, that may be useful, and may inspire more useful adaptations.
Graham
4-Jan-2010
[15319]
spell: func [ check [string!]
	/local req result suggestions
][
	req: reform compose copy [ 

  <spellrequest textalreadyclipped="0" ignoredups="1" ignoredigits="1" 
  ignoreallcaps="0"> 
		<text> (check)  </text> </spellrequest> 
	]

 result: load/markup read/custom https://www.google.com/tbproxy/spell
 reduce [ 'POST req ]

 either parse result [ tag! tag! tag! set suggestions string! tag! 
 tag! end ][
		parse suggestions none
	] [ none ]
]

>> spell "rebol"
connecting to: www.google.com
== ["reboil" "rebel" "reboils" "Reebok" "rebook"]
Anton
4-Jan-2010
[15320]
Bolek, that's very interesting for me because I was searching for 
just such a declarative dialect for sound generation and music composition.
Pekr
4-Jan-2010
[15321]
Anton - still experimenting with sound? Maybe R3 Extension based 
on fmod is waiting for you to bring it to REBOL? :-)
Rebolek
4-Jan-2010
[15322]
Anton, I'm glad to hear that. In which way are you interested to 
use it in sound/music generation? One of my first thoughts was howe 
to use this together with Sintezar. It should probably be used for 
oscillator wavetables generation... I'm not sure.
Pekr
4-Jan-2010
[15323]
Rebolek - do vectors help you with sounds? There are some high-priority 
changes planned for vectors for the 3.0 beta IIRC.
Rebolek
4-Jan-2010
[15324]
Pekr, vectors are really great. But they need few improvements and 
 bugfixes here and there. I wrote a document what doesn't work and 
should some time ago (has been two years already? I think so). I 
haven't looked at them recently, so maybe they're improved already. 
I should check my R3 AIFF/WAV loaders/savers wheter they work as 
they have been the best test for vectors I had.
Pekr
4-Jan-2010
[15325x2]
High priority for Vector says - Basic vector! conversions and ops 
... dunno how Carl sticks to the published project plan though ...
Whole document is here - http://rebol.com/r3/docs/project.html.... 
there are even some sound related changes planned, although with 
lower priority ...
Pavel
4-Jan-2010
[15327]
Rebolek How much differ vectors from binary in sound application 
isn't it pure record of numbers only?
Rebolek
4-Jan-2010
[15328]
Pavel, yes it is. But you can say that binary! is subset of vector! 
- 8bit unsigned vector. With vector! You can generate for example 
16bit signed stream and then just add WAV/AIFF header. So vector! 
is superior to binary! from this point of view.
Gregg
4-Jan-2010
[15329]
Very nice Graham!
james_nak
5-Jan-2010
[15330]
Smart guys. This may seem elementary but I need to check if certain 
ports are open on a windows machine. For example, port 8881. I use 
something like error? try [close open to-url "tcp://:8881"]  (building 
these strings with various port numbers). My problem is I don't know 
how to check if it is working. I turn on the firewall and it doesn't 
seem to make a difference. Perhaps my thinking is all wrong and all 
I am doing is checking within the firewall. Any thoughts?
Graham
5-Jan-2010
[15331x2]
all that does is trying to open a server port
if you want to check if there is a server port listening then you 
can do

open tcp://localhost:8881


and if you want to see if that port is open to the outside, then 
you need to use another PC to probe that port address
sqlab
5-Jan-2010
[15333]
This should work, where server is the ip adress or dns name of  the 
relevant machie

opened: []

for i 1 65536 1 [
   all [
		print i
		attempt [p: open join tcp://server: i ]
		attempt [close p]
		append opened i
    ]
]
Graham
5-Jan-2010
[15334x2]
won't opened contain all the i's?
if you want to only see those successfully opened, I would put the 
'append  after server: i
sqlab
5-Jan-2010
[15336]
do you regard the all [..] ?
Graham
5-Jan-2010
[15337]
won't attempt always return the same value?
sqlab
5-Jan-2010
[15338]
I do not follow ?
Graham
5-Jan-2010
[15339x4]
oh .. I isee it doesn't
how about


attempt [ print i close open join tcp://server: i append opened i 
]

and do without the p, and the all ....
for i 65536 1 [ attempt [ print i close open join tcp://server: i 
append opened i ] ]
for i 1 ...
sqlab
5-Jan-2010
[15343]
of course, you can also omit the print
Graham
5-Jan-2010
[15344x2]
or shorten it to 'prn ...
'prin
james_nak
5-Jan-2010
[15346]
Thanks Graham and Sqlab. One step further if you please. What would 
you suggest the steps would be to test the code. Right now when I 
run the test I get no opened ports. I've turned the firewall off 
and on but the results are the same. 

I've been studying the nettools.r code and thinking that maybe I'm 
not thinking this right. What I want to know is if a certain port 
will allow it to be open so that this particular application has 
can use.it. What is happening is customers are installing the app 
and having trouble because these certain ports are unavailable. What 
I wanted to create was a quick and easy pre-install test to verify 
these ports were open. This partly due to the fact that they way 
the software was written it doesn't tell you that a closed port is 
the problem. It simply stops worting. 
I appreciate the feedback you have given.
Dockimbel
5-Jan-2010
[15347]
Cheyenne has such opened listen port detection capabilities (added 
recently), you can extract the code from the SVN repo (search for 
'list-listen-ports function) : http://code.google.com/p/cheyenne-server/source/browse/trunk/Cheyenne/misc/win32.r


Linux and OS X versions are also available in %misc/unix.r and %misc/macosx.r
james_nak
5-Jan-2010
[15348]
Thanks Doc.
Graham
5-Jan-2010
[15349x2]
what the code checks for is if anyone is listening at a certain port 
...not whether the firewall is open or closed.
If the firewall is off, but no one is listening ... then you'll get 
a closed port
same as if the firewall is on, and someone is listening...
Claude
5-Jan-2010
[15351]
what about R3 status ? make uptodate  R2 is very fine but i would 
prefer a R3 version with GUI and ODBC or MYSQL ..................;
BrianH
5-Jan-2010
[15352x3]
The R3 GUI is still in development. The database model hasn't even 
been designed yet. You can make wrappers for ODBC and MySQL if you 
want to write the extensions - Robert has already started doing so 
for SQLite. Once device extensions are supported, we can start to 
get to work on the database model.
R3 Status: The beta will come out without GUI, database or (unless 
there is some miracle) SSL.
some miracle

 in this case meaning a community member with the time volunteering 
 to do the work.
Claude
5-Jan-2010
[15355]
do you have a plan for the beta realase ?  one week, month,
BrianH
5-Jan-2010
[15356]
It's a little flexible - outside circumstances have affected the 
timing already.
Claude
5-Jan-2010
[15357x3]
thank you for your effort on
thank you for your effort on R3 and R2
i am just like an end user on R3.  and for me i am not a guru like 
you and others !!!!!