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 8115285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:25:19+00:00 2026-06-06T03:25:19+00:00

I’m just learning Erlang with Chicago Boss and would like to know how could

  • 0

I’m just learning Erlang with Chicago Boss and would like to know how could I do something similar to this (in pseudocode):

foreach (items as item)
    if (i % 10 == 0)
        <tr>
    endif
    <td>...</td>
    if (i++ % 10 == 0)
        </tr>
    endif
endforeach

in my template?

  • 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-06T03:25:21+00:00Added an answer on June 6, 2026 at 3:25 am

    Erlang is functional language so idiomatic way is do it in functional way. We prepare function which will tabular your data first:

    -module(tabify).
    
    -export([tabify/2]).
    
    tabify(N, L) when is_list(L), is_integer(N), N > 0 ->
      tabify_(N, L).
    
    tabify_(_, []) -> [];
    tabify_(N, L) ->
      {Row, Rest} = row(L, N),
      [Row|tabify_(N, Rest)].
    
    row(L, N) ->
      row(L, N, []).
    
    row([], _, Accu) -> {lists:reverse(Accu), []};
    row(Rest, 0, Accu) -> {lists:reverse(Accu), Rest};
    row([H|T], N, Accu) -> row(T, N-1, [H|Accu]).
    

    And now we can use it in way:

    1> c(tabify).
    {ok,tabify}
    2> Data = [integer_to_list(X) || X <- lists:seq(1,100)].
    ["1","2","3","4","5","6","7","8","9","10","11","12","13",
     "14","15","16","17","18","19","20","21","22","23","24","25",
     "26","27","28",
     [...]|...]
    3> Table = tabify:tabify(10,Data).
    [["1","2","3","4","5","6","7","8","9","10"],
     ["11","12","13","14","15","16","17","18","19","20"],
     ["21","22","23","24","25","26","27","28","29","30"],
     ["31","32","33","34","35","36","37","38","39","40"],
     ["41","42","43","44","45","46","47","48","49","50"],
     ["51","52","53","54","55","56","57","58","59","60"],
     ["61","62","63","64","65","66","67","68","69","70"],
     ["71","72","73","74","75","76","77","78","79","80"],
     ["81","82","83","84","85","86","87","88","89","90"],
     ["91","92","93","94","95","96","97","98","99","100"]]
    4> T = [["<tr>", [["<td>", Item, "</td>"] || Item <- Row ], "</tr>"]|| Row <- Table].
    [["<tr>",
      [["<td>","1","</td>"],
       ["<td>","2","</td>"],
       ...
    

    And than let io subsystem do the rest. The structure above is well known as iolist and if you put it in any io it will be serialized properly in same way as:

    6> iolist_to_binary(T).
    <<"<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td></tr><tr><t"...>>
    

    If you have thousands of items in table and efficiency is crucial for you can turn all lists constants into binary. You can also turn into binary data in Data. As last resort you can rewrite tabify/2 and formatting in more efficient but less readable way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to count the length of a string with PHP. The string
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace

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.