Re: base representation for integers?

15 views
Skip to first unread message

Robert Virding

unread,
Jan 30, 2013, 9:06:31 AM1/30/13
to lisp-flavo...@googlegroups.com
You have binary #b101010, octal #o52, decimal #d42, hex #h2a and
finally #12r36 (#r allows any base). It is (very briefly) documented
in doc/user_guide.txt. And there is always the code in
src/lfe_scan.xrl. :-) I see now that I just fail miserably if the bas
in #r is not 1-36, will fix that in a future release.

There is documentation, though not always that much. Are you a lisper?
I don't know how good a way this to learn Erlang though 'cos most
literature/documentation uses the vanilla Erlang syntax. But I will
help.

Robert

On 30 January 2013 09:06, <dun...@cogitat.io> wrote:
> Hey all,
>
> I'm new to LFE (and have never more than played with Erlang in the past), so
> I probably will be full of questions like this one for a while ;-)
>
> But for now: what is the lfe equivalent for 2#101010. ?
>
> (And, had I known, where would I have gone in the source code to discover
> the answer to that?)
>
> Thanks so much!
>
> d

rvirding

unread,
Jan 30, 2013, 9:18:22 AM1/30/13
to lisp-flavo...@googlegroups.com
One quick comment about LFE is that it is a lisp that is VERY tuned to Erlang so it has/lacks things common in "normal" lisps. For example
  • No mutable data and variables. At all! So no setq, set or any set-?? functions.
  • Very heavy use of pattern matching, everywhere. For example let has patterns:
(let ((<pattern> <value>)
      (<pattern> <value>))
  ...)

  • There is a record "type" which is exactly the same as vanilla Erlang records, i.e. disguised tagged tuples.
  • There are no user defined data types.
Robert

Duncan McGreggor

unread,
Jan 30, 2013, 12:39:52 PM1/30/13
to lisp-flavo...@googlegroups.com
On Wed, Jan 30, 2013 at 6:06 AM, Robert Virding <rvir...@gmail.com> wrote:
You have binary #b101010, octal #o52, decimal #d42, hex #h2a

Whoops -- that should have been #x2a
 
and
finally #12r36 (#r allows any base). It is (very briefly) documented
in doc/user_guide.txt.

Found it -- thanks!

Also, nice job on the docs... wow.
 
And there is always the code in
src/lfe_scan.xrl. :-)

Hehehe. In time ;-)
 
I see now that I just fail miserably if the bas
in #r is not 1-36, will fix that in a future release.

Excellent!

There is documentation, though not always that much. Are you a lisper?

I hesitate to say yes... given your extensive background ;-) Lisp is probably my favorite language, though I only have a few hobbyist years using it. (since 2008, started with genetic algorithms/ programming. My background from 80s-90s was BASIC -> Pascal/C -> Perl -> Python.) 
 
I don't know how good a way this to learn Erlang though 'cos most
literature/documentation uses the vanilla Erlang syntax.

I certainly have no problem with Erlang as a language; I've adored it conceptually since I first heard about it (mid-2000s); the sticking point for me has always been the syntax. Sadly, my over-developed aesthetic sense prevented me from spending too much time in it. Knowing there's a way around this, I'm now enthusiastically reading the Armstrong + Cesarini/Thompson books :-)
 
But I will
help.

And you have! 5 stars for lfe support!

Thanks so much,

d
 

Robert

On 30 January 2013 09:06,  <dun...@cogitat.io> wrote:
> Hey all,
>
> I'm new to LFE (and have never more than played with Erlang in the past), so
> I probably will be full of questions like this one for a while ;-)
>
> But for now: what is the lfe equivalent for 2#101010. ?
>
> (And, had I known, where would I have gone in the source code to discover
> the answer to that?)
>
> Thanks so much!
>
> d

--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Duncan McGreggor

unread,
Jan 30, 2013, 12:44:36 PM1/30/13
to lisp-flavo...@googlegroups.com
On Wed, Jan 30, 2013 at 6:18 AM, rvirding <rvir...@gmail.com> wrote:
One quick comment about LFE is that it is a lisp that is VERY tuned to Erlang so it has/lacks things common in "normal" lisps. For example
  • No mutable data and variables. At all! So no setq, set or any set-?? functions
I tend to use lisp in a very scheme-like way: almost entirely functional in approach (certainly no CLOS), avoiding side effects at all cost. So this is actually great news.
  • Very heavy use of pattern matching, everywhere. For example let has patterns:
(let ((<pattern> <value>)
      (<pattern> <value>))
  ...)


A huge fan of patterns in Erlang, I can't tell you how happy I was to read the above :-)

  • There is a record "type" which is exactly the same as vanilla Erlang records, i.e. disguised tagged tuples.
  • There are no user defined data types.
Good to know -- thanks!

d
 
Robert


On Wednesday, January 30, 2013 3:06:31 PM UTC+1, rvirding wrote:
You have binary #b101010, octal #o52, decimal #d42, hex #h2a and
finally #12r36 (#r allows any base). It is (very briefly) documented
in doc/user_guide.txt. And there is always the code in
src/lfe_scan.xrl. :-) I see now that I just fail miserably if the bas
in #r is not 1-36, will fix that in a future release.

There is documentation, though not always that much. Are you a lisper?
I don't know how good a way this to learn Erlang though 'cos most
literature/documentation uses the vanilla Erlang syntax. But I will
help.

Robert

Reply all
Reply to author
Forward
0 new messages