• 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: 27301 end: 27400]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Volker:
16-Nov-2005
is it possible to set the args of an error explicitely, instead of 
giving a string?
JaimeVargas:
16-Nov-2005
I tried using reduce but it didn't quite work. Append failed completely. 
Maybe I need a way to keep a block.
Volker:
16-Nov-2005
do you have a lisp-example?
JaimeVargas:
16-Nov-2005
(define subst
  (lambda (new old slist)
    (if (null? slist)
        '()
        (cons 
         (subst-in-symbol-expression new old (car slist))
         (subst new old (cdr slist))))))

(define subst-in-symbol-expression
  (lambda (new old se)
    (if (symbol? se)
        (if (eqv? se old)
            new
            se)
        (subst new old se))))

(subst 'a 'b '((b c) (b () d)))
JaimeVargas:
16-Nov-2005
== ((a c) (a () d))
JaimeVargas:
16-Nov-2005
>> sub-sb 'a 'b [[b c] [b [] d]]
== [[a [c 
            []
        ]] [[a [
                [] [d 
                    []
                ]
            ]] 
        []
    ]]
Volker:
16-Nov-2005
So not linear, but a tree. And you use blocks as lisp-pairs.
Volker:
16-Nov-2005
Do you need a rebol-version for this problem, or general a cons-emulation?
Volker:
16-Nov-2005
In this case i would not cons a new tree, but change the old (or 
a copy of it).
Volker:
16-Nov-2005
if i understand right, we could use a block for a lisp-pair, and 
'first and 'second for car/cadr ?
Volker:
16-Nov-2005
and a list (a b c) would look like
 [a [b [c nil] ] ]
Volker:
16-Nov-2005
something like
cons: func[a b][
 reduce[ first a  b  ]
]
Volker:
16-Nov-2005
cons: func[a b][ reduce[ first a  b  ] ]
 probe cons[a none] cons [b none ][c none]
== [a [b [c none]]]
and 
(cons 'a (cons 'b '(c)))
== (a b c)
JaimeVargas:
16-Nov-2005
This is my cons it works well. I think there is a problem with yours. 
cons: func [
	[catch] car cdr [series!]
][
	either empty? cdr [
		either all [series? car empty? car] [
			[]
		][
			reduce [car]
		]
	][
		head insert tail reduce [car] cdr
	]
]
JaimeVargas:
16-Nov-2005
>> cons [a b c] [d e]
This is a list of test from lisp.

> (cons 'a '())
(list 'a)
> (cons '() '())
(list empty)
> (cons '() 'a)
cons: second argument must be of type <list>, given empty and 'a
> (cons '(a b c) 'a)

cons: second argument must be of type <list>, given (list 'a 'b 'c) 
and 'a
> (cons '(a b c) '(d e))
(list (list 'a 'b 'c) 'd 'e)
Volker:
16-Nov-2005
for me a lisp-node has always two values, there is no empty one. 
So i use always a block of length 2.
Volker:
16-Nov-2005
btw here is a rebol-version of subst:
Volker:
16-Nov-2005
l: first[ ((b c) (b () d)) ]
subst: func[l old new][
 forall l[
  either any-block? l/1 [
   subst l/1 old new
  ][
   if old == l/1 [ l/1: new ]
  ]
 ]
 l
]
probe l
probe subst l 'b 'a
Volker:
16-Nov-2005
Hmm, no, there are atoms and lists. So i have to dig a bit deeper. 
then cons is really a 'reduce. but lisp has no lists with multiple 
elements, thats mold-sugar. WHile we have in rebol and your cons 
can deal with that.
Volker:
16-Nov-2005
But isnt that what insert/only does? putting a new value in front 
of a series? To match exactly it would be into a copy of the series, 
but i guess that does not matter.
Volker:
16-Nov-2005
cons: func[left rest][
 head insert/only copy rest left
]
subst: func[new old slist /local left rest][
 if tail? slist[return head slist]
 (cons 
  subst-in-symbol-expression new old first slist
  subst new old copy next slist
 )
]
subst-in-symbol-expression: func[new old se][
 if not any-block? se[
  if equal? se old [ return new ]
  return se
 ]
 subst new old se  
]
print "10 9 8 7 6 5 4 3 2 1 0 ??"
probe l: first[ ((b c) (b () d)) ]
probe subst 'a 'b l
Volker:
16-Nov-2005
(and it must be a copy, on several places)
Volker:
16-Nov-2005
cons: func[left rest][
 if all[ [] = left [] = rest ][ return copy [] ]
 head insert/only copy rest left
]
car: :first
null?: :tail?
cdr: func[series][ copy next series ]
subst: func[new old slist /local left rest][
 if null? slist[return make slist 0] ; same series-type please
 (cons 
  subst-in-symbol-expression new old car slist
  subst new old cdr slist
 )
]
subst-in-symbol-expression: func[new old se][
 if not any-block? se[
  if equal? se old [ return new ]
  return se
 ]
 subst new old se  
]
print "10 9 8 7 6 5 4 3 2 1 0 ??"
probe l: first[ ((b c) (b () d)) ]
probe subst 'a 'b l
Volker:
16-Nov-2005
Maybe a set of lisp-porting-tools? In rebol itself i use more iteration 
and insert/append. No need for cons. In lisp its recursion and list-building, 
there it is helpfull.
JaimeVargas:
16-Nov-2005
I am started to read the 'EoPL' book this week. It has been an eye 
opener. Both books a very easy to follo the HTDP book is completely 
online.
Volker:
16-Nov-2005
I start a bit with the online-version.
Maarten:
17-Nov-2005
I got it, it is a hard book. I haven't gotten the time to get through 
it with my job and kids, but what I have done was well worth it. 
EopL and the "book with the dragons" by Aho et al about complier 
design are books that change your view on programming.
Graham:
17-Nov-2005
ahh ... so it was a pun
Pekr:
23-Nov-2005
how can I get some deeper context words? :-) I just wanted to check, 
if request-date finally uses system structure month/day names, so 
I sourced it:

request-date: func ["Requests a date." /offset xy][
    result: none
    if none? base [init]
    either offset [inform/offset date-lay xy] [inform date-lay]
    result
]
DideC:
23-Nov-2005
do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=request-date
.r
DideC:
23-Nov-2005
Or have a look to the req-funcs object (with anamonitor ).
Anton:
24-Nov-2005
Above I have bound your whole block of code to the existing 'date-lay 
word.

It could be better (a more reliable way in other situations) to bind 
just the 'date-lay word in your new code
(ie. only the words which need binding):

 insert second :request-date compose [probe (bind 'date-lay pick pick 
 second :request-date 10 2)]
Graham:
25-Nov-2005
Should 'forskip not take a block ?  As it is, it only takes a word.
Henrik:
25-Nov-2005
same with forall. a tad annoying, me thinks
Geomol:
26-Nov-2005
If it took a block, how would you make a reference to where you are 
in the block?
Graham:
27-Nov-2005
if you wish to parse a literal which changes ... how would you do 
that?

parse phrase [  'literal ]

can't be done this way

parse phrase compose [ '(literal) ]
eFishAnt:
27-Nov-2005
Anton...I was afraid that would be the answer...course, maybe it 
works anyway...where a function! is used in the place of an action! 
(however, I dread there might be some side-effect if action! needs 
a context, and that context it needs is not provided by the function! 
substitute.
eFishAnt:
27-Nov-2005
I will let you know if I reach a pitfall with my approach (so far, 
so good...;-)
Graham:
27-Nov-2005
Volker, the parse rule occurs in a BEER callback .. and I need to 
change the parse rule depending upon which BEER function I am calling. 
 Of course, there are always workrounds one can set up, but was wondering 
if there was some way to relax the REBOL interpreter when building 
up dynamic code like this.
Graham:
27-Nov-2005
Seems the 'case statement is not in the encap from July last year 
and it's a native.
Anyone have source for a mezzanine case statement ?
Ryan:
27-Nov-2005
Great! A case statement! I have been waiting for that!
Ladislav:
28-Nov-2005
if you rename PIF to CASE (in the PIF source too), you hardly can 
find a difference
Henrik:
28-Nov-2005
is there a way to use a function with a refinement as a word?
Henrik:
28-Nov-2005
do-a-function either condition ['ref][none] <arguments>

as opposed to the clumsier:


either condition [do-a-function/ref <arguments>][do-a-function <arguments>]
Volker:
28-Nov-2005
No good ways. You can build a path and do that.
Volker:
28-Nov-2005
f: func[/a va /b vb /opts blk][
 if opts[do bind blk 'opts] 
 ?? a ?? b
]
f/opts [a: 5]
Henrik:
28-Nov-2005
hmm... a bit confused about the BIND part...
Volker:
28-Nov-2005
ref-a: none
val-a: "A"
ref-b: true
val-b: "B"

f/opts [a: ref-a if ref-a[va: val-a]  b: ref-b if ref-b[vb: val-b]]
Volker:
28-Nov-2005
but then it needs a composeto avoid name-clashes. maybe not the best 
idea.
Geomol:
28-Nov-2005
You can do this:

do to-path reduce ['do-a-function either condition ['ref][none]] 
<argument>
but if it's less clumpsy, you deside!
BrianH:
29-Nov-2005
; Try this way, no reduce or to-path...

do either condition ['do-a-function/ref] [:do-a-function] <argument>
BrianH:
29-Nov-2005
; Or this
do pick [do-a-function/ref do-a-function] condition <argument>
Henrik:
29-Nov-2005
a comment on ATTEMPT. I think it's a wonderful function, but don't 
overuse it because it can make your code hard to debug when nothing 
happens where there should be an error.
Graham:
30-Nov-2005
Is there a way to set and read windows environmental variables ?
Anton:
2-Dec-2005
You mean, you set a new user env variable, and rebol wasn't able 
to pick it up straight away ?
RobertDumond:
2-Dec-2005
i'm running into a strange issue with the prerebolizer... it is taking 
a part of one line from my main rebol file and then a few blocks 
of another rebol file and overwriting another seemingly random rebol 
file with this data... has anyone run into this problem or have any 
idea what could be causing the problem?  i am using Preprossor 2.0.0
Gregg:
5-Dec-2005
I haven't seen that Robert. Can you narrow it down to a very small 
example?
Volker:
7-Dec-2005
AFAIK not. 'protect is for debugging AFAIK.

But i can work secure if you use 'secure. The way is, as long as 
i dont touch user-data, i am secure. Thats why rebol has get-reg 
on startup, no user-code loaded, no harm possible. Before i touch 
user-code (or data), i tighten security as much as possible. unset 
dangerous words (if i am paranoid i disable "make struct!". I use 
secure to restrict file-access only where needed, disable shell and 
library, maybe network-access. A script/bug can not undo this things, 
and IMHO that is quite secure.
Volker:
7-Dec-2005
Henrik, copy/deep does not copy functions. and you have a function 
here, try mold/all instead of probe.
Volker:
7-Dec-2005
i misunderstood, you can ignore that. mold molds functions like their 
sourcecode. mold/all molds functions specially, so that you see what 
a function and what only source is. Thought that would give a hint 
to the problem.
Henrik:
7-Dec-2005
I'm actually looking for a way to get input data as a block:

[a: 1 b: 2 c: 3]

made into an object which is:

make object! [a: b: none c: does [something to make the c value]]

so I would get an object like this:

make object! [a: 1 b: 2 c: <return value from object function>]
Gabriele:
8-Dec-2005
yes, but that is another level of security, where you trust some 
modules of a script but not others. i guess that will come with REBOL 
3
Pekr:
8-Dec-2005
Interesting question on ml:

join 'a 'b
== "ab"

type? join 'a 'b
== string!

Is that correct? Should not be a word instead?
Gordon:
8-Dec-2005
How do you include a space in a directory name for Request-file/file?
Louis:
8-Dec-2005
What is the correct code for ftp to a site when the user id is [john-:-smith]?
Davide:
9-Dec-2005
Hi all, I'm trying to read from a newsserver, what's wrong ?

>> p: open/lines tcp://news.aioe.org:119
>> first p

== {200 aioe.org InterNetNews NNRP server INN 2.4.3 (20050923 snapshot) 
ready (posting ok).}
>> insert p "LIST"
>> first p
** Script Error: Out of range or past end
** Near: first p
Davide:
9-Dec-2005
I remember that insert func is syncronous when used in a port opened 
without no-wait refinement. Time to read again the core manual :-) 
. Thanks anyway
Graham:
11-Dec-2005
Has anyone done anything in the way of a reporting dialect ( that 
gets converted to sql and executed ) ?
Rebolek:
12-Dec-2005
Because I'm writing scripts on more than one computer I need to sync 
files somehow. I can use flashdisk for synchronization, but USB is 
not always available or I forget my flashdisk at home, so it's not 
always the right option.

Or I can use ftp to upload and download files. But at the end I've 
got lots of different directories with different versions, because 
I have no intelligent file structure.

I was inspired by Google filesystems for win and lin so I decided 
to use some freemail (gmail preferably) for my scripts maintaing. 
Unfortunatly, Gmail needs some authentication, SSL or what and SSL 
under Rebol needs Command and Command needs 350$ to buy.

So I found another freemail provider that offers both non-authenticated 
SMPT and POP and therefore is OK for REBOL (btw. remeber the old 
REBOL example? send [luke-:-rebol-:-com] read http://www.rebol.com? Hard 
to do with all the authetications required today.) and I started 
coding.

The result is a small application called %rspace.r that can upload 
file to repository, download newest version from repository, or you 
can get list of all files in repository and finally, if you're happy 
with your script, you can publish it on www/ftp. All this with documentation 
in less than 6kB.

All you need is REBOL and mail account cappable of SMTP/POP without 
authentication. It's good to have an FTP account for publishing files 
but that's not required. If you do not have an mail account, I've 
set up one on seznam.cz, user 'rebolspace' and pass 'spacerebol' 
for testing this application (it's built in, so you can start testing 
right after download).

Remember, it's just alpha, does not have many features, but it works, 
I can write something here, update it there and have all the versions 
accesible from everywhere. It's written for REBOL scripts so with 
big projects it's going to be very slow and unusable, but for small 
project (and most REBOL scripts are really small) it's probably good.

So download it form http://krutek.info/rebol/rspace.r(stable) or 
http://rebolspace.sweb.cz/rspace.r(latest published version). 

WARNING: because [rebolspace-:-seznam-:-cz] is open account it won't be 
wise to use it ordinarily. Please, if you like it, set up your own 
account and use it instead of built-in one.
And remember: all suggestions and fixes are welcome.
MichaelB:
12-Dec-2005
find-deep: func [b [block!] o [any-type!]][
	forall b [

  either block? b/1 [return find-deep b/1 o][if b/1 = o [return b]]
	]
	none
]
z: find-deep [a b [c d [e] f]] 'e
probe z


Has somebody an idea why this is not working ? Find-deep is always 
return none, even though it finds the e in the inner block. Upon 
debugging the 'e is found and the inner block returned, but then 
one level up in the recursion only a none reaches the 'return after 
the find-deep invocation. Maybe I'm missing something very simple 
?
Volker:
12-Dec-2005
Could forall have a bug with return? IIRC some versions had one. 
then the 'forall traps the return.
MichaelB:
12-Dec-2005
this might be, as I really was trying to find a mistake, but it didn't 
make sense
Volker:
12-Dec-2005
forall: func [
    "Evaluates a block for every value in a series." 
    [catch throw] 

    'word [word!] {Word set to each position in series and changed as 
    a result} 
    body [block!] "Block to evaluate each time"
][
    throw-on-error [forskip :word 1 body]
]
MichaelB:
12-Dec-2005
you're right the versions differ pretty much when doing a 'source 
on 'forall
Henrik:
12-Dec-2005
1.3.61 and 2.6.50 is somewhat older than 1.3.2. I think there are 
quite a lot of bugfixes in 1.3.2...
MichaelB:
12-Dec-2005
Yes, I'm right now just a little bit confused with the numbers anyway. 
I have to sets of icons, alphas and official and used the alphas 
for testing funcs and the like and thought they're at least as new/fixed 
as the official releases, but maybe my alpha isn't completely up-to-date 
either.
Volker:
12-Dec-2005
currently 1.3.2 is the newest version. but because no rebcode it 
gets a 0.0.-59 added.
Anton:
13-Dec-2005
Yes, FORALL was modified very recently, and the return was a bug.
MichaelB:
13-Dec-2005
can somebody give me a quick rule, why the pick-path notation evaluates 
it's picked value and pick does not (and first...) (as it should 
be a shorthand for pick)
as in:
bl: [] 
append bl func [a][print a]
bl/1 "hello" ;evaluates the function
pick bl 1 "hello" 
first bl "hello"  ; both do not

I have to do an extra 'do - I'm just curious for a reason ?!
Geomol:
13-Dec-2005
The explanation might be, that it should be possible to get the function 
without evaluating it. You can do that with PICK or FIRST:
f: pick bl 1
f: first bl

Now if bl/1 worked the same way, you always had to add DO to get 
it evaluated. So my guess is, Carl desided, that wouldn't be too 
smart, and I agree. It's the same with objects. To call a method 
(a function) within an object, you just write:
o/some-func

No DO is needed in front of that. So using path notation to get to 
a function within a block or an object will evaluate the function.
MichaelB:
14-Dec-2005
Thanks for the answers. Maybe this should be noted somewhere especially 
- when I was searching for it, the only thing I found is in the documentation 
in the examples for unnamed functions. There only the path notation 
was used to extract and evaluate the functions immediately.

I agree that this evaluation is good to have and on purpose, just 
a bit too hidden for my taste (one again has to have quite some undestanding 
how Rebol works to have a resonable model for these things or a big 
memory) - as some other things in Rebol.
MichaelB:
14-Dec-2005
I actually really think, that one of the problems Rebol has, especially 
for beginners and people from other languages, is that it's hard 
to have a small model in the head of how things work  and why, so 
that out of a small amount of knowledge most stuff can be infered, 
at least sometimes it's not too consistent. (I know belongs a bit 
into the steep vs. shallow vs. deep learning curve topic)
Geomol:
14-Dec-2005
Research suggest, that intelligence and memory are mutual exclusive. 
If you remember too much, it'll have a bad influence on your intelligence. 
On the other way, the ability to forget information will mean higher 
IQ. This is in agreement with, how Claude Shannon defined informatin 
in 1948 at Bell laboratories.

The trick is to remember only the absolutely crucial information 
and forget the rest. ;-)
MichaelB:
14-Dec-2005
Was it always like that, that make object! 'block didn't copy the 
block before and that one get's the real block used for creation 
also via third 'object ? I was a little bit surprised to be able 
to change the binding of the words in an object after creation - 
I thought this is not possible with objects - now if we only could 
extend objects ...
MichaelB:
14-Dec-2005
no, without creating a new one, just like append third 'object [x: 
'new-value]
MichaelB:
14-Dec-2005
yes I'm pretty surprised :-) (of course in a positive way)
MichaelB:
15-Dec-2005
this is from the blog-chat: 

I liked Ladislavs function and just extended it a little bit: maybe 
bind would be nice like that - one can bind only the words one wants 
to and also only the types one likes, unless using plain, then all 
words of the same spelling get bound

old-bind: :bind

bind: func append copy third :bind [
	/only only-words [block! any-word!]
    /plain
    /local pos rule item
][
	if copy [words: copy words]
		
	either only [
		if any-word? only-words [only-words: reduce [only-words]]
    	if any-word? known-word [known-word: bind? known-word]

     if plain [forall only-words [change only-words to word! only-words/1]]

		parse words rule: [
			any [
				pos:
				set item any-word! (
					if any [
                	    all [plain find only-words to word! item]
                	    find only-words item
                	][
						item: old-bind :item known-word
						change pos :item
					]
				) | into rule | skip
			]
		]	
	][
		old-bind words known-word
	]	
]

f: g: h: i: 1
bl: ['f g h i]
c: context [f: 2 g: 3 h: 'hello]

bind/only bl c [f 'h]
get-values: [
	get to-word first bl
	get to-word second bl
	get to-word third bl
	get to-word fourth bl
]
probe reduce get-values

bind/only/plain bl c [f 'h]
probe reduce get-values

bind bl 'system
probe reduce get-values

bind/only bl c 'g
probe reduce get-values
MichaelB:
15-Dec-2005
sorry - layout got a little bit destroyed :-(
MichaelB:
15-Dec-2005
I hope a more correct version of only 'bind-only - just to have not 
something too wrong lurcking around

bind-only: func [

    {Binds only selected words to a context. If taken 'lit'erally even 
    just words of the same kind.} 
    words [block!]
    known-word [any-word! object! port!]
    only-words [block! any-word!]
    /lit
    /local pos rule item
][
    if any-word? only-words [only-words: reduce [only-words]]
    if any-word? known-word [known-word: bind? known-word]
    unless lit [
        only-words: copy only-words 

        forall only-words [change only-words to word! only-words/1]
    ]
	
      parse words rule: [
		any [
			pos:
			set item any-word! (
				if any [
                    				find only-words to word! :item
                    				all [lit find only-words :item]
                			][
					item: bind :item known-word
					change pos :item
				]
			) | into rule | skip
		]
	]
    words
]
BrianH:
16-Dec-2005
I have a simple question (I hope): What types does the hash! type 
hash? I recall it hashing strings, but does it hash words and other 
types as well? I'm wondering for what key types it would be useful 
to use a hash! to store the records. If the key type isn't hashed, 
there is no benefit over using blocks.
Volker:
16-Dec-2005
IIRC it hashes a lot now. And a benchmark is easy, fill a big block, 
search, if it is linear its hashed.
Louis:
17-Dec-2005
Is there a special symbol in the REBOL language for the Indonesian 
rupiah? I need to make a script to convert funds from US$ to Indonesian 
Rupiah.
Geomol:
17-Dec-2005
Take a look:
for i 32 255 1 [prin to-char i]
Louis:
17-Dec-2005
Geomol, thanks. The rupiah symbol isn't there, but there is a symbol 
that will make a decent substitute.
Terry:
27-Dec-2005
Is there a Rebol webserver that can handle POST data, that actually 
works?
Terry:
27-Dec-2005
Look.. here's  what I'm trying to build with Rebol   http://www.uniformserver.com/
 

a fully powered webserver you can take with you on a USB Stick or 
even your camera's flash drive.
Terry:
27-Dec-2005
exactly.. like I've got nothihg better to do than build a webserver 
in Rebol that can handle POST data.l..
Ladislav:
27-Dec-2005
 like I've got nothihg better to do than build a webserver in Rebol 
 that can handle POST data

 - I have seen nothing capable of convincing anybody such a webserver 
 was distributed as a mezzanine?
Ladislav:
27-Dec-2005
it is directly meant as a comment to "monkey wrenching REBOL"
Ladislav:
27-Dec-2005
only one - make a value you don't want to be changed immutable. The 
problem is, that REBOL does not have immutable strings, blocks, functions 
or objects.
27301 / 6460812345...272273[274] 275276...643644645646647