Error in filename

45 views
Skip to first unread message

Prof. Dr. Johannes Grabmeier

unread,
Nov 24, 2023, 2:59:15 PM11/24/23
to fricas...@googlegroups.com
Hi all,

get the following error:

(7) ->
filename("/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS",
"xxx", "input")


   >> System error:
   invalid number of arguments: 2

filename calls fnameMake from LISP

filename(d, n, e) == fnameMake(d, n, e)$Lisp

what is wrong? I have FriCAS 1.3.8 on SBCL 2.1.2 on Apple M2 Pro

Would be thankful for urgent reply, as I have to use the results of the
computations in a short time frame.

--
Mit freundlichen Grüßen

Johannes Grabmeier

Prof. Dr. Johannes Grabmeier,
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-151-681-70756
Fax: +49-(0)-991-2979592

Waldek Hebisch

unread,
Nov 24, 2023, 3:27:47 PM11/24/23
to fricas...@googlegroups.com
On Fri, Nov 24, 2023 at 08:59:12PM +0100, Prof. Dr. Johannes Grabmeier wrote:
> Hi all,
>
> get the following error:
>
> (7) -> filename("/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS",
> "xxx", "input")
>
>
>    >> System error:
>    invalid number of arguments: 2
>
> filename calls fnameMake from LISP
>
> filename(d, n, e) == fnameMake(d, n, e)$Lisp
>
> what is wrong? I have FriCAS 1.3.8 on SBCL 2.1.2 on Apple M2 Pro

This works for me both using 1.3.8 and current trunk. I am on Linux,
but the relevant part is supposed to work the same on Mac and on Linux.

--
Waldek Hebisch

Qian Yun

unread,
Nov 24, 2023, 7:45:28 PM11/24/23
to fricas...@googlegroups.com
Hi,

I can't reproduce this problem either.

Did you compile FriCAS or use a binary?

Can you show me the backtrace by:

)set break break
filename(...)

Then type ":backtrace" in the debugger.

- Qian

Prof. Dr. Johannes Grabmeier

unread,
Nov 25, 2023, 11:24:14 AM11/25/23
to fricas...@googlegroups.com

Hi Quian,

thanks for your reply, here is the output. Meanwhile I found the reason
for the error, which I could eliminate, as this feature is not required
for the computations right now. But may be crucial for other application.

I enhanced Character and String with greek letters and other useful
functions. Code string-enhanced.spad is included. Also symbol-jg.spad
with signatures like alpha: () -> Sybol

There I had to do a boot strapping process (forgot why) for signatur
greek?: () -> Boolean, which one had to compile first without code and
then with code. But exactly this process causes the error now.

Please compile symbol-jg and string-enhanced (2 times, first with code
of greek? commented out and then with its code). Then calling e.g.
alpha() reproduces the error.

I am curious to learn what is going wrong now. And, if this can be fixed
I would appreciate to include my enhancements to the distribution.

Thanks and regards

Johannes


(4) -> fnvwh : FileName :=
filename("/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS",
"VWH_2024_newspad", "csv")


   >> System error:
   invalid number of arguments: 2

(4) ->
(4) ->
(4) -> )set break break
(4) -> fnvwh : FileName :=
filename("/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS",
"VWH_2024_newspad", "csv")


debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread
#<THREAD "main thread" RUNNING {7006C65233}>:
  invalid number of arguments: 2

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [REPLACE-FUNCTION] Call a different function with the same arguments
  1: [CALL-FORM       ] Call a different form
  2: [ABORT           ] Exit from the current thread.

(|make_full_CVEC| 1 34) [external]
   source: (DEFUN |make_full_CVEC| (SINT) (|make_full_CVEC2| SINT #\ ))
0]
:backtrace

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {7006C65233}>
0: (|make_full_CVEC| 1 34) [external]
1: (|LNAGG-;concat;ASA;3|
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv"
34 #1=#((|LinearAggregate&| #2=(|String|) (|Character|)) (#3=#<FUNCTION
|lookupComplete|> #1# #(|trim| 197 |sorted?| 203 |sort!| 208 |sort| 213
|rightTrim| 224 |reverse| 230 ...)) NIL 31 (#(T) #((|Join| (|mkCategory|
# # NIL NIL))) . #(1 6 8 0 9 1 6 8 0 10 2 6 ...)) NIL #4=#(#2#
(#<FUNCTION |lookupIncomplete|> #4# #(|uentries| 103 |ucodeToString| 108
|toInteger| 113 |toDecimalExpansion| 118 |string| 123 |qsetelt!| 128
...)) NIL 16382 (#(T |StringAggregate&| #(# # NIL 0 # NIL #4# #5=# # # #
# ...) T #1# |IndexedAggregate&| |Collection&| |OrderedSet&|
|HomogeneousAggregate&| T |SetCategory&| |Aggregate&| ...)
#((|StringCategory|) (|StringAggregate|) (|OneDimensionalArrayAggregate|
9) (|FiniteLinearAggregate| 9) (|LinearAggregate| 9) (|IndexedAggregate|
11 9) (|Collection| 9) (|OrderedSet|) (|HomogeneousAggregate| 9)
(|Comparable|) (|SetCategory|) (|Aggregate|) ...) . #(1 0 6 0 7 2 9 8 0
0 10 1 ...)) #6=#((|IndexedString| 1) (#3# #6# #(~= 97 |upperCase!| 103
|upperCase| 108 |trim| 113 |swap!| 125 |suffix?| 132 ...)) NIL 4194175
(#(|StringAggregate&| |OneDimensionalArrayAggregate&| T
|LinearAggregate&| |IndexedAggregate&| |Collection&| |OrderedSet&|
|HomogeneousAggregate&| T |Aggregate&| |EltableAggregate&| NIL ...) #(#
# # # # # # # # # # # ...) . #(2 19 0 18 18 20 1 19 0 18 22 1 ...)) NIL
1 (|NonNegativeInteger|) (|Character|) (#<FUNCTION
|ISTRING;new;NniC$;1|> . #6#) (#<FUNCTION |ISTRING;empty;$;2|> . #6#)
(|Boolean|) ...) (|List| 9) (#7=#<FUNCTION |newGoGet|> #4# 0 . |parts|)
(|Boolean|) #5# (#7# #4# 5 . ~=) (|Integer|) ...) #5# (|Integer|) (#7#
#1# 0 . |minIndex|) (#7# #1# 5 . |maxIndex|) (|List| 8) ...))
2: (|OUTFORM;outputForm;S$;13|
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv"
#1=#((|OutputForm|) (#<FUNCTION |lookupComplete|> #1# #(~= 153 |zag| 165
|vspace| 171 |vconcat| 176 |tensor| 187 |supersub| 193 ...)) NIL 0
(#(|SetCategory&| |BasicType&| T T) #((|SetCategory|) (|BasicType|)
(|ConvertibleTo| 43) (|CoercibleTo| 21)) . #(2 6 0 2 0 7 1 12 11 0 13 1
...)) NIL (|List| $$) (#<FUNCTION |newGoGet|> #1# 0 . |cons|)
#2=#((|SExpression|) (#<FUNCTION |lookupIncomplete|> #2# #()) NIL 0 (#(T
|SetCategory&| |BasicType&| T) #((|SExpressionCategory| 9 10 7 8)
(|SetCategory|) (|BasicType|) (|CoercibleTo| 14)) . #())
(|SExpressionOf| 9 10 7 8) (|List| 7) (|Integer|) (|DoubleFloat|)
(|String|) (|Symbol|) (|List| $) ...) (|Void|) (#<FUNCTION
|OUTFORM;print;$V;2|> . #1#) (|Boolean|) ...))
3: (|coerceByFunction| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
4: (|coerceIntTower| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
5: (|coerceInt1| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
6: (|coerceInt| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
7: (|coerceInt0| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
8: (|coerceInteractive| ((|FileName|) WRAPPED .
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv")
(|OutputForm|))
9: (|output|
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv"
(|FileName|))
10: (|recordAndPrint|
#P"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS/VWH_2024_newspad.csv"
(|FileName|))
11: (|processInteractive1| (LET (|:| |fnvwh| |FileName|) (|filename|
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS"
"VWH_2024_newspad" "csv")) (|Assign| (|listOf| (|Tagged| ((|id| #) .
|fnvwh|) ((|id| #) . |FileName|))) (|Application| ((|id| (|posn| # .
20)) . |filename|) (|Tuple| (|listOf| (# .
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS")
(# . "VWH_2024_newspad") (# . "csv"))))))
12: (|processInteractive| (LET (|:| |fnvwh| |FileName|) (|filename|
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS"
"VWH_2024_newspad" "csv")) (|Assign| (|listOf| (|Tagged| ((|id| #) .
|fnvwh|) ((|id| #) . |FileName|))) (|Application| ((|id| (|posn| # .
20)) . |filename|) (|Tuple| (|listOf| (# .
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS")
(# . "VWH_2024_newspad") (# . "csv"))))))
13: (|intInterpretPform| (|Assign| (|listOf| (|Tagged| ((|id| #) .
|fnvwh|) ((|id| #) . |FileName|))) (|Application| ((|id| (|posn| # .
20)) . |filename|) (|Tuple| (|listOf| (# .
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS")
(# . "VWH_2024_newspad") (# . "csv"))))))
14: (|phInterpret| ((|carrier| (|ok?| . T) (|ptreePremacro| .
#1=(|Assign| (|listOf| #) (|Application| # #))) (|ptree| . #1#) (|lines|
((# . 1) . "fnvwh : FileName :=
filename(\"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS\",
\"VWH_2024_newspad\", \"csv\")")) (|messages|) (|stepNumber| . 1))))
15: (|ncConversationPhase| #<FUNCTION |phInterpret|> (((|carrier| (|ok?|
. T) (|ptreePremacro| . #1=(|Assign| # #)) (|ptree| . #1#) (|lines| (# .
"fnvwh : FileName :=
filename(\"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS\",
\"VWH_2024_newspad\", \"csv\")")) (|messages|) (|stepNumber| . 1)))))
16: (|intloopSpadProcess,interp| ((|carrier| (|ok?| . T)
(|ptreePremacro| . #1=(|Assign| (|listOf| #) (|Application| # #)))
(|ptree| . #1#) (|lines| ((# . 1) . "fnvwh : FileName :=
filename(\"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS\",
\"VWH_2024_newspad\", \"csv\")")) (|messages|) (|stepNumber| . 1)))
(|Assign| (|listOf| (|Tagged| ((|id| #) . |fnvwh|) ((|id| #) .
|FileName|))) (|Application| ((|id| (|posn| # . 20)) . |filename|)
(|Tuple| (|listOf| (# .
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS")
(# . "VWH_2024_newspad") (# . "csv"))))) T)
17: (|intloopSpadProcess| 1 ((((0 #1="fnvwh : FileName :=
filename(\"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS\",
\"VWH_2024_newspad\", \"csv\")" 1 1 "strings") . 1) . #1#)) (|Assign|
(|listOf| (|Tagged| ((|id| #) . |fnvwh|) ((|id| #) . |FileName|)))
(|Application| ((|id| (|posn| # . 20)) . |filename|) (|Tuple| (|listOf|
(# .
"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS")
(# . "VWH_2024_newspad") (# . "csv"))))) T)
18: (|intloopProcess| 1 T (((((# . 1) . "fnvwh : FileName :=
filename(\"/Users/jgrabmeier/stadtrat-deggendorf/haushalt/hh-plan-2024/entwurfHaushaltFriCAS\",
\"VWH_2024_newspad\", \"csv\")")) (|Assign| (|listOf| (|Tagged| # #))
(|Application| (# . |filename|) (|Tuple| #)))) |nonnullstream|
#1=#<FUNCTION |next1|> #<FUNCTION |ncloopParse|> (|nonnullstream| #1#
#<FUNCTION |fakepile|> (|nullstream|))))
19: (|intloopReadConsole| #<unavailable argument> #<unavailable argument>)
20: (|SpadInterpretStream| 1 NIL T)
21: (|int_loop|)
22: (|ncTopLevel|)
23: (|runspad|)
24: (|spad|)
25: (FRICAS-RESTART)
26: ((LAMBDA NIL :IN FRICAS-LISP::SAVE-CORE-RESTART))
27: ((FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP))
28: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-IMPL::START-LISP))
29: (SB-IMPL::START-LISP)

0]



Am 25.11.23 um 01:45 schrieb Qian Yun:
symbol-jg.spad
string-enhanced.spad

Waldek Hebisch

unread,
Nov 25, 2023, 1:32:56 PM11/25/23
to fricas...@googlegroups.com
On Sat, Nov 25, 2023 at 05:24:10PM +0100, Prof. Dr. Johannes Grabmeier wrote:
>
> I enhanced Character and String with greek letters and other useful
> functions. Code string-enhanced.spad is included. Also symbol-jg.spad with
> signatures like alpha: () -> Sybol
<snip>
> I am curious to learn what is going wrong now. And, if this can be fixed I
> would appreciate to include my enhancements to the distribution.

AFAICS you are basing your string-enhanced.spad on old, pre-1.3.8
string.spad. In particular, you missed the change:

@@ -266,7 +266,7 @@ IndexedString(mn : Integer) : Export == Implementation where
c : Character
cc : CharacterClass

- new(n, c) == make_full_CVEC(n, c)$Lisp
+ new(n, c) == make_full_CVEC2(n, c)$Lisp
empty() == make_full_CVEC(0$Lisp)$Lisp
empty?(s) == Qsize(s) = 0
#s == Qsize(s)

In 1.3.8 make_full_CVEC accepts only single argument, 1.3.8 and
1.3.9 provide separate two argument version called make_full_CVEC2.

I do not know if this is the only problem, but the above must
have created trouble.

--
Waldek Hebisch

Waldek Hebisch

unread,
Nov 25, 2023, 7:08:30 PM11/25/23
to fricas...@googlegroups.com
On Sat, Nov 25, 2023 at 05:24:10PM +0100, Prof. Dr. Johannes Grabmeier wrote:
>
> I enhanced Character and String with greek letters and other useful
> functions. Code string-enhanced.spad is included. Also symbol-jg.spad with
> signatures like alpha: () -> Sybol
<snip>
> I am curious to learn what is going wrong now. And, if this can be fixed I
> would appreciate to include my enhancements to the distribution.

After fixing the make_full_CVEC problem your changes compile fine.

Some comments about includinhg them in FriCAS distribution: currently
we can not assume that Unicode characters are a single FriCAS
character. We have utility function that produces FriCAS string
consisting of single Unicode character. Currently GCL uses UFT-8
encoding where character codes are 8-bit and non-ASCII Unicode characters
produce strings of length bigger than 1. And I would like to
have possiblity of representing FriCAS strings as byte arrays
even when using different Lisp. So I do not like idea of
adding Unicode character to FriCAS Character.

I also do not like idea representing CharacterClass by array with
more than 256 entries. First, it does not work when character
codes are 8-bit. Second, once we add more codes there is no
natural limit, logically we should have entire Unicode, that
is 1114112 positions. But such tables are very troublesome
performancewise. They take a lot of space and it takes time
to initialize them. One may think that with gigabyte memories
this is not a problem. Well, modern machine are fast when
data is in caches. Caches have limited size and big tables
may exceed size of caches. Also, FriCAS normally is usable
on quite small machines, spending a lot of memory on something
that looks trivial means that it would be less usable on
small machines.

We already have equvalent functionality to some things that
you want to add. In package ScanningUtilities there is
'parse_integer' function which converts a string to an integer.
This covers functionalty of 'toInteger'. If function to convert
digits to integers is desired it would be natural to add it in
the same package. I am not sure how important is
'toDecimalExpansion' but AFAICS the effect may be obtained by

decimal(parse_integer(s)::FRAC(INT))

Also we have 'newline()' to get end of line character,
so your 'endOfLine' just introduces a duplicate name.

Concerning adding greek letter and other symbols to Symbol,
I am affraid of "namespace pollution". Symbol is used
a lot and users may want to use names of Greek letters for
their purposes. So I would put such functions in a separate
unexposed package. Concering implementation, 'getUTF'
may be implemented as

getUTF(i : PositiveInteger) : Symbol == ucodeToString(i)::Symbol

which should work with our convention. Similarly, 'newGreek'
should use array of strings as set of greek letters (or
use ucodeToString to produce them on the fly). ATM FriCAS
sources should use ASCII (not ASCII charcter may cause but
failure in some cases). So documentaion string should use
spelled-out name of character, not to charater itself.

More generally, for handling Unicode strings there may be some
use in functions that extract next Unicode code point (Integer
from 0 to 1114112 - 1 and function to give first string index
after/befor a Unicode character. Such functions allow iteration
over Unicode strings in both directions which should be
enough for basic Unicode-aware string operations.

--
Waldek Hebisch

Waldek Hebisch

unread,
Nov 25, 2023, 8:01:28 PM11/25/23
to fricas...@googlegroups.com
Attached is diff with respect to current trunk which
should give the same functionality as your code, but
omits most problematic changes.

As I wrote in previous mail, changes to Symbol IMO
should go to a separate package. From changes to
'string.spad' we probaly should take some but not
all.

--
Waldek Hebisch
jg1b.diff

Waldek Hebisch

unread,
Nov 26, 2023, 9:15:39 AM11/26/23
to fricas...@googlegroups.com
Attached is code defining Greek symbols organized as a package.

Note: ucodeToString takes Unicode code point as argument, so
I had to decrease all character codes by 1 (index used in
original code adds 1).

Extra remark: Some capital Greek letters look exactly the
same as roman letters. They are needed when one wants
actual Greek text, but one probably should not use them
in math. For this reason some capital Greek letters
were/are exluded from TeX. I think it makes sense to
exclude them.

--
Waldek Hebisch
math_sym.spad

Bill Page

unread,
Nov 26, 2023, 10:10:16 AM11/26/23
to fricas...@googlegroups.com


On Sun, 26 Nov 2023 at 09:15, Waldek Hebisch <de...@fricas.org> wrote:
>
> Attached is code defining Greek symbols organized as a package.
>
> Note: ucodeToString takes Unicode code point as argument, so
> I had to decrease all character codes by 1 (index used in
> original code adds 1).
>
> Extra remark: Some capital Greek letters look exactly the
> same as roman letters.  They are needed when one wants
> actual Greek text, but one probably should not use them
> in math.  For this reason some capital Greek letters
> were/are excluded from TeX.  I think it makes sense to
> exclude them.
>

-1 No, I think you should keep them.  Whether Greek versus Roman characters look the same depends on the presentation layer, i.e. what fonts are used to render the final result. The same thing applies to other homoglyph characters in other language, e.g. Latin and Cryllic. It is often of interest to use different font sets for different languages appearing in the same document. TeX should not be considered as a de facto standard.

Ralf Hemmecke

unread,
Nov 26, 2023, 11:04:09 AM11/26/23
to fricas...@googlegroups.com
On 11/26/23 15:15, Waldek Hebisch wrote:
> Attached is code defining Greek symbols organized as a package.

There is a trailing space at the end of the file.

Another thing that I do not quite like is the function names of capital
letters. I am not a fan of having Alpha, Beta, etc. since that violates
the convention that variable and function names should start with a
small letter and only constructors begin with a capital.

Although it is longer, but I would rather use capitalAlpha, capitalBeta,
etc. There is no reason that FriCAS must have short names. We have a
macro system to help users if they feel that function names are too long.

I would also rather like mathsym.spad instead of math_sym.spad.

Ralf

Waldek Hebisch

unread,
Nov 27, 2023, 7:20:39 AM11/27/23
to fricas...@googlegroups.com
On Sun, Nov 26, 2023 at 05:04:06PM +0100, Ralf Hemmecke wrote:
> On 11/26/23 15:15, Waldek Hebisch wrote:
> > Attached is code defining Greek symbols organized as a package.
>
> There is a trailing space at the end of the file.

Hmm, I see only a newline (empty line).

> Another thing that I do not quite like is the function names of capital
> letters. I am not a fan of having Alpha, Beta, etc. since that violates the
> convention that variable and function names should start with a small letter
> and only constructors begin with a capital.

I think this is strong case for exception to the convention, plain
Alpha is much more natural.

> Although it is longer, but I would rather use capitalAlpha, capitalBeta,
> etc. There is no reason that FriCAS must have short names. We have a macro
> system to help users if they feel that function names are too long.
>
> I would also rather like mathsym.spad instead of math_sym.spad.

Well, math_sym.spad is more readible.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages