Re: Scheme 48 Eclipse IDE

Christian Jaeger <[email protected]> Fri, 28 Nov 2014 18:58:40 +0100
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <CAEjYwfXXs5TLUr0OOb9EsxvKky4sDD9ycOBjyc8m6kHxOEMS5A@mail.gmail.com>
--001a11c21a2cf73c6a0508ef035d
Content-Type: text/plain; charset=UTF-8

2014-11-28 8:39 GMT+01:00 Alexander Weickmann <[email protected]
>:

> 1) Division results are represented as something like 23987732742983723
> / 23048329048320843 instead of 123.456, which is very unreadable and
> requires you to copy and paste the values into a calculator
>

This is how exact numbers (rational numbers) are printed as requested by
the Scheme standard, not the IDE. It's often a nice feature :). If you want
a floating point number, pass it to the exact->inexact function, or add a
decimal dot to one of the relevant inputs of your calculation so as to make
it (and thus also the result) inexact.

If you want to use Scheme as a calculator and don't want to type out
exact->inexact for every expression, alias it to a simpler name, or write
your own read-eval-print loop, for example,

(let lp ()
  (display ">. ")
  (write (let ((v (eval (read))))
    (if (and (number? v) (not (integer? v)))
         (exact->inexact v)
         v)))
  (newline)
  (lp))

(I haven't tested this on S48 nor Eclipse, though. It works fine with
inferior Scheme mode in Emacs since line editing is provided by Emacs and
thus still works with |read|.)

I'm not using Eclipse so don't know about your second question.

Ch.

--001a11c21a2cf73c6a0508ef035d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
2014-11-28 8:39 GMT+01:00 Alexander Weickmann <span dir=3D"ltr">&lt;<a href=
=3D"mailto:[email protected]" target=3D"_blank">alexander.weick=
[email protected]</a>&gt;</span>:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20=
4,204,204);border-left-style:solid;padding-left:1ex"><div id=3D":pl" class=
=3D"" style=3D"overflow:hidden">1) Division results are represented as some=
thing like 23987732742983723<br>
/ 23048329048320843 instead of 123.456, which is very unreadable and<br>
requires you to copy and paste the values into a calculator<br></div></bloc=
kquote></div><br>This is how exact numbers (rational numbers) are printed a=
s requested by the Scheme standard, not the IDE. It&#39;s often a nice feat=
ure :). If you want a floating point number, pass it to the exact-&gt;inexa=
ct function, or add a decimal dot to one of the relevant inputs of your cal=
culation so as to make it (and thus also the result) inexact.</div><div cla=
ss=3D"gmail_extra"><br></div><div class=3D"gmail_extra">If you want to use =
Scheme as a calculator and don&#39;t want to type out exact-&gt;inexact for=
 every expression, alias it to a simpler name, or write your own read-eval-=
print loop, for example,=C2=A0</div><div class=3D"gmail_extra"><br></div><d=
iv class=3D"gmail_extra"><div class=3D"gmail_extra">(let lp ()</div><div cl=
ass=3D"gmail_extra">=C2=A0 (display &quot;&gt;. &quot;)</div><div class=3D"=
gmail_extra">=C2=A0 (write (let ((v (eval (read))))</div><div class=3D"gmai=
l_extra"><span style=3D"white-space:pre">=C2=A0       </span> =C2=A0 (if (a=
nd (number? v) (not (integer? v)))</div><div class=3D"gmail_extra"><span st=
yle=3D"white-space:pre">=C2=A0       </span>=C2=A0 =C2=A0 =C2=A0 =C2=A0(exa=
ct-&gt;inexact v)</div><div class=3D"gmail_extra"><span style=3D"white-spac=
e:pre">=C2=A0       </span>=C2=A0 =C2=A0 =C2=A0 =C2=A0v)))</div><div class=
=3D"gmail_extra">=C2=A0 (newline)</div><div class=3D"gmail_extra">=C2=A0 (l=
p))</div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">(I=
 haven&#39;t tested this on S48 nor Eclipse, though. It works fine with inf=
erior Scheme mode in Emacs since line editing is provided by Emacs and thus=
 still works with |read|.)</div><div class=3D"gmail_extra"><br></div><div c=
lass=3D"gmail_extra">I&#39;m not using Eclipse so don&#39;t know about your=
 second question.<br></div><div class=3D"gmail_extra"><br></div><div class=
=3D"gmail_extra">Ch.<br></div></div></div>

--001a11c21a2cf73c6a0508ef035d--