Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

printing a path and its value

 [1/3] from: princepawn::lycos::com at: 8-Sep-2000 6:40


I want to print a path (ie, what the path is) and then the value of that path... how can I do so? diag: func [path-block [block!]] [ foreach p path-block [ prin p print " " print reduce p ] ] diag [ system/schemes/ftp/passive system/schemes/ftp/proxy/host system/schemes/ftp/proxy/port-id system/schemes/ftp/proxy/type ]

 [2/3] from: al:bri:xtra at: 9-Sep-2000 15:42


> I want to print a path (ie, what the path is) and then the value of that
path... how can I do so?
>> Example: [
[ system [ [ schemes [ [ ftp [ [ passive "Passive ftp" [ proxy [ [ host "proxy host" [ port-id "proxy port-id" [ type "proxy type" [ ] [ ] [ ] [ ] [ ] == [ system [ schemes [ ftp [ passive "Passive ftp" proxy [ ...
>> Paths: [
[ Example/system/schemes/ftp/passive [ ] == [ Example/system/schemes/ftp/passive ]
>> foreach Path Paths [print [:Path ":::" Path]]
Example/system/schemes/ftp/passive ::: Passive ftp I hope that helps! Andrew Martin On the path to recovery... ICQ: 26227169 http://members.xoom.com/AndrewMartin/

 [3/3] from: jkinraid:clear at: 9-Sep-2000 15:49


Hi,
> I want to print a path (ie, what the path is) and then the value of that path... how can I do so? > diag: func [path-block [block!]] [
<<quoted lines omitted: 9>>
> system/schemes/ftp/proxy/type > ]
You were close, but you were one step of evaluation ahead... 'prin p' needs to be changed to 'prin :p', because 'prin p' will evaluate the path, whereas 'prin :p' won't evaluate 'p, so the path is printed, not what the path points to. This also means that you don't need to use reduce, because an implicit reduction is done with 'print p'. This is the result: diag: func [path-block [block!]] [ foreach p path-block [ prin :p print " " print p ] ] If you want the output on one line, you can just do this: diag: func [path-block [block!]] [ foreach p path-block [ print [:p p] ] ] Hopefully I haven't confused you too much, my brain is very foggy right now :) Julian Kinraid

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted