Skip to content

Commit

Permalink
Replace some _otherwise occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmendez committed Jan 31, 2024
1 parent 17c1fcd commit ad08ef4
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ trait SegmentsForFlight
def rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] )
(last_airport : String) : Seq [Segment] =
intermediate_stops match {
case head :: tail => (rec_segments_multi (head) (tail) (last_airport) ) .+: (
case Nil => Nil .+: (Segment_ (first_airport , last_airport) )
case head +: tail => (rec_segments_multi (head) (tail) (last_airport) ) .+: (
Segment_ (first_airport , head) )
case _otherwise => Nil .+: (Segment_ (first_airport , last_airport) )
}

lazy val segments : Seq [Segment] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class SegmentsForFlight
rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] )
(last_airport : String) : Seq [Segment] =
match intermediate_stops
case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (
case Nil ==> Nil .+: (Segment_ (first_airport , last_airport) )
case head +: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (
Segment_ (first_airport , head) )
case _otherwise ==> Nil .+: (Segment_ (first_airport , last_airport) )

segments : Seq [Segment] =
rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (
Expand Down
2 changes: 1 addition & 1 deletion examples/src/main/scala/soda/example/forcoq/lib/List.soda
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class SeqList
@tailrec
_tailrec_from_Seq [A : Type] (a : Seq [A] ) (b : list [A] ) : list [A] =
match a
case Nil ==> b
case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e , b) )
case _otherwise ==> b

from_Seq [A : Type] (a : Seq [A] ) : list [A] =
reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ trait SeqList
@tailrec final
private def _tailrec_from_Seq [A ] (a : Seq [A] ) (b : list [A] ) : list [A] =
a match {
case Nil => b
case (e) :: (s) => _tailrec_from_Seq (s) (cons_ (e , b) )
case _otherwise => b
}

def from_Seq [A ] (a : Seq [A] ) : list [A] =
Expand Down
2 changes: 1 addition & 1 deletion translator/src/main/resources/lib/soda/lib/OptionSD.soda
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class OptionSDBuilder [A : Type]
build (option : Option [A] ) : OptionSD [A] =
match option
case Some (content) ==> SomeSD_ [A] (content)
case _otherwise ==> NoneSD_ [A] ()
case None ==> NoneSD_ [A] ()

end

2 changes: 1 addition & 1 deletion translator/src/main/resources/lib/soda/lib/Package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ trait OptionSDBuilder [A ]
def build (option : Option [A] ) : OptionSD [A] =
option match {
case Some (content) => SomeSD_ [A] (content)
case _otherwise => NoneSD_ [A] ()
case None => NoneSD_ [A] ()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Manual
if_then_else [A : Type] (condition : Boolean) (if_true : A) (if_false : A) : A =
match condition
case true ==> if_true
case _otherwise ==> if_false
case false ==> if_false

/* A constant or function name starting with underscore indicates that the constant or
* function is private, and therefore is not visible outside the class. */
Expand Down
2 changes: 1 addition & 1 deletion translator/src/main/scala/soda/lib/OptionSD.soda
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ class OptionSDBuilder [A : Type]
build (option : Option [A] ) : OptionSD [A] =
match option
case Some (content) ==> SomeSD_ [A] (content)
case _otherwise ==> NoneSD_ [A] ()
case None ==> NoneSD_ [A] ()

end
2 changes: 1 addition & 1 deletion translator/src/main/scala/soda/lib/Package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ trait OptionSDBuilder [A ]
def build (option : Option [A] ) : OptionSD [A] =
option match {
case Some (content) => SomeSD_ [A] (content)
case _otherwise => NoneSD_ [A] ()
case None => NoneSD_ [A] ()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class DirectiveBlockTranslator

_get_first_or_empty (sequence : Seq [String] ) : String =
match sequence
case x :: xs ==> x
case _otherwise ==> ""
case x +: xs ==> x
case Nil ==> ""

_remove_first_if_possible (sequence : Seq [String] ) : Seq [String] =
match sequence
case x :: xs ==> xs
case _otherwise ==> sequence
case x +: xs ==> xs
case Nil ==> sequence

_comment_block_out (lines : Seq [String] ) : Seq [String] =
Seq (opening_comment) .++ (lines .++ (Seq (closing_comment) ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ trait DirectiveBlockTranslator

private def _get_first_or_empty (sequence : Seq [String] ) : String =
sequence match {
case x :: xs => x
case _otherwise => ""
case x +: xs => x
case Nil => ""
}

private def _remove_first_if_possible (sequence : Seq [String] ) : Seq [String] =
sequence match {
case x :: xs => xs
case _otherwise => sequence
case x +: xs => xs
case Nil => sequence
}

private def _comment_block_out (lines : Seq [String] ) : Seq [String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DirectoryScanner
_list_files_with (files : Option [Array [File] ] ) : Seq [File] =
match files
case Some (array) ==> array .toSeq
case _otherwise ==> Seq ()
case None ==> Seq ()

_list_files (to_scan_head : File) : Seq [File] =
_list_files_with (Option (to_scan_head .listFiles) )
Expand Down
2 changes: 1 addition & 1 deletion translator/src/main/scala/soda/translator/io/Package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ trait DirectoryScanner
private def _list_files_with (files : Option [Array [File] ] ) : Seq [File] =
files match {
case Some (array) => array .toSeq
case _otherwise => Seq ()
case None => Seq ()
}

private def _list_files (to_scan_head : File) : Seq [File] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DirectiveBlockAnnotation

_get_first_line_or_empty (annotated_lines : Seq [AnnotatedLine] ) : String =
match annotated_lines
case x :: xs ==> x .line
case _otherwise ==> ""
case x +: xs ==> x .line
case Nil ==> ""

applies : Boolean =
(_get_first_line_or_empty (block .readable_lines) .trim + _sc .space)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ trait DirectiveBlockAnnotation

private def _get_first_line_or_empty (annotated_lines : Seq [AnnotatedLine] ) : String =
annotated_lines match {
case x :: xs => x .line
case _otherwise => ""
case x +: xs => x .line
case Nil => ""
}

lazy val applies : Boolean =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ trait Manual
def if_then_else [A ] (condition : Boolean) (if_true : A) (if_false : A) : A =
condition match {
case true => if_true
case _otherwise => if_false
case false => if_false
}

/* A constant or function name starting with underscore indicates that the constant or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Manual
if_then_else [A : Type] (condition : Boolean) (if_true : A) (if_false : A) : A =
match condition
case true ==> if_true
case _otherwise ==> if_false
case false ==> if_false

/* A constant or function name starting with underscore indicates that the constant or
* function is private, and therefore is not visible outside the class. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@
if_then_else [A : Type] (condition : Boolean) (if_true : A) (if_false : A) : A =
match condition
case true ==> if_true
case _otherwise ==> if_false
case false ==> if_false


\end{lstlisting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class SegmentsForFlight
rec_segments_multi (first_airport : String) (intermediate_stops : Seq [String] )
(last_airport : String) : Seq [Segment] =
match intermediate_stops
case head :: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (
case Nil ==> Nil .+: (Segment_ (first_airport , last_airport) )
case head +: tail ==> (rec_segments_multi (head) (tail) (last_airport) ) .+: (
Segment_ (first_airport , head) )
case _otherwise ==> Nil .+: (Segment_ (first_airport , last_airport) )

segments : Seq [Segment] =
rec_segments_multi (flight .start_airport) (flight .intermediate_airports) (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class SeqList
@tailrec
_tailrec_from_Seq [A : Type] (a : Seq [A] ) (b : list [A] ) : list [A] =
match a
case Nil ==> b
case (e) :: (s) ==> _tailrec_from_Seq (s) (cons_ (e , b) )
case _otherwise ==> b

from_Seq [A : Type] (a : Seq [A] ) : list [A] =
reverse (_tailrec_from_Seq (a) (nil_ [A] () ) )
Expand Down

0 comments on commit ad08ef4

Please sign in to comment.