Hi all crazy Lispers!

I managed to handle "" being NIL, thanks to Michel and Alex.
Now I have another similar problem with numbers.
First, I understand the reasons behind having fixpoint numbers
in Picolisp (basically simple implementation and control).
Now considering that my goal is to implement a *simple* language
(no tricks no traps), I'm a bit stuck with the following behaviors:

: (scl 1)  # just for some examples to show
-> 1
: 1
-> 1
: 1.0
-> 10
: (* 1.0 1.0)
-> 100
: (+ 1 1.0)
-> 11

It's is just impossible for a teacher to explain this to a newbie
without being considered a fool. PicoLisp being cool nonetheless.

So I'm looking for workarounds. I thought about two.

The first is a plain Lisp solution, but I would need to hijack the
READer to avoid 1 and 1.0 being different as soon as *Scl > 0.
As for "" and NIL, I think I could handle displaying the results.

The second is inspired by EmuLisp, which does not implement fixpoint
numbers but uses JS numbers instead. In the beginning,
I thought about implementing fixpoint numbers in EmuLisp,
but maybe the contrary would be easier to achieve my goal:
numbers a newbie can use, may it be floating point.

So I have two questions:
1) can we hijack the READer (from Lisp preferably) to implement
a custom numbers reading?
2) is there a magic hidden switch for Ersatz to use Java's ints
when a number is read as an int, and Java's floats when a
number has a dot? (ok, nice dream, try again…)


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to