[erlang-questions] erlang-questions Digest, Vol 14, Issue 87
AmandeepMidha 72123
amandeepm@REDACTED
Thu Jul 24 04:46:57 CEST 2008
this is Amandeep from Shenzhen, China. Are there any participants here for Erlang?
******************************************************************************************
This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
*****************************************************************************************
----- Original Message -----
From: erlang-questions-request@REDACTED
Date: Thursday, July 24, 2008 10:17 am
Subject: erlang-questions Digest, Vol 14, Issue 87
> Send erlang-questions mailing list submissions to
> erlang-questions@REDACTED
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.erlang.org/mailman/listinfo/erlang-questions
> or, via email, send a message with subject or body 'help' to
> erlang-questions-request@REDACTED
>
> You can reach the person managing the list at
> erlang-questions-owner@REDACTED
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of erlang-questions digest..."
>
>
> Today's Topics:
>
> 1. Re: Ideas for a new Erlang (Ulf Wiger)
> 2. Re: Mapping over 2+ lists/variables? (Richard Carlsson)
> 3. Re: fast JSON parser in C (Jonathan Gray)
> 4. tail of string = 104, bit? (Circular Function)
> 5. Re: tail of string = 104, bit? (Lev Walkin)
> 6. Re: tail of string = 104, bit? (David King)
> 7. Re: tail of string = 104, bit? (Jos Visser)
> 8. Re: fast JSON parser in C (Chris Anderson)
> 9. scalaris code posted (Joe Armstrong)
> 10. Re: Mapping over 2+ lists/variables? (Richard A. O'Keefe)
> 11. Erlang in Toronto? (Justin Giancola)
>
>
> -------------------------------------------------------------------
> ---
>
> Message: 1
> Date: Wed, 23 Jul 2008 19:27:33 +0200
> From: "Ulf Wiger" <ulf@REDACTED>
> Subject: Re: [erlang-questions] Ideas for a new Erlang
> To: "Sven-Olof Nystr|m" <svenolof@REDACTED>
> Cc: Erlang mailing list <erlang-questions@REDACTED>
> Message-ID:
> <8209f740807231027t385f22afwe10786451c0c6204@REDACTED>
> Content-Type: text/plain; charset=ISO-8859-1
>
> 2008/7/22 Sven-Olof Nystr|m <svenolof@REDACTED>:
> > Ulf Wiger writes:
>
> > >
> > > A good place to start might be the POTS control program,
> which was
> > > presented in the Erlang book, and also used (in a slightly
> different form)
> > > in the Introductory Erlang course.
> > >
> > > I used it in my "Structured Network Programming" presentation to
> > > show the consequences of different programming styles in multiway
> > > signaling:
> > >
> > > http://www.erlang.se/euc/05/1500Wiger.ppt
> > >
> > > I'm not convinced that it will be sufficient to reveal
> significant differences
> > > between the standard erlang style and channels, but it's a
> good place to
> > > start, and the code can be expanded in a number of
> interesting ways.
> > >
> > > BR,
> > > Ulf W
> > >
> > > (There's a working simulator to go with the program, but the
> OTP team
> > > would have to give permission to release it in public. I'm
> sure you can
> > > get your hands on it anyway.)
> >
> >
> > Sorry about disappearing from the discussion for so long.
> >
> > I took a look at the POTS program in the Erlang book. It is actually
> > easy to rewrite it to use neither channels nor selective receive.
> >
> > I also looked at the gen-server module.
> >
> > Detailed comments follow. (A non-selective receive is one that
> always> pick the first message in the mailbox.)
> >
> > Sven-Olof
> >
> >
> >
> > The book's implementation of POTS only contains four receive
> > expressions. Among these, only one (in the function
> make_call_to_B/3)> is selective.
>
> You should also take a look at the presentation that I referred to.
>
> Just looking at the example in the book, you are making the same
> mistake as the Nordlander thesis on OHaskell. The POTS system
> also uses messages to control the switch hardware, and this control
> is stateful and synchronous. Furthermore, I believe that the MD110
> hardware had no way to queue requests, so the control system must
> take care to issue only one request at a time.
>
> The OHaskell example assumed that functions like start_tone()
> were atomic and non-blocking - they are not.
>
> In my presentation, I also made the number analysis asynchronous,
> which may seem far-fetched in the limited POTS example, but is quite
> realistic when one considers modern IP-based telephone. The
> idea was to convert synchronous requests into explicit asynchronous
> request-reply pairs, and having at least two such protocols that could
> interleave.
>
> A SIP signaling control system can make as much as 5-10 network-
> based (or more) requests for one call, for things like billing,
> admission control, location lookup, resource allocation, etc.
> All conceptually synchronous, but the SIP signaling is asynchronous.
> The interleaving of all signals make a global state-event matrix
> impossibly complicated, so conceptual layering is essential.
>
> BR,
> Ulf W
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 23 Jul 2008 18:28:46 +0200
> From: Richard Carlsson <richardc@REDACTED>
> Subject: Re: [erlang-questions] Mapping over 2+ lists/variables?
> To: circularfunc@REDACTED
> Cc: erlang-questions@REDACTED
> Message-ID: <48875C3E.7050903@REDACTED>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Circular Function wrote:
> > in python I can do:
> > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6])
> > [5, 7, 9]
> > >>>
> >
> > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]).
> > ** exception error: undefined function lists:map/3
> > 39>
> >
> > isnt there general map-function that map is derived from that I
> can use?
> > what about listcomprehensions?
> > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)].
> > * 1: variable 'X' is unbound
> > 45>
>
> Erlang's list comprehensions can't do that. The function you want is
> lists:zipwith(Fun,List1,List2). You could also do
> lists:zip(List1,List2)and then run map on the result, but zipwith
> does it in one pass.
>
> /Richard
>
> --
> "Having users is like optimization: the wise course is to delay it."
> -- Paul Graham
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 23 Jul 2008 10:49:04 -0700
> From: "Jonathan Gray" <jlist@REDACTED>
> Subject: Re: [erlang-questions] fast JSON parser in C
> To: "'Chris Anderson'" <jchris@REDACTED>
> Cc: erlang-questions@REDACTED
> Message-ID: <071301c8ecec$6677bfa0$33673ee0$@com>
> Content-Type: text/plain; charset="us-ascii"
>
> That's the interesting thing.
>
> I've successfully encoded and decoded >1.5MB binary chunks of
> erlang terms
> when I manually create them using erl_interface.
>
> However when I get a big chunk (around 80-120K) directly from
> Erlang as
> binary (using term_to_binary in erlang), I'm unable to decode it using
> erl_interface erl_decode, though it can be decoded fine from
> within Erlang.
>
> I haven't received any responses as to a fix and was redirected
> towardsusing ei instead of (seemingly deprecated but not
> documented as deprecated)
> erl_interface.
>
> I'm going to do some testing with ei and will let you know if the
> problemgoes away.
>
> Also, I'll take a look at Yajl now. Thanks.
>
> JG
>
> -----Original Message-----
> From: jchris@REDACTED [mailto:jchris@REDACTED] On Behalf Of
> Chris Anderson
> Sent: Wednesday, July 23, 2008 10:20 AM
> To: Jonathan Gray
> Cc: erlang-questions@REDACTED
> Subject: Re: [erlang-questions] fast JSON parser in C
>
> On Wed, Jul 23, 2008 at 11:31 AM, Jonathan Gray
> <jlist@REDACTED> wrote:
> > Chris,
> >
> > Considering your primary goal is speed, you definitely don't
> want to use
> my
> > implementation.
>
> Thanks then for the info. My plan was to use
> http://www.lloydforge.org/projects/yajl/ as a fast JSON parser, and
> somehow get the results to Erlang. It looks like it may be more
> challenging than I'd thought.
>
> Out of curiosity, at roughly what size of input do you start to see
> the segfaults? I'll probably start with the ei interface if that is
> safer, but it will be nice to know how hard I have to push it to know
> that I've done the job safely.
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 23 Jul 2008 18:51:03 +0000 (GMT)
> From: Circular Function <circularfunc@REDACTED>
> Subject: [erlang-questions] tail of string = 104, bit?
> To: erlang <erlang-questions@REDACTED>
> Message-ID: <379032.6803.qm@REDACTED>
> Content-Type: text/plain; charset="utf-8"
>
> when i do tl("hej") I get 104, well I need "h".
> How do I get h amd if not possible how do i convert 104 to
> string?? or how do i convert string to the other format? is it a bit?
>
>
>
> __________________________________________________________
> L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo.
> http://www.kelkoo.se/c-100390123-lan-utan-
> sakerhet.html?partnerId=96915014-------------- next part ----------
> ----
> An HTML attachment was scrubbed...
> URL: http://www.erlang.org/pipermail/erlang-
> questions/attachments/20080723/565ded70/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Wed, 23 Jul 2008 12:32:43 -0700
> From: Lev Walkin <vlm@REDACTED>
> Subject: Re: [erlang-questions] tail of string = 104, bit?
> To: circularfunc@REDACTED
> Cc: erlang <erlang-questions@REDACTED>
> Message-ID: <4887875B.4040209@REDACTED>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Circular Function wrote:
> > when i do tl("hej") I get 104, well I need "h".
>
> 104 is a code for 'h'. Try this way
>
> [tl("hej")].
>
> You'll get a list of one element, which is an "h" letter.
>
> > How do I get h amd if not possible how do i convert 104 to
> string? or
> > how do i convert string to the other format? is it a bit?
>
>
> Also, could you please stop using this erlang-question list
> as a substitute for an introductory Erlang reading.
>
>
> --
> vlm
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 23 Jul 2008 12:32:46 -0700
> From: David King <dking@REDACTED>
> Subject: Re: [erlang-questions] tail of string = 104, bit?
> To: "Erlang-Questions (E-mail)" <erlang-questions@REDACTED>
> Message-ID: <221C8D5D-0B1D-4A68-A8A8-99EAB7392304@REDACTED>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> > when i do tl("hej") I get 104, well I need "h".
> > How do I get h amd if not possible how do i convert 104 to
> string?
> > or how do i convert string to the other format? is it a bit?
>
> A string is a list of integers. [104] =:= "h"
>
>
> ------------------------------
>
> Message: 7
> Date: Wed, 23 Jul 2008 21:42:30 +0200
> From: Jos Visser <josv@REDACTED>
> Subject: Re: [erlang-questions] tail of string = 104, bit?
> To: Circular Function <circularfunc@REDACTED>
> Cc: erlang <erlang-questions@REDACTED>
> Message-ID: <20080723194230.GN5136@REDACTED>
> Content-Type: text/plain; charset=iso-8859-1
>
> I guess you mean hd("hej") returning 103. tl("hej") returns "ej".
>
> In Erlang a string is a list of integers. To make a string from an
> integer, just make a list out of it:
>
> f(S) -> [hd(S)].
>
> ++Jos.ch
>
> On Wed, Jul 23, 2008 at 06:51:03PM +0000 it came to pass that
> Circular Function wrote:
> > when i do tl("hej") I get 104, well I need "h".
> > How do I get h amd if not possible how do i convert 104 to
> string?? or how do i convert string to the other format? is it a bit?
> >
> >
> >
> > __________________________________________________________
> > L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo.
> > http://www.kelkoo.se/c-100390123-lan-utan-
> sakerhet.html?partnerId=96915014>
> _______________________________________________> erlang-questions
> mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
>
> --
> What cannot be shunned must be embraced. That is the Path...
>
>
> ------------------------------
>
> Message: 8
> Date: Wed, 23 Jul 2008 15:45:37 -0400
> From: "Chris Anderson" <jchris@REDACTED>
> Subject: Re: [erlang-questions] fast JSON parser in C
> To: "Jonathan Gray" <jlist@REDACTED>
> Cc: erlang-questions@REDACTED
> Message-ID:
> <e282921e0807231245x1d304af9q58098282d7aff4dc@REDACTED>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray <jlist@REDACTED>
> wrote:> However when I get a big chunk (around 80-120K) directly
> from Erlang as
> > binary (using term_to_binary in erlang), I'm unable to decode it
> using> erl_interface erl_decode, though it can be decoded fine
> from within Erlang.
>
> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not
> need help from C. I'm just working on making the JSON -> Erlang fast
> enough, so as long as I can get string buffers over to C in the first
> place, it sounds like you're not having a problem moving data from C
> back to Erlang.
>
> Time to buckle down and code!
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>
>
> ------------------------------
>
> Message: 9
> Date: Wed, 23 Jul 2008 23:07:59 +0200
> From: "Joe Armstrong" <erlang@REDACTED>
> Subject: [erlang-questions] scalaris code posted
> To: erlang-questions <erlang-questions@REDACTED>
> Message-ID:
> <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@REDACTED>
> Content-Type: text/plain; charset=ISO-8859-1
>
> I just got mail to say the scalaris code is posted
>
> http://code.google.com/p/scalaris
>
> I've update my blog
>
> http://armstrongonsoftware.blogspot.com/2008/06/itching-my-
> programming-nerve.html
>
> /Joe Armstrong
>
>
> ------------------------------
>
> Message: 10
> Date: Thu, 24 Jul 2008 13:33:23 +1200
> From: "Richard A. O'Keefe" <ok@REDACTED>
> Subject: Re: [erlang-questions] Mapping over 2+ lists/variables?
> To: <circularfunc@REDACTED>
> Cc: erlang-questions@REDACTED
> Message-ID: <D42056DC-BA26-4257-A10B-F55F32E54D6E@REDACTED>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> On 24 Jul 2008, at 4:24 am, Circular Function wrote:
> > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]).
> > ** exception error: undefined function lists:map/3
> > 39>
>
>
> So write your own:
>
> map(F, [A|As], [B|Bs]) -> [F(A,B) | map(F, As, Bs)];
> map(_, [], [] ) -> [].
>
> I mean, it's less typing to FIX the problem than to complain
> about it!
>
> > isnt there general map-function that map is derived from that I
> can
> > use?
>
> No. The code for map is just
>
> map(F, [A|As]) -> [F(A) | map(F, As)];
> map(_, [] ) -> [].
>
> Erlang is open source, and if you have it, you also have all the
> source code, including <ERLHOME>/lib/stdlib/src/lists.erl,
> so you can easily see for yourself how this and other functions
> work.
>
> >
> > what about listcomprehensions?
> > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)].
> > * 1: variable 'X' is unbound
>
> Indeed it is. Like Haskell (yah boo chiz) Erlang list
> comprehensions do not permit "parallel" iteration, only
> "nested" iteration. This is one of the things I like
> about Clean. Hmm. List comprehension uses '||', I've
> just thought of a use for '&&'...
>
> The Haskell approach would be
>
> [x + y | (x,y) <- zip [1..10] [1..10]]
>
> or better still,
> zipWith (+) [1..10] [1..10]
>
> The Erlang equivalent of using zip here is, well,
> using zip:
>
> [X + Y | {X,Y} <- lists:zip(lists:seq(1,10),
> lists:seq(1,10))]
>
> Personally I loathe this. Some Haskell compilers
> (notably GHC and I think YHC) are smart enough to do
> 'deforestation' and NOT really build a list of pairs.
> The Erlang compiler is not. (For one thing, 'zip'
> is part of the Haskell 'standard prelude'; it really
> counts as part of the language. 'zip' is not in the
> erlang: module, and not even in any module in the
> kernel application. It's in the lists module, which
> is in the stdlib application. So the compiler is not
> going to make any assumptions at all about what it does.)
> I would prefer to see
> [X + Y || X <- lists:seq(1,10)
> && Y <- lists:seq(1,10)]
>
> Sadly, that's not legal now.
>
> --
> If stupidity were a crime, who'd 'scape hanging?
>
>
>
>
>
>
>
>
>
> ------------------------------
>
> Message: 11
> Date: Wed, 23 Jul 2008 22:17:53 -0400
> From: "Justin Giancola" <justin.giancola@REDACTED>
> Subject: [erlang-questions] Erlang in Toronto?
> To: erlang-questions@REDACTED
> Message-ID:
> <688f5b410807231917j6579f1f2q260fb575afe1d890@REDACTED>
> Content-Type: text/plain; charset=ISO-8859-1
>
> A few Toronto developers who have been experimenting with Erlang
> in their spare time ran into each other this weekend at a conference
> and decided it would be a good idea to organize some kind of a
> meet-up.
>
> It might not be appropriate to even call this an Erlang user
> group--we're not sure anyone in Toronto is actually _using_ Erlang!
> But maybe we're wrong. Either way, let us know if you're in Toronto
> and working or playing with Erlang--we'd like to get an idea of how
> many people would be interested so that we can select an appropriate
> venue. You can either reply to this post or email info@REDACTED
>
>
> Justin, Luke, et al.
>
> p.s. we've registered the tdoterl domain as the future home for
> the group.
> There's nothing there yet, but we're planning to build a site (in
> Erlang, of course) as one of the group's first projects.
>
>
> ------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
> End of erlang-questions Digest, Vol 14, Issue 87
> ************************************************
>
More information about the erlang-questions
mailing list