Using ScriptFollows from another NameSpace

Using Microsoft Windows Presentation Foundation and Syncfusion WPF Libraries

Using ScriptFollows from another NameSpace

Postby PGilbert on Tue Jun 16, 2015 11:15 pm

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
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Using ScriptFollows from another NameSpace

Postby MBaas on Fri Jun 19, 2015 8:58 am

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 ⍺.
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany


Return to WPF & Syncfusion

Who is online

Users browsing this forum: No registered users and 1 guest