Skip to content

crash : Invalid_argument("List.iter2") #9

@Kakadu

Description

@Kakadu
Fatal error: exception Invalid_argument("List.iter2")
Raised at Stdlib.invalid_arg in file "stdlib.ml" (inlined), line 30, characters 20-45
Called from Stdlib__List.iter2 in file "list.ml", line 148, characters 14-38
Called from Iter.fold in file "src/Iter.ml", line 77, characters 2-32
Called from Iter.map.(fun) in file "src/Iter.ml", line 104, characters 43-48
Called from CCVector.iter in file "src/core/CCVector.pp.ml", line 344, characters 4-30
Called from Stdlib__Hashtbl.iter.do_bucket in file "hashtbl.ml" (inlined), line 159, characters 8-18
Called from Stdlib__Hashtbl.iter in file "hashtbl.ml", line 165, characters 6-21
Re-raised at Stdlib__Hashtbl.iter in file "hashtbl.ml", line 170, characters 4-13
Called from Stdlib__List.iter in file "list.ml" (inlined), line 110, characters 12-15
Called from Iter.of_list in file "src/Iter.ml" (inlined), line 809, characters 27-40
Called from Ego__Basic.EGraph.apply_rules in file "ego/lib/basic.ml" (inlined), line 426, characters 25-43
Called from Iter.flat_map in file "src/Iter.ml" (inlined), line 135, characters 32-52
Called from Ego__Basic.EGraph.apply_rules in file "ego/lib/basic.ml" (inlined), line 426, characters 25-73
Called from Ego__Basic.EGraph.apply_rules in file "ego/lib/basic.ml" (inlined), line 427, characters 4-130
Called from Ego__Basic.EGraph.apply_rules in file "ego/lib/basic.ml" (inlined), line 426, characters 25-73
Called from Ego__Basic.EGraph.apply_rules in file "ego/lib/basic.ml", line 427, characters 4-130
Called from Dune__exe__Demo1 in file "bin/eog_demo/demo1.ml", line 36, characters 4-469

Commenting out _cubes solves the issue

open Ego.Basic

[@@@ocaml.warnerror "-27-33-11"]

open Sexplib0.Sexp

let () =
  let graph = EGraph.init () in
  let _squares =
    EGraph.add_sexp
      graph
      (let open Sexplib0.Sexp in
       List
         [ Atom "+"
         ; List [ Atom "*"; Atom "a"; Atom "a" ]
         ; List [ Atom "*"; Atom "b"; Atom "b" ]
         ; List [ Atom "*"; Atom "2"; Atom "a"; Atom "b" ]
         ])
  in
  let _cubes =
    EGraph.add_sexp
      graph
      (let open Sexplib0.Sexp in
       List
         [ Atom "+"
         ; List [ Atom "*"; Atom "a"; Atom "a"; Atom "a" ]
         ; List [ Atom "*"; Atom "b"; Atom "b"; Atom "b" ]
         ; List [ Atom "*"; Atom "3"; Atom "a"; Atom "b"; Atom "b" ]
         ; List [ Atom "*"; Atom "3"; Atom "a"; Atom "a"; Atom "b" ]
         ])
  in
  let () =
    let mk ~from into =
      Rule.make ~from:(Query.of_sexp from) ~into:(Query.of_sexp into) |> Option.get
    in
    EGraph.apply_rules
      graph
      [ mk
          ~from:
            (List
               [ Atom "+"
               ; List [ Atom "*"; Atom "a"; Atom "a" ]
               ; List [ Atom "*"; Atom "b"; Atom "b" ]
               ; List [ Atom "*"; Atom "2"; Atom "a"; Atom "b" ]
               ])
          (List
             [ Atom "*"
             ; List [ Atom "+"; Atom "a"; Atom "b" ]
             ; List [ Atom "+"; Atom "a"; Atom "b" ]
             ])
      ]
  in
  exit 0
;;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions