Hi Elan,

it's fine, that you tried too. Here are my two tests (Larry asked me to post
them both someplace):

; Error test:
arg1: func [x] [return make error! x]
arg2: ["some error"]
probe disarm arg1 first arg2

 The result is:

 make object! [
     code: 800
     type: 'user
     id: 'message
     arg1: "some error"
     arg2: none
     arg3: none
     near: [return make error! x]
     where: none
]

; Return test:
arg1: func [[throw] x] [return x]
arg2: [1]
test1: does [arg1 first arg2 2]
test1 ; == 1
test2: does [hard :arg1 arg2 2]
test2 ; == 2

Due to the "second class nature" of Rebol errors, HARD cannot pass both
tests IMO. (You can have a look at: http://www.sweb.cz/LMecir/rep.html)

> Hi Ladislav,
>
> looks like fun.
>
> What if we upgrade Larry's function as follows?
>
hard: func [x y][
  if error? set/any 'error try [
    do reduce [x first y]
  ][
    return :error
  ]
 ]
>
>
> That solves the problem at hand. I'm curious where this will take us?
>
> Take Care,
>
> Elan
>
> Ladislav Mecir wrote:
> >
> > Correcting myself:
> >
> > > to be a solution, HARD must pass any test. Let's try:
> > >
> >
> > > while the result of HARD is:
> > >
> >
> > probe disarm hard :arg1 arg2
> > ** User Error: some error
> > ** Near: return make error! x
> >
> > > The question is, if HARD could really meet the requirements.
> > >
> > > > Hi Ladislav
> > > >
> > > > Sounds like fun!  Will this solve the puzzle?
> > > >
> > > > >> hard: func [x y][do reduce [x first y]]
> > > > >> hard :sine [52]
> > > > == 0.788010753606722
> > > > >> hard func [x][x * x] [52]
> > > > == 2704
> > > > >>
> > > >
> > > > Cheers
> > > > -Larry
> > > >
> > > > ----- Original Message -----
> > > > From: Ladislav Mecir <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Saturday, February 03, 2001 11:03 AM
> > > > Subject: [REBOL] A hard question
> > > >
> > > >
> > > > > The task is to create a function HARD, that is a Normal Argument
> > Passing
> > > > > function (i.e. nor a Fetched Argument Function, neither an
Unevaluated
> > > > > Argument Function) and takes two arguments, ARG1 and ARG2. HARD is
not
> > > > > required to do any argument checking, moreover, you can assume,
that
> > the
> > > > > supplied arguments are really the data they are supposed to be.
> > > > >
> > > > > ARG1 is a Normal Argument Passing Function taking exactly one
> > argument.
> > > > >
> > > > > ARG2 is a block of length 1.
> > > > >
> > > > > The function HARD shall do exactly the same thing, as the function
> > ARG1
> > > > > would do if used with the first element of ARG2 as its argument.
> > > > >
> > > > > Moreover, you can assume, that the first element of ARG2 is a
correct
> > > > > argument to ARG1.
> > > > >
> > > > > Any trials?
> > > > >
> > > > > Regards
> > > > >      Ladislav
> >
> > --
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the
> > subject, without the quotes.
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to