Using ScriptFollows from another NameSpace

Using Microsoft Windows Presentation Foundation and Syncfusion WPF Libraries
Post Reply
User avatar
PGilbert
Posts: 440
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Using ScriptFollows from another NameSpace

Post by PGilbert »

I am starting to like more and more the function 'ScriptFollows' found in the MiServer workspace (thanks Brian) to insert XAML into a function. So I decided to put it with the other utility functions in the UTILITY namespace and call it from there when ever it was needed... and it stop working. Looks like the culprit is ⎕SI that needed to be changed to ⎕XSI and everything is working fine again. I though I would share this information in case others run into the same issue.

Code: Select all

 r←ScriptFollows;dtlb
⍝ treat following commented lines in caller as a script, lines beginning with ⍝⍝ are stripped out
 dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵}
 r←{∊{'⍝'=⊃⍵:'' ⋄ ' ',dtlb ⍵}¨1↓¨⍵/⍨∧\'⍝'=⊃¨⍵}dtlb¨(1+2⊃⎕LC)↓⎕NR 2⊃⎕XSI

The function is using (⎕IO ⎕ML)←0 3

Anyone using something similar to input matrix of characters in a function that would like to share is welcome.
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Using ScriptFollows from another NameSpace

Post by MBaas »

Yes, that function is a great idea and enables nice notation :-)

I also had a go at it and ended up with more lines that you:
      fn←ExtractTheFollowingComments
fn←(1⊃⎕RSI).⎕NR 2⊃⎕SI ⍝ repr. of calling fn
fn←(1+⎕LC[2])↓fn
fn←1↓¨(∧\{z←∧\⍵∊' ⍝' ⋄ '⍝'∊z/⍵}¨fn)/fn
fn←#.HTMLUtils.enlist fn,¨⎕UCS 13


I'm adding linebreaks there because I always use it to generate JS etc., but for an even more generalized version we might supply that "line-separator" as ⍺ and return a matrix if there is no ⍺.
Post Reply