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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

mhinson
23-Dec-2010
[4037]
Thanks Greg.   I didnt realise the Telnet scheme "port" concept was 
a Rebol generic thing, I mistakenly thought it was specific to the 
undocumented telnet scheme.   Looks like I need to do a close port

This is great, I am now getting somewhere.  Thanks again for your 
help.  

Will R3 impliment telnet as a native? Or is it too soon to ask?
GrahamC
23-Dec-2010
[4038]
It will be one of those DIY things i suspect
nve
25-Dec-2010
[4039]
Question from ThomasP : 
how can I create a local SMTP server?
the SMTP server should run in the background, I just do:
set-net [127.0.0.1] to send my mail
I find simulator SMTP server on the web, but no real server.
Steeve
25-Dec-2010
[4040]
Hu ? Just download a free one
GrahamC
25-Dec-2010
[4041x2]
use Cheyenne
which is also free :)
alemar
18-Jan-2011
[4043]
Hi,so i am quite new to the rebol community and have been assigned 
a project to work on.So to be frank i started reading rebol 2 days 
ago and i am quite confused since i worked with c++ before that.I 
am stuck at flow control and operators(sad i know).So basicaly i 
thought of when i moved from delphi to c++,basically if one of you 
guys can provide me with a rebol version of this small program i 
whipped up(flow control number check-the basics) it would be of great 
help to me,so here is my program and thanks in advance.
    

It inputs an integer number n and outputs the sum: 1+22+32+...+n2.I 
use input validation for n to be positive.
#include <iostream>
using namespace std;
    
int main()
{
     int n;
     cin >> n;
     if (n < 0) return 1;
     int sum = 0;
     int i = 0;
     while (i <= n) sum += i*i;
     cout << sum;
     return 0;
}
Maxim
18-Jan-2011
[4044x2]
welcome to REBOL Martin , C++ to REBOL is probably the biggest jump 
you can make, but I'm sure you'll see the light in the end  ;-)


If your feel like REBOL is breaking the rules (those which you are 
used to in other languages), in fact see it more like, there are 
much *less* rules in REBOL.


although this freedom is dauting at first, I hope you'll come to 
appreciate it.
I'll give you a convertion in a few secs...
Henrik
18-Jan-2011
[4046]
welcome to REBOL :-)
alemar
18-Jan-2011
[4047x4]
wow thanks alot maxim that would really help me get my act together 
it`s just that basic flow control and inputs are my weacknesses in 
this langueage
oh and oops the code does: 1+2^2+3^2+...+n^2
yeah my bad :D
thanks for the worm welcome
Maxim
18-Jan-2011
[4051]
yea.. hehe I was wondering  ;-)
alemar
18-Jan-2011
[4052]
well copying from linux does that to you
Maxim
18-Jan-2011
[4053]
in the above you use   cin   ...   do you expect the input to be 
piped ?
alemar
18-Jan-2011
[4054x3]
piped?
basically c input
it inputs a vallue for a varriable
Maxim
18-Jan-2011
[4057]
ok.
alemar
18-Jan-2011
[4058]
this >> is input and << is output
Maxim
18-Jan-2011
[4059x2]
yeah.. I don't use the C++ console ops a lot, I do C mainly.
but here goes...

n: to-integer ask "enter a number"
if  n < 0  [quit/return 1]
sum: 0
i: 0
while [ i <= n ] [ sum: sum + probe (i * i)  i: i + 1]
print sum
alemar
18-Jan-2011
[4061]
basically when you have cin>>n it awaits a vallue to be inputted 
in the console window
Maxim
18-Jan-2011
[4062]
rebol returns 0 by default when you are the end of a script... so 
no need to add it at the end.
alemar
18-Jan-2011
[4063x4]
aha
ok so i just dont understand 2 lines of the code
sum:0
i:0
Maxim
18-Jan-2011
[4067]
note, I added a little probe which prints the value at each step.


I did this to show you one powerfull aspect of REBOL... you can insert 
functions like *chains*
alemar
18-Jan-2011
[4068]
wow
Maxim
18-Jan-2011
[4069]
the probe actually is transparent and returns the value it received 
while printing it.
Pekr
18-Jan-2011
[4070]
alemar, in rebol, the assignment is done via :, not =
alemar
18-Jan-2011
[4071x2]
aaa like delphi
i get it
Pekr
18-Jan-2011
[4073]
hmm, delphi uses :=, IIRC? But I might be confused by CA Visual OBjects 
I used in the past :-)
Maxim
18-Jan-2011
[4074]
just a few functions don't return values (like print) in this case 
you will get an error, but the error should give you clues
alemar
18-Jan-2011
[4075x2]
well in delphi you define a value by := and : only explaines the 
type (boolean,integer..
aha gr8
Henrik
18-Jan-2011
[4077]
that's one powerful aspect of REBOL: it figures out the type on its 
own, mostly.
alemar
18-Jan-2011
[4078x4]
trying to compile the code now but the compiler from the site is 
a bit tricky
** Script error: n has no value
** Where: while
** Near: while [i <= n] [sum: sum + probe (i * i) i: i + 1]
:D
ok is the Near error a syntax error in the cycle?
Maxim
18-Jan-2011
[4082]
the main difference in REBOL is that everything you can manipulate 
is a value, even functions and objects don't have a special syntax 
to use... they are values just like anything else.
Henrik
18-Jan-2011
[4083]
there is no compiler...
Maxim
18-Jan-2011
[4084]
hehehe... if you paste it directly in the console, the ask will intepret 
the next line as the answer  ;-)
alemar
18-Jan-2011
[4085]
then what am i using :D
Pekr
18-Jan-2011
[4086]
:-)