| Author |
Message |
< Erlang ~ converting a number to string for string concatenation |
| Jigar Gosar |
Posted: Tue Oct 09, 2007 1:34 pm |
|
|
|
Joined: 09 Oct 2007
Posts: 9
|
I have a variable which contains a number
say, X=123. now I want to concatenate this number with a string. Y="abc" such that Z <- "abc123".
please help. |
|
|
| Back to top |
|
| Mazen |
Posted: Tue Oct 09, 2007 2:09 pm |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
There are different ways of doing this... here are 3 versions..
Given that X = 123, Y = "abc"
1)
Code:
Z = Y ++ integer_to_list(X).
2)
Code:
Z = io_lib:format("~s~b",[Y,X]).
3)
Code:
Z = lists:concat([Y,X]).
/M |
|
|
| Back to top |
|
| Jigar Gosar |
Posted: Wed Oct 10, 2007 5:34 pm |
|
|
|
Joined: 09 Oct 2007
Posts: 9
|
thanks a lot, for such a prompt reply. this really helped.
although, but I was hoping for a more concise, or elegant solution in Erlang. Anyways, some solution is better than no solution.
thanks a lot. |
|
|
| Back to top |
|
| rbucker881 |
Posted: Thu Oct 11, 2007 12:17 am |
|
|
|
User
Joined: 11 Oct 2007
Posts: 17
|
Consider the same in Java:
[code]
String X = "abc";
int Y = 123;
String new = X + Integer.toString(Y);
[/code]
and then consider a relatively new feature (autoboxing) which allows:
[code]
System.out.println("abc"+123);
[/code]
What did you mean by concise? Neither perl nor python can do this:
[code]
print "abc"+123;
[/code]
[code][/code] |
|
|
| Back to top |
|
| Jigar Gosar |
Posted: Thu Oct 11, 2007 4:19 pm |
|
|
|
Joined: 09 Oct 2007
Posts: 9
|
Well, the concatenation of number with a string in Java is not a new feature at all. Its as old as java 1.2 may be even older. The auto boxing feature in java 1.5 has nothing to do with your example.
And yes, java is concise. Ruby is also concise. These are the two lang that I am very familiar with, hence I expected some concise solution.
ruby:
|
|
|
| Back to top |
|
| hao |
Posted: Fri Oct 12, 2007 8:20 am |
|
|
|
User
Joined: 20 Aug 2007
Posts: 18
Location: Uppsala, Sweden
|
As to being concise, I agree that Ruby is very concise. But Erlang is quite concise as well. For example, the first solution posted by Mazen is just similar to your solution by Ruby.
Erlang:Code: Result = "abc" ++ integer_to_list(123).
Don't you agree that it is as concise as your Ruby code? Just try it in the Erlang shell. I don't think there is any more concise way to do it so far by any other programming language.
Cheers~~~ |
|
|
| Back to top |
|
| Jigar Gosar |
Posted: Fri Oct 12, 2007 9:58 am |
|
|
|
Joined: 09 Oct 2007
Posts: 9
|
I completely agree, Ruby just chose a shorter name, and Erlang method names are very explicit. I think, my concern was actually only about the length of the method name, which is a highly debatable topic. And every language has chosen its poison.  |
|
|
| Back to top |
|
| hao |
Posted: Fri Oct 12, 2007 10:51 am |
|
|
|
User
Joined: 20 Aug 2007
Posts: 18
Location: Uppsala, Sweden
|
Yes, you are right. Ruby's naming and syntax rule is much closer to that of human's speaking language while Erlang's is a little bit longer and explicit. Well, we can take both. They are all good programming languages.
Thanks for your topic discussion.  |
|
|
| Back to top |
|
| timrila |
Posted: Thu Jun 07, 2012 9:49 am |
|
|
|
User
Joined: 28 Mar 2012
Posts: 32
|
|
| Back to top |
|
| bottomshoes |
Posted: Sat Jun 09, 2012 6:31 am |
|
|
|
Joined: 06 Jun 2012
Posts: 7
Location: asd
|
The woman forever with high-heeled louis vuitton red bottom shoes tied, the sexy goddess Marilyn Monro for wear by Ferragamo designed metal stilettos and a night to be many men dream lover. She also had said:” although I do not know who invented the first high heels, but all women should be grateful for it, high heels for my career has a wonderful help.”
The former president of the Philippines lady Imelda in the horse pulled Hom Nangong hundreds of pairs of every kind of red bottom shoes oprah , these shoes, not only to record the beauty of a woman, and the emotions and desires.
Of course, when it comes to high heels, we can not ignore the swarm in the green tiles and red walls in the swaying of women. She lived in Chu Xiugong, Longevity Palace already have all kinds of flags shoes, empress the Manchu women like to use the flag shoes, wooden shoes and high end is flat red bottom shoes designer
And she most loves pink satin stitch pattern is bamboo butterfly carp design ofred bottom shoes priceand light green satin embroidered flowers pelvic floor branch blue pattern horseshoe shoes, it sounds very romantic. My mother is of Manchu descent, when a small, family is the most valuable of a camphor wood box hidden in such a pair of shoes, the bottom seven or eight cm thick, but very small, so to be able to step on the woman is doomed to stand gracefully erect.
I was very curious, secretly took out the Jiabao trying to cross, but even the child’s foot, try to also do not wear. Remember to plug in a few toes, let alone walk. So at that time, I will be confused that, that just two exquisite toys red bottom shoes for men One can imagine, if a woman can wear a shoe to walk, the how much with great care, and will go out of how calm the Royal flavor?
A pair of new red bottom shoes oprah wears, not only for clothing bonus, but also enhance the bride ‘s personal taste; a beautiful pair of shoes or mood moisturizing agent;
Beautiful the bride should be perfect from head to foot, then the wedding, dress and red sole shoes oprah wears how perfect match, in this big nerve-racking bride, let us have a look the changeable wedding apparel is how the clever collocation.
Style: Orthodox Wedding: concise style, skirt body is the most common form of orthodox wedding, wedding and such matching red bottom shoes for men, style is relatively simple, the color to white, silver is better, is closer to the wedding white or beige more with the wedding dress fit, when on the move never because of his dissonant dark shoes appear abrupt.
Pattern two: offbeat fashion: fashion dress does not rigidly adhere to orthodox wedding be bound hands and feet, let red bottom shoes for cheap bride can better display their personality,
The wedding in color with yellow rice majority, wedding of the overall decoration of the strong, the use of a large number of red bottom shoes as the clothing ornament, such as collocation shoes must also hold the wedding on the popular element, let marriage gauze on the fitting element in the same red bottoms shoes show.
High heel shoes fashion, from the world’s major brands of shoes to Japan and South Korea style, almost is have red bottom shoeseverything that one expects to find, in the Chinese market, many young girls prefer Japanese and Korean style red bottoms for men, perhaps due to the Korean apparel fashion concept.
Last year’s high heels and flats are popular with some cute and sweet style, but this is a little different, found in many girls choose red bottoms shoes for menabove, this preference is mature and a bit of fashion style, and even more personality is also very popular. And South Korean some shoes design also from cute style to intellectual and mature style.
Some of it is summed up in the popular trend, this year many international brand red bottoms lyrics on the design from the upper to the heel of the shoe, which is the forefront of fashion in a relatively good development, last year’s shoes fashion like a vamp in the efforts, the more common are:
red bottom shoes, heart-shaped, bows the shape of the decoration, and this year the designers gave us another angle of visual sense.
The shoes design, focused on the heels, or the heel made of odd shape, or in the shoe is decorated with some small things, such as precious stones, diamonds, crystal and other luxury goods, let the stars shine red bottoms trinaUnexpectedly, a pair of high heels has so many artistic connotation in it, in fact we designers great creative at the same time, also feel the fashion trend of swift and violent development, slightly does not follow to go up there, will be called ” OUT .”. From the initial simple, now pay attention to every detail, red bottoms urban dictionary fashion road has been undergoing a great change, the future will derive how to charm, we will see!
The woman forever with buy christian louboutin daffodil pumps high-heeled shoes tied, the sexy goddess Marilyn Monro for wear by Ferragamo designed metal stilettos and a night to be many men dream lover. She also had said:” although I do not know who invented the first christian louboutin women's dress shoes, but all women should be grateful for it, high heels for my career has a wonderful help.”
The former president of the Philippines lady Imelda in the horse pulled Hom Nangong hundreds of pairs of every kind of women's shoes have red soles, these shoes, not only to record the beauty of a woman, and the emotions and desires.
Of course, when it comes to high heels, we can not ignore the swarm in the green tiles and red walls in the swaying of women. She lived in Chu Xiugong, Longevity Palace already have all kinds of buy christian louboutin cheap, empress the Manchu women like to use the flag shoes, wooden shoes and high end is flat shoes.
Beckjames |
|
|
| Back to top |
|
| timrila |
Posted: Tue Jun 12, 2012 9:35 am |
|
|
|
User
Joined: 28 Mar 2012
Posts: 32
|
|
| Back to top |
|
| bottomshoes |
Posted: Fri Jun 15, 2012 3:14 am |
|
|
|
Joined: 06 Jun 2012
Posts: 7
Location: asd
|
The woman forever with high-heeled louis vuitton red bottom shoes tied, the sexy goddess Marilyn Monro for wear by Ferragamo designed metal stilettos and a night to be many men dream lover. She also had said:” although I do not know who invented the first high heels, but all women should be grateful for it, high heels for my career has a wonderful help.”
The former president of the Philippines lady Imelda in the horse pulled Hom Nangong hundreds of pairs of every kind of red bottom shoes oprah , these shoes, not only to record the beauty of a woman, and the emotions and desires.
Of course, when it comes to high heels, we can not ignore the swarm in the green tiles and red walls in the swaying of women. She lived in Chu Xiugong, Longevity Palace already have all kinds of flags shoes, empress the Manchu women like to use the flag shoes, wooden shoes and high end is flat red bottom shoes designer
And she most loves pink satin stitch pattern is bamboo butterfly carp design ofred bottom shoes priceand light green satin embroidered flowers pelvic floor branch blue pattern horseshoe shoes, it sounds very romantic. My mother is of Manchu descent, when a small, family is the most valuable of a camphor wood box hidden in such a pair of shoes, the bottom seven or eight cm thick, but very small, so to be able to step on the woman is doomed to stand gracefully erect.
I was very curious, secretly took out the Jiabao trying to cross, but even the child’s foot, try to also do not wear. Remember to plug in a few toes, let alone walk. So at that time, I will be confused that, that just two exquisite toys red bottom shoes for men One can imagine, if a woman can wear a shoe to walk, the how much with great care, and will go out of how calm the Royal flavor?
A pair of new red bottom shoes oprah wears, not only for clothing bonus, but also enhance the bride ‘s personal taste; a beautiful pair of shoes or mood moisturizing agent;
Beautiful the bride should be perfect from head to foot, then the wedding, dress and red sole shoes oprah wears how perfect match, in this big nerve-racking bride, let us have a look the changeable wedding apparel is how the clever collocation.
Style: Orthodox Wedding: concise style, skirt body is the most common form of orthodox wedding, wedding and such matching red bottom shoes for men, style is relatively simple, the color to white, silver is better, is closer to the wedding white or beige more with the wedding dress fit, when on the move never because of his dissonant dark shoes appear abrupt.
Pattern two: offbeat fashion: fashion dress does not rigidly adhere to orthodox wedding be bound hands and feet, let red bottom shoes for cheap bride can better display their personality,
The wedding in color with yellow rice majority, wedding of the overall decoration of the strong, the use of a large number of red bottom shoes as the clothing ornament, such as collocation shoes must also hold the wedding on the popular element, let marriage gauze on the fitting element in the same red bottoms shoes show.
High heel shoes fashion, from the world’s major brands of shoes to Japan and South Korea style, almost is have red bottom shoeseverything that one expects to find, in the Chinese market, many young girls prefer Japanese and Korean style red bottoms for men, perhaps due to the Korean apparel fashion concept.
Last year’s high heels and flats are popular with some cute and sweet style, but this is a little different, found in many girls choose red bottoms shoes for menabove, this preference is mature and a bit of fashion style, and even more personality is also very popular. And South Korean some shoes design also from cute style to intellectual and mature style.
Some of it is summed up in the popular trend, this year many international brand red bottoms lyrics on the design from the upper to the heel of the shoe, which is the forefront of fashion in a relatively good development, last year’s shoes fashion like a vamp in the efforts, the more common are:
red bottom shoes, heart-shaped, bows the shape of the decoration, and this year the designers gave us another angle of visual sense.
The shoes design, focused on the heels, or the heel made of odd shape, or in the shoe is decorated with some small things, such as precious stones, diamonds, crystal and other luxury goods, let the stars shine red bottoms trinaUnexpectedly, a pair of high heels has so many artistic connotation in it, in fact we designers great creative at the same time, also feel the fashion trend of swift and violent development, slightly does not follow to go up there, will be called ” OUT .”. From the initial simple, now pay attention to every detail, red bottoms urban dictionary fashion road has been undergoing a great change, the future will derive how to charm, we will see!
The woman forever with buy christian louboutin daffodil pumps high-heeled shoes tied, the sexy goddess Marilyn Monro for wear by Ferragamo designed metal stilettos and a night to be many men dream lover. She also had said:” although I do not know who invented the first christian louboutin women's dress shoes, but all women should be grateful for it, high heels for my career has a wonderful help.”
The former president of the Philippines lady Imelda in the horse pulled Hom Nangong hundreds of pairs of every kind of women's shoes have red soles, these shoes, not only to record the beauty of a woman, and the emotions and desires.
Of course, when it comes to high heels, we can not ignore the swarm in the green tiles and red walls in the swaying of women. She lived in Chu Xiugong, Longevity Palace already have all kinds of buy christian louboutin cheap, empress the Manchu women like to use the flag shoes, wooden shoes and high end is flat shoes.
Beckjames |
|
|
| Back to top |
|
| goods |
Posted: Fri Jun 29, 2012 2:02 am |
|
|
|
User
Joined: 28 Jun 2012
Posts: 14
|
| Christian Louboutin Homme Espadrilles est absolument représentatif de la mode et les loisirs, christian Chaussures Louboutin, est devenu une question de cours le protagoniste populaire de la saison. Nous ferons de notre mieux pour vous satisfaire. Toutes les Louboutin Pas Cher a été travaillé par des artisans et des espadrilles bonne Christian Louboutin pour les Christian Louboutin Homme par la main et c'est le résultat d'une sélection rigoureuse. si vous êtes engagé dans la vogue ou si vous voulez garder le même rythme avec la tendance, Louboutin 2012 chaussures de sport des hommes pourrait être votre meilleur choix. Commandez-le maintenant produits sont expédition libre. |
|
|
| Back to top |
|
| nato |
Posted: Fri Aug 03, 2012 9:49 am |
|
|
|
User
Joined: 03 Aug 2012
Posts: 16
|
|
| Back to top |
|
| bbxj54321 |
Posted: Tue Aug 07, 2012 6:57 am |
|
|
|
Joined: 07 Aug 2012
Posts: 3
|
August seven, next year London Olympic Games Buccaneer Rivalry to keep at it, the particular team's Xu Lijia associated with Singapore earned the particular rare metal honor.Within the honor spherical belonging to the Ladies Laser light Radial Deere place, Xu Lijia at the forefront with the to begin with 30 minutes and additionally 20 a few seconds, spanning the bottom brand, the girl world wide web rating regarding 33 elements towards succeed in all the golden honor. Right birkenstock shoes here is the Asian squad seized the particular precious metal honor on the radium Deere quality somebody in charge of, chinese people delegation during the thirty one Olympics platinum medallion. Bowie Meath Patel, netherlands and Australia Fane Kerr factors towards the sterling silver plus bronze.
???half-hour 21 secs! Xu Lijia main second ??¡À????¡Á?1 Patel, the full 7 just a few seconds, which might show up garish that's, eventually, Xu Lijia having 4 years of one's time in order that it convenience - prior to when the Olympic Games london, she has really by a spine injuries rehabilitation are able to for a second time think of all the China Olympic Games, since the state? Nobody is immune.
Beijing Olympics four years backwards, sole 21-year-old Xu Lijia received the single-handed Beam of light Radial bronze honor to your new identified below chinese people company for a twelve months, it can be an enormous amazement, owing to this China Olympic brown honor good results, this time head out to help you Liverpool, Xu Lijia prospects increased. On the other hand, when the Olympic Games on Beijing, Xu Lijia birkenstock sale is enduring once again problem weighed down your girlfriend trauma ahead of the Olympics in the uk, slowly begin to recuperate, but these days your sweetheart made the actual episode of the powerful golden medallion. "Age moreover took part in a lot of tournaments, knowing of typically the boating tips well over the unique, prior to dispatch The uk, Xu Lijia, smiling users of job interview together with journalists, fifty percent monthly afterward, London Olympics to help you earn any old watches medal, Xu Lijia's struggle with also which has a learning smile.[/url] |
|
|
| Back to top |
|
|
|
All times are GMT
Page 1 of 2
Goto page 1, 2 Next
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|