Thanks Christian, On Wednesday, March 16, 2011 02:13:22 AM Christian Kellermann wrote: > Hi Conor! > > * Conor Beverland <[email protected]> [110316 03:25]: > > I'm using Chicken 4.6.0, the slime egg (at version 1.0 I believe) and a > > version of slime itself checked out from CVS on 2011-02-24. > > > > It's been working great for me and I've been using C-c C-l to load files > > without any issue. Just now I copied and pasted some additional code from > > http://mitpress.mit.edu/sicp/code/ch2.scm into an existing file that was > > working OK. > > > > My resulting file is here: http://paste.lisp.org/display/120550 > > > > If I run csi on the command line then (load "thatfilefromthepaste.scm") > > works fine. > > > > If I use C-c C-l within chicken-slime to do the same then I do not > > immediately see an error but nor do I see the "t" in the message buffer > > that I normally do. If I switch to the repl and try to invoke anything > > that was defined in the file I see a message like this: '"; pipelined > > request... (swank:listener-eval "ca'. > > Yes something is wrong here. Can you reduce the code by binary > search and omitting parts? If you can get it down to a smaller test > case I will be gladly debug it further. But to be honest, I have > no clue what should be going on in your code :) > > Thanks! > > Christian
I've stripped the code down significantly (and left a little bit in comments so you can see the context somewhat). It's here: http://paste.lisp.org/display/120567 The line that seems to cause the issue is 69 - (define (imag-part z) (apply- generic 'imag-part z)) It's odd because there are very similar (currently commented) lines around it which do not cause any problem if uncommented. Something about the imag-part definition does. You may not need any further information to debug the issue but if you want some background: It's from chapters 2.4 and 2.5 of the SICP book which is explained much better than I can in the lecture from the author viewable here: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001- structure-and-interpretation-of-computer-programs-spring-2005/video- lectures/4b-generic-operators/ It's about designing systems with generic operators in which for instance your "add-complex-number" procedure works whether the underlying representation of a complex number is rectangular or polar and your "add" procedure doesn't care if the things it is adding are integers, rational numbers, polynomials or complex numbers (which themselves may be rectangular or polar) and so on. The method used is basically to "tag" data objects with a symbol describing the type of the object such as 'rectangular, 'rational, 'complex etc. Type "packages" such as (install-rectangular-package) then define procedures that work on their particular type and install them into a table using "put" (with arguments - operation name, list of types of the arguments and the procedure itself). Generic operations such as "imag-part" (which should work whether the underlying representation of the complex number is rectangular or polar or something else) then use the "apply-generic" procedure to find the right procedure in the operations table for the given arguments. Thanks, Conor _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
