Re: Swimming against the tide, again (this time with numbers)
Hi Christophe, > > it doesn't have to be always 1.0. If it was, it would not need to be > > there at all. > > Oops. Could you give me some details about my mistake? > Isn't «1.0» always read as «10^(*Scl)» which is what I'd call the scale > factor? Yes, but *Scl is concerned only in the reader, when expanding the quasi-read-macro '.'. Other parts of the program may well use another scale, independent of '*Scl'. For example, each '+FixField' in the GUI knows about its own private scale factor. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Swimming against the tide, again (this time with numbers)
On Tue, Sep 2, 2014 at 8:14 PM, Tomas Hlavaty wrote: >> >> «…by multiplying with (or dividing by) the scale factor, which is always >> `1.0`.» > > it doesn't have to be always 1.0. If it was, it would not need to be > there at all. Oops. Could you give me some details about my mistake? Isn't «1.0» always read as «10^(*Scl)» which is what I'd call the scale factor? Thanks for your explanations and warnings. chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg http://microalg.info -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Swimming against the tide, again (this time with numbers)
Hi Christophe, > Christophe Gragnic writes: > is my suggestion: > «…by multiplying with (or dividing by) the scale factor.» > could become > «…by multiplying with (or dividing by) the scale factor, which is always > `1.0`.» it doesn't have to be always 1.0. If it was, it would not need to be there at all. Cheers, Tomas -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Swimming against the tide, again (this time with numbers)
Hi all, On Mon, Sep 1, 2014 at 6:05 AM, Tomas Hlavaty wrote: >> : (* 1.0 1.0) >> -> 100 > > You want: (*/ 1.0 1.0 1.0), see http://software-lab.de/doc/ref_.html#*/ That's funny because I read about */ right before posting my email but couldn't connect with my problem. If there is room for clarification, here is my suggestion: «…by multiplying with (or dividing by) the scale factor.» could become «…by multiplying with (or dividing by) the scale factor, which is always `1.0`.» Suggested examples: : (scl 1) -> 1 : 1.0 -> 10 : (* 1.0 1.0) -> 100 : (*/ 1.0 1.0 1.0) -> 10 On Mon, Sep 1, 2014 at 6:23 AM, Alexander Burger wrote: > > The solution would be to extend the internal representation of numbers, > e.g. with an additional bit to distinguish between non-scaled and scaled > integers. I guess that you don't plan to alter PicoLisp this way. And there is no magic way to alter the reader, or from Lisp? > In fact, I would not try to explain it with these examples, but > work _only_ with scaled integers first. Should be no problem for > you as a math teacher. > And then explain that the dot is just a read macro, not part of > the language machinery per se. My strategy for now is to only work with integers first, even with /. Then explain that if decimals are needed, a scale must be choosen, and numbers must be entered with a dot, or they will be read as tenths for a scale of 1, millionths for a scale of 6… I'll try to show, for a scale of 1, «1» instead of «10» using 'format cleverly. chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg http://microalg.info -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Swimming against the tide, again (this time with numbers)
Hi Christophe, > Now I have another similar problem with numbers. > First, I understand the reasons behind having fixpoint numbers > ... > : (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. In fact, I would not try to explain it with these examples, but work _only_ with scaled integers first. Should be no problem for you as a math teacher. And then explain that the dot is just a read macro, not part of the language machinery per se. > 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. The solution would be to extend the internal representation of numbers, e.g. with an additional bit to distinguish between non-scaled and scaled integers. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Swimming against the tide, again (this time with numbers)
Hi Christophe, > Christophe Gragnic writes: > : (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. this is a picolisp feature. See http://software-lab.de/doc/ref.html#num-io Formatted output of scaled fixpoint values can be done with the format and round functions: picolisp has integers only. It has no way of distinguishing what is an integer and what is a "floating point number" because there are only integers. All this stuff with 'scl' and *Scl is just a convenience hook into the reader to deal with numbers which have '.' character in it and transform it into an integer as if it was a fixed point number. > : (* 1.0 1.0) > -> 100 You want: (*/ 1.0 1.0 1.0), see http://software-lab.de/doc/ref_.html#*/ Cheers, Tomas -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe