Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubblesort #2

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open

Bubblesort #2

wants to merge 46 commits into from

Conversation

raoulb
Copy link

@raoulb raoulb commented Oct 26, 2012

This PR contains:

  • Generic implementation of merge sort algorithm
  • Versions of bubble, insertion and merge sort algorithm that count the number of elementary transpositions done during sorting.

hebisch and others added 30 commits May 2, 2014 21:39
git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1749 b0c55286-4f34-0410-a049-a1e7e93b0762
See message "unescaped underscore" on fricas-devel (15-Apr-2014).
https://groups.google.com/d/msg/fricas-devel/lCgu8gvVOIM/T2-HyrnpsXcJ

Underscores should be escaped by a backslash like this: \_.
These are the problems that are resolved by this patch.

(5) -> )set output algebra off
(5) -> )set output tex on
(5) -> escape()

$$
_
\leqno(5)
$$

(6) -> 1.2345678901234567890123

$$
1.2345678901_23456789
\leqno(6)
$$

(1) -> "a_b_"\"

   (1)  "a_b"\"
$$
\mbox{\tt "a_b"\"}
\leqno(1)
$$

After the patch.

(1) -> )set output algebra off
(1) -> )set output tex on
(1) -> escape()

$$
\_
\leqno(1)
$$

(2) -> 1.2345678901234567890123

$$
1.2345678901\_23456789
\leqno(2)
$$

(3) -> "a_b_"\"

$$
\verb#"a_b"\"#
\leqno(3)
$$

git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1766 b0c55286-4f34-0410-a049-a1e7e93b0762
for f in $(find . -type f|grep -v '\.git'|grep -v '\.sh$'|grep -v '\.awk'); do
    sed -i \
        -e 's/\\axiomType{/\\spadtype{/g' \
        -e 's/\\axiomOp{/\\spadop{/g' \
        -e 's/\\axiomOpFrom{/\\spadopFrom{/g' \
        -e 's/\\axiomFun{/\\spadfun{/g' \
        -e 's/\\axiomFunFrom{/\\spadfunFrom{/g' \
        -e 's/\\axiomFunX{/\\spadfunX{/g' \
        -e 's/\\axiomFunFromX{/\\spadfunFromX{/g' \
        -e 's/\\axiomSyntax{/\\spadSyntax{/g' \
        -e 's/\\axiomSig{/\\spadsig{/g' \
        -e 's/\\axiom{/\\spad{/g' \
        -e 's/\\axiomGloss{/\\spadgloss{/g' \
        -e 's/\\axiomGlossSee{/\\spadglossSee{/g' \
        -e 's/\\axiomcommand{/\\spadcommand{/g' \
        -e 's/\\axiomgraph{/\\spadgraph{/g' \
        -e 's/\\\\axiomType\\{/\\\\spadtype\\{/g' \
        -e 's/\\\\axiomcommand\\{/\\\\spadcommand\\{/g' \
        -e 's/\\\\axiomOp\\{/\\\\spadop\\{/g' \
        -e 's/\\\\axiomOpFrom\\{/\\\\spadopFrom\\{/g' \
        -e 's/\\\\axiomSig\\{/\\\\spadsig\\{/g' \
        $f
done

A few manual replacement that were not caught by the script above in
the following files.
  src/algebra/cra.spad
  src/algebra/triset.spad
  src/doc/ht/HTXFormatPage8.ht
  src/doc/htex/ug12.htex
  src/doc/htex/ug13.htex
  src/doc/htex/ug21.htex

git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1768 b0c55286-4f34-0410-a049-a1e7e93b0762
xhash.spad is nearly a LaTeX file. Instead of noweb markup there is now
  )if LiterateDoc
and
  )endif
around the LaTeX part. To turn the .spad file into a .tex file,
one basically has to replace ")if LiterateDoc" by "\end{lstlisting}"
and ")endif" by "\begin{lstlisting}". The following awk code does
exactly that, but it also takes care of ")abbrev" appearing at the
beginning of the file and moves it into the first code chunk.
Furthermore, empty lines after ")endif" and empty lines before ")if
LiterateDoc" are moved from the code into the documentation part

Usage: awk -f totex.awk xhash.spad > xhash.tex

--- totex.awk
/^)abb[a-z]* / && abbrev_seen==0 {abbrev=$0; abbrev_seen=1; next}

/^$/ {emptyline++; next}

/^)if LiterateDoc/ {
    if (open_code) {print "\\end{lstlisting}"; open_code=0}
    while (emptyline>0) {print ""; emptyline--}
    open_literal=1
    open_code=0
    next
}

/^)endif/ {
    if (!open_literal) {print; next}
    open_literal=0
    open_code=1
    # swallow the following empty lines and only output something if
    # there is a non-empty line following.
    while (getline > 0) {
        if ($0 != "") {
            while (emptyline>0) {print ""; emptyline--}
            print "\\begin{lstlisting}[language=spad]"
            if (abbrev) {print abbrev; abbrev=""}
            print
            next
        }
        emptyline++
    }
    # coming here means EOF or error in reading
    next
}

{
    while (emptyline>0) {print ""; emptyline--}
    print
}

git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1773 b0c55286-4f34-0410-a049-a1e7e93b0762
hebisch and others added 16 commits May 23, 2014 17:07
Before we had:
(1) -> SI ==> Set Integer
(2) -> SSI ==> Set SI
(3) -> si:SI := set [2]
   (3)  {2}
(4) -> subset?(si,si)
   (4)  true
(5) -> ssi: SSI := set [si]
   (5)  {{2}}
(6) -> subset?(ssi,ssi)
   (6)  false

With the patch also (6) gives true.

git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1781 b0c55286-4f34-0410-a049-a1e7e93b0762
git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1784 b0c55286-4f34-0410-a049-a1e7e93b0762
raoulb pushed a commit to raoulb/fricas that referenced this pull request Feb 4, 2015
Before this patch, the aldor compilation of libaxiom.al gave:

aldor -Wname=axiom -Mno-abbrev -Mpreview -Y al -L
AxiomLib=axiom_RFSSPLIT -fao=ao/RFSSPLIT.ao ap/RFSSPLIT.ap
(Message Preview)
"ap/RFSSPLIT.ap", line 11:
                (|Declare| |hemmecke#2| (|Apply| |FunctionSpace| |hemmecke#1|)))
.........................................................^
[L11 C58] hemmecke#1 (Error) Argument 1 of `FunctionSpace' did not match any
possible parameter type.
    The rejected type is Join(IntegralDomain, RetractableTo(Integer)) with .
    Expected type Comparable.

git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@1834 b0c55286-4f34-0410-a049-a1e7e93b0762
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants