Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » How to get the length of a list?
How to get the length of a list? [message #1784443] Wed, 28 March 2018 05:58 Go to next message
Stephan Stahlmann is currently offline Stephan StahlmannFriend
Messages: 2
Registered: March 2018
Junior Member
I have a small problem regarding getting the length of a list in RCPTT.

I have written a function which gets a list as a parameter. If I want to get th length of the list it returns 1, no matter how long the list actually is.

Example:
proc "my-func" [val list] {
show-alert [$list | length]
}
my-func [list "0" "1" "2" "3" "4" "5"] // returns 1
my-func [list "0" "1" "2" "3" "4"] // returns 1
my-func [list "0" "1" "2"] // returns 1

When i debugged, I found that $list is an EclList, which wraps java.util.List. so I thought I could get it via:

$list | get-object | invoke elements | invoke size

But it fails at "| get-object". So the question is, is there any way to get the length of list?
Re: How to get the length of a list? [message #1791317 is a reply to message #1784443] Thu, 28 June 2018 06:23 Go to previous message
Viktoria Dlugopolskaya is currently offline Viktoria DlugopolskayaFriend
Messages: 124
Registered: March 2017
Senior Member
Hi Stephan,

You have to correct your code to the following:
$list | invoke getElements | invoke size

'length' command counts objects from input pipe:
emit "0" "1" "2" "3" "4" "5" | length | eq 6 | assert-true
Documentation: https://hudson.eclipse.org/rcptt/job/rcptt-all/ws/releng/doc/target/doc/ecl/index.html#length
Previous Topic:Symbol 'std' could not be resolved
Next Topic:Load all projects from a folder.
Goto Forum:
  


Current Time: Tue Apr 23 12:01:59 GMT 2024

Powered by FUDForum. Page generated in 0.03228 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top