Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Selective nesting
Let's say I have the following vector of nested strings in APL+WIN

x{<-}'aaa' 'bbb' 'ccc' 'ccc' 'ddd'

I want to nest those that are the same eg.

.…---------------------.
|.…-..…-..…-------..…-.|
||aa||bb||.…-..…-.||dd||
|'--''--'||cc||cc||'--'|
|        |'--''--'|    |
|        '¹-------'    |
'¹---------------------'

One option is to use dyadic enclose to nest all of them

(x{iota}x){enclose}x

.…---------------------------.
|.…---..…---..…-------..…---.|
||.…-.||.…-.||.…-..…-.||.…-.||
|||aa||||bb||||cc||cc||||dd|||
||'--'||'--'||'--''--'||'--'||
|'¹---''¹---''¹-------''¹---'|
'¹---------------------------'

And then selectively disclose the ones with shape of one, but that's
got me stumped too!  Any pointers?

Thanks.

Report this thread to moderator Post Follow-up to this message
Old Post
Ric
11-25-04 08:55 PM


Re: Selective nesting
Given:

z<- (x iota x)enclose x

> And then selectively disclose the ones with shape of one, but that's
> got me stumped too!  Any pointers?

Sorry... no APL2ASCII because I am too lazy :-)

Anyway:
y<-1=enlist rho each z
(y/z)<-first each y/z

Careful if y doesn't even contain a 1 or if x is empty... Fill elements will
play tricks on you...
--
WildHeart'2k4



Report this thread to moderator Post Follow-up to this message
Old Post
Stefano Lanzavecchia
11-25-04 08:55 PM


Re: Selective nesting
Ric,

Not very elegant but you could simply replace rather than disclose the
unique elements after nesting them all

y <- (x{iota}x){enclose}x
then
xi <- x{iota}x
yi <- +\xi={iota}{rho}x
xi <- ((xi{not equal}1{rotate}xi){and}xi{not equal}¯1{rotate}xi)/xi
yi <- ((yi{not equal}1{rotate}yi){and}yi{not equal}¯1{rotate}yi)/yi
y[yi] <- x[xi]

"Ric" <r.g.sherlock@massey.ac.nz> wrote in message
news:9355bc02.0411250540.472471ce@posting.google.com...
> Let's say I have the following vector of nested strings in APL+WIN
>
> x{<-}'aaa' 'bbb' 'ccc' 'ccc' 'ddd'
>
> I want to nest those that are the same eg.
>
> ..---------------------.
> |..-...-...-------...-.|
> ||aa||bb||..-...-.||dd||
> |'--''--'||cc||cc||'--'|
> |        |'--''--'|    |
> |        '¹-------'    |
> '¹---------------------'
>
> One option is to use dyadic enclose to nest all of them
>
>     (x{iota}x){enclose}x
>
> ..---------------------------.
> |..---...---...-------...---.|
> ||..-.||..-.||..-...-.||..-.||
> |||aa||||bb||||cc||cc||||dd|||
> ||'--'||'--'||'--''--'||'--'||
> |'¹---''¹---''¹-------''¹---'|
> '¹---------------------------'
>
> And then selectively disclose the ones with shape of one, but that's
> got me stumped too!  Any pointers?
>
> Thanks.



Report this thread to moderator Post Follow-up to this message
Old Post
Graham Steer
11-25-04 08:55 PM


Re: Selective nesting
"Stefano Lanzavecchia" <wildstf@hotmail.com> wrote in message news:<30mdltF32o1heU1@uni-ber
lin.de>...
> Anyway:
> y<-1=enlist rho each z
> (y/z)<-first each y/z
>
> Careful if y doesn't even contain a 1 or if x is empty... Fill elements wi
ll
> play tricks on you...

Thanks Stefano,
seems pretty stable to empty x.  My solution that I was using was as
follows:
foo{each}z
where foo was a function that tested for 1={rho} and did a disclose if
that was the case.  Don't think it is as stable to empty x and is abit
ugly.
Ric

Report this thread to moderator Post Follow-up to this message
Old Post
Ric
11-26-04 01:55 AM


Re: Selective nesting
Ric,

Not very elegant but you could simply replace rather than disclose the
unique elements after nesting them all

y <- (x{iota}x){enclose}x
then
xi <- x{iota}x
yi <- +\xi={iota}{rho}x
xi <- ((xi{not equal}1{rotate}xi){and}xi{not equal}¯1{rotate}xi)/xi
yi <- ((yi{not equal}1{rotate}yi){and}yi{not equal}¯1{rotate}yi)/yi
y[yi] <- x[xi]

"Ric" <r.g.sherlock@massey.ac.nz> wrote in message
news:9355bc02.0411250540.472471ce@posting.google.com...
> Let's say I have the following vector of nested strings in APL+WIN
>
> x{<-}'aaa' 'bbb' 'ccc' 'ccc' 'ddd'
>
> I want to nest those that are the same eg.
>
> ..---------------------.
> |..-...-...-------...-.|
> ||aa||bb||..-...-.||dd||
> |'--''--'||cc||cc||'--'|
> |        |'--''--'|    |
> |        '¹-------'    |
> '¹---------------------'
>
> One option is to use dyadic enclose to nest all of them
>
>     (x{iota}x){enclose}x
>
> ..---------------------------.
> |..---...---...-------...---.|
> ||..-.||..-.||..-...-.||..-.||
> |||aa||||bb||||cc||cc||||dd|||
> ||'--'||'--'||'--''--'||'--'||
> |'¹---''¹---''¹-------''¹---'|
> '¹---------------------------'
>
> And then selectively disclose the ones with shape of one, but that's
> got me stumped too!  Any pointers?
>
> Thanks.



Report this thread to moderator Post Follow-up to this message
Old Post
Graham Steer
11-29-04 08:58 PM


Re: Selective nesting
"Stefano Lanzavecchia" <wildstf@hotmail.com> wrote in message news:<30mdltF32o1heU1@uni-ber
lin.de>...
> Anyway:
> y<-1=enlist rho each z
> (y/z)<-first each y/z
>
> Careful if y doesn't even contain a 1 or if x is empty... Fill elements wi
ll
> play tricks on you...

Thanks Stefano,
seems pretty stable to empty x.  My solution that I was using was as
follows:
foo{each}z
where foo was a function that tested for 1={rho} and did a disclose if
that was the case.  Don't think it is as stable to empty x and is abit
ugly.
Ric

Report this thread to moderator Post Follow-up to this message
Old Post
Ric
11-29-04 08:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

APL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:49 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.