Commit ac823344 authored by Stephane Glondu's avatar Stephane Glondu

Question.neutral_shape returns an option

parent 1f5934ab
......@@ -83,9 +83,11 @@ module Make (W : ELECTION_DATA) (M : RANDOM) = struct
}
let neutral_ciphertext () =
Array.map (fun q ->
Array.map (fun () -> dummy_ciphertext) (Question.neutral_shape q)
) election.e_params.e_questions
Array.map Question.neutral_shape election.e_params.e_questions
|> Array.map (Option.map (Array.map (fun () -> dummy_ciphertext)))
|> Array.to_list
|> List.filter_map (fun x -> x)
|> Array.of_list
let combine_ciphertexts = Array.mmap2 eg_combine
......
......@@ -29,7 +29,7 @@ let read_question l b = Standard (Question_std_j.read_question l b)
let write_question b (Standard q) = Question_std_j.write_question b q
let neutral_shape = function
| Standard q -> Array.make (Question_std.question_length q) ()
| Standard q -> Some (Array.make (Question_std.question_length q) ())
let erase_question = function
| Standard q ->
......
......@@ -28,7 +28,7 @@ type question =
val read_question : Yojson.Safe.lexer_state -> Lexing.lexbuf -> question
val write_question : Bi_outbuf.t -> question -> unit
val neutral_shape : question -> unit array
val neutral_shape : question -> unit array option
val erase_question : question -> question
module type S = sig
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment