• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Splitting a large list

Stats

  • Replies 3
  • Subscribers 159
  • Views 12693
  • Members are here 0
More Content

Splitting a large list

vramanax
vramanax over 10 years ago

Hi

Basically I am looking for a way to split a large list into smaller chunks

lets say into minimum chunk size of 100s

I am working on a function myself but I thought I will save some time if any of you can help me to solve it

Regards

Venkata

  • Sign in to reply
  • Cancel
Parents
  • vramanax
    vramanax over 10 years ago

    Hi thanks Here is a solution I came up with

    assume a list of objects is more than 100

    then you use the following call

    __bReakList(llist)

    I have 2 procedures

    procedure( __bReakList(_lIst)
    prog((i __rEturnList __ChunkSize __RemainderChunk _tList)
    i=0
    __ChunkSize = length(_lIst)/100
    __RemainderChunk = mod(length(_lIst) 100)
    __rEturnList = list()
    while(i < (length(_lIst) - __RemainderChunk)-1
    __rEturnList = cons(__sPlitList(_lIst i i+99) __rEturnList)
    i = i + 100
    )
    _tList = list()
    for(i length(_lIst) - __RemainderChunk length(_lIst)-1
    _tList = cons(nth(i _lIst) _tList)
    )

    __rEturnList = cons(_tList __rEturnList)
    i = 0
    return(__rEturnList)
    )
    )

    procedure( __sPlitList(iNList sTartIndex eNdIndex)
    prog((_tList)
    _tList = list()
    for(i sTartIndex eNdIndex
    _tList = cons(nth(i iNList) _tList)
    )
    return(_tList)
    )

    )

    it is something,

    I am using this test a bigger program to see if it makes any difference in processing a huge list at one shot or processing them 100 at a time

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • vramanax
    vramanax over 10 years ago

    Hi thanks Here is a solution I came up with

    assume a list of objects is more than 100

    then you use the following call

    __bReakList(llist)

    I have 2 procedures

    procedure( __bReakList(_lIst)
    prog((i __rEturnList __ChunkSize __RemainderChunk _tList)
    i=0
    __ChunkSize = length(_lIst)/100
    __RemainderChunk = mod(length(_lIst) 100)
    __rEturnList = list()
    while(i < (length(_lIst) - __RemainderChunk)-1
    __rEturnList = cons(__sPlitList(_lIst i i+99) __rEturnList)
    i = i + 100
    )
    _tList = list()
    for(i length(_lIst) - __RemainderChunk length(_lIst)-1
    _tList = cons(nth(i _lIst) _tList)
    )

    __rEturnList = cons(_tList __rEturnList)
    i = 0
    return(__rEturnList)
    )
    )

    procedure( __sPlitList(iNList sTartIndex eNdIndex)
    prog((_tList)
    _tList = list()
    for(i sTartIndex eNdIndex
    _tList = cons(nth(i iNList) _tList)
    )
    return(_tList)
    )

    )

    it is something,

    I am using this test a bigger program to see if it makes any difference in processing a huge list at one shot or processing them 100 at a time

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information