From: Karol Skocik
Subject: 2 cl-containers problems
Date: 
Message-ID: <1139142419.182040.161630@g43g2000cwa.googlegroups.com>
Hi,
  I want to ask some lispers whether they played with cl-containers,
and whether everything was working fine for them. Because I ran into 2
problems :

The big problem :
When I want to use heap-container, and want to insert new item :

CL-USER> (defvar *heap* (make-instance 'cl-containers:heap-container))
*HEAP*
CL-USER> (cl-containers:insert-new-item *heap* 10)
Control stack guard page temporarily disabled: proceed with caution

In the debugger :
Control stack exhausted (no more space for function call frames).  This
is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.
   [Condition of type SB-KERNEL::CONTROL-STACK-EXHAUSTED]

Restarts:
  0: [ABORT-REQUEST] Abort handling SLIME request.
  1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread"
{B100459}>)

Backtrace:
  0: (SB-KERNEL::CONTROL-STACK-EXHAUSTED-ERROR)
  1: ("foreign function: call_into_lisp")
  2: ("foreign function: post_signal_tramp")
  3: (SB-PCL::CHECK-APPLICABLE-KEYWORDS 0 -309154813 2)
  4: ("foreign function: #x0")
  5: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL.
SB-PCL::.ARG0. SB-PCL::.ARG1. SB-PCL::.DFUN-REST-ARG.)) #<error
printing object>)
  6: ((SB-PCL::FAST-METHOD METABANG.CL-CONTAINERS:INSERT-ITEM
(METABANG.CL-CONTAINERS:HEAP-CONTAINER T)) #<error printing object>)
  7: ((SB-PCL::FAST-METHOD METABANG.CL-CONTAINERS:INSERT-ITEM
(METABANG.CL-CONTAINERS:CONTAINER-USES-NODES-MIXIN T)) #<error printing
object>)
  8: ((SB-PCL::FAST-METHOD METABANG.CL-CONTAINERS:INSERT-ITEM
(METABANG.CL-CONTAINERS:HEAP-CONTAINER T)) #<error printing object>)
  9: ((SB-PCL::FAST-METHOD METABANG.CL-CONTAINERS:INSERT-ITEM
(METABANG.CL-CONTAINERS:CONTAINER-USES-NODES-MIXIN T)) #<error printing
object>)

calls like 8 a 9 are repeating and repeating and repeating....

when I use (cl-containers:insert-item *heap* 10) instead, the result is
the same...

The small problem now : when I want to use just cl-containers, I think
that this is right ok? :
CL-USER> (asdf:oos 'asdf:load-op :cl-containers)

after messages like this :

; loading system definition from
; /usr/local/lib/sbcl/site-systems/cl-containers.asd into #<PACKAGE
"ASDF1245">
; loading system definition from
; /usr/local/lib/sbcl/site-systems/asdf-system-connections.asd into
; #<PACKAGE "ASDF1246">
; registering #<SYSTEM ASDF-SYSTEM-CONNECTIONS {B3744E1}> as
; ASDF-SYSTEM-CONNECTIONS

I land in debugger :

The name "ASDF-CL-GRAPH" does not designate any package.
   [Condition of type SB-KERNEL:SIMPLE-PACKAGE-ERROR]

Restarts:
  0: [RETRY] Retry performing #<ASDF:LOAD-OP NIL {B3985B9}> on
#<ASDF:CL-SOURCE-FILE "asdf-system-connections" {B386E71}>.
  1: [ACCEPT] Continue, treating #<ASDF:LOAD-OP NIL {B3985B9}> on
#<ASDF:CL-SOURCE-FILE "asdf-system-connections" {B386E71}> as having
been successful.
  2: [ABORT-REQUEST] Abort handling SLIME request.
  3: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread"
{B100459}>)

Backtrace:
  0: (SB-INT:%FIND-PACKAGE-OR-LOSE "ASDF-CL-GRAPH")
  1: (SB-INT:FIND-UNDELETED-PACKAGE-OR-LOSE "ASDF-CL-GRAPH")
  2: (SB-FASL::FOP-PACKAGE)
  3: (SB-FASL::LOAD-FASL-GROUP #<SB-SYS:FD-STREAM for "file
/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
{B3AD8F1}>)
  4: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file
/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
{B3AD8F1}> NIL #<unavailable argument>)
  5: (SB-FASL::INTERNAL-LOAD
#P"/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
#P"/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
:ERROR NIL NIL :BINARY NIL)
  6: (SB-FASL::INTERNAL-LOAD
#P"/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
#P"/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl"
:ERROR NIL NIL NIL :DEFAULT)
  7: (LOAD
#P"/usr/local/lib/sbcl/site/asdf-system-connections/dev/asdf-system-connections.fasl")

Why is this so? Can I use cl-containers without loading cl-graph? The
only way how it works now is loading cl-graph, which loads also
cl-containers.

Thanks for any ideas,
  Karol

From: karsten
Subject: Re: 2 cl-containers problems
Date: 
Message-ID: <1139160261.455126.86360@g44g2000cwa.googlegroups.com>
I might be wrong, but I think the following code is incorrect:
(defmethod insert-item ((container container-uses-nodes-mixin) (item
t))
  (let ((node (make-node-for-container container item)))
    (values (insert-item container node)
            node)))
Seems like a direct recursion, so one gets a stac overflow.
Substituting the insert-item with call-next-method works for me.
(defmethod insert-item ((container container-uses-nodes-mixin) (item
t))
  (let ((node (make-node-for-container container item)))
    (values (call-next-method container node)
            node)))

Karsten
From: Gary King
Subject: Re: 2 cl-containers problems
Date: 
Message-ID: <2006021010063375249%gwking@metabangcom>
On 2006-02-05 12:24:21 -0500, "karsten" <·············@gmail.com> said:

> I might be wrong, but I think the following code is incorrect:
> (defmethod insert-item ((container container-uses-nodes-mixin) (item
> t))
>   (let ((node (make-node-for-container container item)))
>     (values (insert-item container node)
>             node)))

Hi,

This isn't a direct recursion because the inner insert is inserting a 
node into the container, not an item. However, there were several bugs 
in the heap code (due to software rot, I'm afraid) that are now 
corrected and will shortly be available via Darcs, tarball and 
ASDF-Install.

 thanks,
--�
Gary Warren King
metabang.com
http://www.metabang.com/