Re: [Chicken-users] Trouble loading source file in csi
On Sat, Aug 25, 2012 at 02:47:33PM -0600, Matt Gushee wrote: I am developing a chicken library, and attempting to perform some rudimentary tests in csi as I go. However, when I try to load the file (load text-menu.scm) I get the following error: : ; loading text-menu.scm ... : :Error: history entry index out of range: 0 Apparently the problem was that I wrote '#' instead of '#f' in a couple of places. So the REPL did right to catch my error. I'd still be interested to know why the file would load without error (and seemingly function normally) Hi Matt, The reason it accepts this is that #n is special reader syntax in the interpreter which means give me the nth expression's result value. Example: $ csi -q #;1 (+ 1 2) 3 #;2 (+ #1 7) 10 #;3 (+ #2 2) 12 So it's the number printed in the prompt, which can always be used to recall the result value of the expression typed at that particular prompt. (this is also why the number doesn't increase when the expression causes an error -- it never returned anything, so the prompt's numbered expression got no value) A lone hash in Chicken seems to return the previous expression's value (I didn't know about this either): #;4 # 12 This is of course also documented. See http://wiki.call-cc.org/man/4/Using%20the%20interpreter#history-access for more info. I hope this clarifies this strange behaviour :) Cheers, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Trouble loading source file in csi
Hi, people-- I am developing a chicken library, and attempting to perform some rudimentary tests in csi as I go. However, when I try to load the file (load text-menu.scm) I get the following error: : ; loading text-menu.scm ... : :Error: history entry index out of range: 0 : :Call history: ... followed by a traceback whose specific contents depend on the current state of the source code. But I always get history entry index out of range. However, if I type a (use ...) declaration (it does not seem to matter what library I am use-ing), then the error goes away for the remainder of the csi session. I am using Chicken 4.7.0 on Linux. I tried commenting out everything in my .csirc, and it didn't seem to make any difference. So ... any idea what is going on here? If this is just a quirk of CSI behavior, then it doesn't really matter, since this code is intended to become an egg, so it will normally be compiled. Still, it's rather annoying, at least. Thanks for any clues, -- Matt Gushee ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Trouble loading source file in csi
Ha-ha. Whoops! On Sat, Aug 25, 2012 at 1:45 PM, Matt Gushee m...@gushee.net wrote: I am developing a chicken library, and attempting to perform some rudimentary tests in csi as I go. However, when I try to load the file (load text-menu.scm) I get the following error: : ; loading text-menu.scm ... : :Error: history entry index out of range: 0 Apparently the problem was that I wrote '#' instead of '#f' in a couple of places. So the REPL did right to catch my error. I'd still be interested to know why the file would load without error (and seemingly function normally) after the calls to USE (which, by the way, have to be entered manually at the prompt--I have several USEs in my .csirc, and they didn't allow the file to load). -- Matt Gushee ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users