Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8495605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:37:08+00:00 2026-06-10T23:37:08+00:00

I wanted to hack a quick script that simply splits a nucleotide sequence (a

  • 0

I wanted to hack a quick script that simply splits a nucleotide sequence (a string like “ATGAAGAAC…”) into a List of triplets aka codons (Strings: “ATG”, “AAG”, “AAC”, …) to do other stuff with.

What’s wrong with this one-liner, why do I get a “java.lang.OutOfMemoryError: GC overhead limit exceeded” ?

def tripletize(s:String, accu:List[String] = List.empty[String]):List[String] = tripletize(s.drop(3), s.take(3) :: accu)

I’m not asking what that is, but why I get it and how to avoid.
Btw, I know this would give me the reverse order, but I don’t know how to avoid that scala considers String as a collection itself. i.e. this:

scala> List.empty ++ "hello"
res6: List[Char] = List(h, e, l, l, o)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:37:10+00:00Added an answer on June 10, 2026 at 11:37 pm

    When do you stop? drop won’t terminate the recursion just because there’s nothing more to drop. Also, what do you return? You never say. You need to do something like

    = if (s.length==0) accu else tripletize(s.drop(3), s.take(3) :: accu)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know that if I am doing correctly, regarding retain and release
Wanted to merge my branch back into the main trunk today. Haven't worked on
I've an R script, that takes commandline arguments, where the top line is: #!/usr/bin/Rscript
I am under the impression that the best way to style a list item
Wanted to know if there was a way one could query shelveset details from
Wanted to know if someone had a suggestion on code or maybe there's a
Wanted to see if anyone knows how to add props to a image with
Wanted to understand the difference between undef and define a macro as 0. Thanks.
just wanted to ask where I define initial class properties? From other languages I
I wanted to make a Java based web crawler for an experiment. I heard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.