From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77921 invoked by alias); 15 Sep 2017 12:48:51 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 77086 invoked by uid 89); 15 Sep 2017 12:48:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f172.google.com Received: from mail-wr0-f172.google.com (HELO mail-wr0-f172.google.com) (209.85.128.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 12:48:49 +0000 Received: by mail-wr0-f172.google.com with SMTP id c23so1732448wrg.9 for ; Fri, 15 Sep 2017 05:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=dUuU/jZMXkv66P5z9aSsa7ZEYWhkYMsgL0ggJvPgqmQ=; b=iAb5dJIrsAtqz869Yoz53xFdwa/qSwQ1zGwsUtCj2Tsy0oS8t6cEZMIDkc1o+P8KGG x8f5q5jCKItETEc9xibKC2TlxehSKvzf5LEGYuu5EdxCIF6V05dTNcCWOJtSv9fILezh GUd63/LVDPF1T3fnQxVWmMm3SQD9WboFTGRSyFkJGQDPVlQD/E+69TwlG6nNilHdFE1p 9B6YiLgMiPfpb3gL3U3x4a4BDv25Mde2NPW3CUC7Vfpxcj4CzKyBjsFde0zMXYegTQxm P1jTiKy30N5tlyBtO+ptPAkMzHm7qnCyQuTdmPb7g094P5Y930qW/HV9lexnsD3kIjGK pm3A== X-Gm-Message-State: AHPjjUhsQiArgibg1lUIdm0kcSG34v2POhwAbvgSGZBp1lwBkbxE6g6u Rq+z/yUpI9liNLFuv3y2kRUcsT8EmOBUpsMXYmFNGpS7 X-Google-Smtp-Source: AOwi7QCo8MG9t3RWEO1LMiPtrbLwD5AYMueUeE2p5zRtLFb+JK71GSqhS29XBDyeoh15EUjaXmUbgcmiRgf7bYtBgig= X-Received: by 10.223.199.196 with SMTP id y4mr11815665wrg.181.1505479727144; Fri, 15 Sep 2017 05:48:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.200.2 with HTTP; Fri, 15 Sep 2017 05:48:46 -0700 (PDT) In-Reply-To: References: <7ebc09b0-2243-a1c0-4da2-d4f0fb73827e@bothner.com> From: Sonny To Date: Fri, 15 Sep 2017 12:48:00 -0000 Message-ID: Subject: Re: putting symbols into Environment To: Per Bothner , Kawa mailing list Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00042.txt.bz2 How close does kawa stick to standard scheme? I'm trying these functions described here https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Environment-Operations.html and none of work #|kawa:5|# (define e (environment)) #|kawa:6|# (environment-bindings e) /dev/stdin:6:2: unbound location: environment-bindings at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163) at gnu.expr.Expression.applyMethodExpression(Expression.java:41) at java.lang.reflect.Method.invoke(Native Method) at gnu.mapping.CallContext$ReflectMethodHandle.invokeExact(CallContext.java:726) at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) at gnu.mapping.CallContext.getFromContext(CallContext.java:616) at gnu.expr.Expression.eval(Expression.java:52) at gnu.expr.ApplyExp.apply(ApplyExp.java:161) at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281) at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) at kawa.Shell.run(Shell.java:283) at kawa.Shell.run(Shell.java:196) at kawa.Shell.run(Shell.java:183) at kawa.TelnetRepl.apply0(TelnetRepl.java:25) at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75) at java.lang.Thread.run(Thread.java:764) #|kawa:7|# (environment-bound-names e) /dev/stdin:7:2: unbound location: environment-bound-names at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163) at gnu.expr.Expression.applyMethodExpression(Expression.java:41) at java.lang.reflect.Method.invoke(Native Method) at gnu.mapping.CallContext$ReflectMethodHandle.invokeExact(CallContext.java:726) at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) at gnu.mapping.CallContext.getFromContext(CallContext.java:616) at gnu.expr.Expression.eval(Expression.java:52) at gnu.expr.ApplyExp.apply(ApplyExp.java:161) at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281) at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) at kawa.Shell.run(Shell.java:283) at kawa.Shell.run(Shell.java:196) at kawa.Shell.run(Shell.java:183) at kawa.TelnetRepl.apply0(TelnetRepl.java:25) at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75) at java.lang.Thread.run(Thread.java:764) On Fri, Sep 15, 2017 at 4:48 AM, Sonny To wrote: > Thanks Per. I was looking for a Symbol.makeIntern but didnt find one > and used Symbol.makeUninterned. I was not expecting a Symbol.valueOf > to make an interned symbol. perhaps either rename or add an alias > Symbol.makeIntern? > > In anycase, using Symbol.valueOf still does not make the "context" > symbol available in my repl > > sto@obi:~$ telnet localhost 9999 > Trying 127.0.0.1... > Connected to localhost. > Escape character is '^]'. > #|kawa:1|# context > /dev/stdin:1:1: unbound location: context > at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163) > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281) > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > at kawa.Shell.run(Shell.java:283) > at kawa.Shell.run(Shell.java:196) > at kawa.Shell.run(Shell.java:183) > at kawa.TelnetRepl.apply0(TelnetRepl.java:25) > at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75) > at java.lang.Thread.run(Thread.java:764) > > any other ideas? I suspect its because I have the wrong Environment > > On Wed, Sep 13, 2017 at 5:28 PM, Per Bothner wrote: >> On 09/13/2017 05:05 PM, Sonny To wrote: >>> >>> I'm trying to use the TelnetRepl in an android Service but cannot >>> figure out how to put bindings into the environment >> >> >>> env.put(Symbol.makeUninterned("context", null), >>> applicationContext) >> >> >>> I can telnet to it but the "context" symbol is not available >>> >>> #|kawa:4|# context >>> /dev/stdin:4:1: unbound location: context >> >> >> That would be expected if you use Symbol.makeUninterned. >> An uninterned symbol is a unique object that you can *not* >> "lookup". For example (string->symbol "context") is the >> same as 'symbol - but (Symbol:makeUninterned "context") is a completely >> different object. >> >> Instead, try Symbol.valueOf("context"). >> >>> Do I have the wrong environment? if so how to get the correct environment? >> >> >> There might be other problems, but fix the above-mentioned problem first. >> -- >> --Per Bothner >> per@bothner.com http://per.bothner.com/