Hello [EMAIL PROTECTED]!

On 11-Set-00, you wrote:

 c>> Try compiling this:
 c>> 
 c>> do ask "Please enter some Rebol code: "

 c> FORTH and Lisp systems don't seem to have a problem with this.
 c> Most Common Lisp systems I know are compiled and have
 c> interactive input. See Corman Lisp for an example
 c> (http://www.corman.net). Generally the compiler is part of the
 c> run time and compiles the entered code on the fly.

So you want all of your script be compiled in a 400k executable?

Anyway, that is not the problem. Let me know if you are able to
compile the following code snippets:

  my-print: print-odd: func [a] [
    print [a "is odd."]
    my-print: :print-even
  ]
  print-even: func [a] [
    print [a "is even."]
    my-print: :print-odd
  ]
  repeat i 5 [my-print i]

1 is odd.
2 is even.
3 is odd.
4 is even.
5 is odd.

---

  ; this is just an example...
  amiga: make object! [
    send-to-par: func [something] [write/binary %/par something]
    play-sound: func [sample-data] [write/binary %/audio sample-data]
  ]
  unix: make object! [
    send-to-par: func [something] [write/binary %/dev/lp0 something]
    play-sound: func [sample-data] [write/binary %/dev/dsp sample-data]
  ]
  others: make object! [
    send-to-par: func [val] []
    play-sound: func [val] []
  ]

  code: [
    send-to-par some-data-for-the-printer
    play-sound hello-sample
    play-sound goodbye-sample
  ]

  current-system: get pick [
    ; going by memory, the actual table might be different...
    amiga
    others
    others
    unix
    ; etc.
  ] system/version/4

  bind code in current-system 'self
  do code

---

  ; self modifying code
  code: [
    ; initialization, needs to be run the first time only
    random/seed now
    remove/part code 5
    print random 10
  ]
  print mold code
  loop 5 code
  print mold code

>> print mold code
[
    random/seed now 
    remove/part code 5 
    print random 10
]
>> loop 5 code
5
6
6
3
7
>> print mold code
[
    print random 10
]

Regards,
    Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Reply via email to