unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bolega <gnuist006@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: lambda inside a let or letrec
Date: Wed, 9 Jun 2010 23:18:25 -0700 (PDT)	[thread overview]
Message-ID: <571723a4-e5b3-403a-b856-fb377ee68c73@c10g2000yqi.googlegroups.com> (raw)
In-Reply-To: 3f3fa71f-f6a5-43e7-9736-c4bfc013141c@e5g2000yqn.googlegroups.com

On Jun 9, 10:37 pm, bolega <gnuist...@gmail.com> wrote:
> let me write it more clearly with indents as follows :
>
> (let
> ((a (lambda (n) (+ 1 n)))
>  (b 3))
> (a b))
>
> On Jun 9, 10:34 pm, bolega <gnuist...@gmail.com> wrote:
>
> > My apologies in advance to comp.lang.scheme and comp.lang.lisp.
>
> > I am trying to run a certain syntax inside emacs lisp.
>
> > I know basically how let works
>
> > (let (list of pairs of var value) (function))
>
> > This is like a lambda function call , only the order is different.
>
> > But the novelty i saw reading a book on common lisp or scheme is this
> > and i failed to run in emacs. plz tell what modifications are needed
> > and i know they are different.
>
> > (   (lambda (n) (+ 1 n)) 3)  ;;; works in emacs
>
> > (let
> > ((a (lambda (n) (+ 1 n))) (b 3)) (a b))   ;;; does NOT work in emacs
>
> > basically we are trying to use / abuse the let in that in the pair we
> > define a equal to a lambda. Then another pair where a value of b is
> > defined.
>
> > next, we want a to operate on b.
>
> > Why does it fail ?
>
> > The scheme/lisp book/paper where it was seen (forgot) used letrec.
>
> > Can someone enlighten me how set! and let can be used to formulate
> > recursion when the let has no recursion built in it ?
>
> > thanks a lot.
> > cheers

The following works where I have replaced the association of lambda to
a  _by_  the association of lambda function call to a, ie a numerical
value.

(let
((a ((lambda (n) (+ 1 n)) 5))
 (b 3))
(+ a b))

I am sure I am making some trivial mistake


  reply	other threads:[~2010-06-10  6:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10  5:34 lambda inside a let or letrec bolega
2010-06-10  5:37 ` bolega
2010-06-10  6:18   ` bolega [this message]
2010-06-10  5:37 ` bolega
2010-06-10  7:22 ` Helmut Eller
2010-06-10 14:28 ` Pascal J. Bourguignon
2010-06-11  0:42 ` bolega

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571723a4-e5b3-403a-b856-fb377ee68c73@c10g2000yqi.googlegroups.com \
    --to=gnuist006@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).