Waldek, Le mar. 1 août 2023, 22:28, Waldek Hebisch <de...@fricas.math.uni.wroc.pl> a écrit :
> On Sat, Jul 29, 2023 at 11:31:17AM +0200, Grégory Vanuxem wrote: > > Hello,, > > > > I am asking myself what is the best/efficient domain to return a list > > of key pairs. > > > > I can not use List(Record), > > List of records is "best" for problem as stated above. > > > first I am not a big fan of hardcoded > > "domains" in FriCAS core, and second I do not know the keys in > > advance. > > AFAICS you now types of keys (String), and that is enough to define > a Record. > Yes you're probably right, I just dislike the way they are constructed. It is too internal for me as I said, I would prefer a Spad definition. After all, it not really important here. > > I explain, I am adding regular expression support to custom strings > > (JuliaString) and when the regular expression captures substring they > > can be named. > > > > Take this regex: > > regex:= "(?<hour>\d+):(\d+)(am|pm)?" > > and "11:30 in the morning" to search in. > > > > Actually, I return a List(JuliaString), > > ==================================== > > (7) -> l:=jlRegexMatch(regex,s)@List(JSTR) > > > > (7) ["11", "30", ""] > > Type: > List(JuliaString) > > ==================================== > > But I would like to also add the (key, value) pairs support: > > "hour" => "11", > > "minutes" => "30" > > "3" => "" > > the regular expression code is in Julia (PCRE2 is used from Julia > > documentation) but in FriCAS do you have any idea which domain I could > > use, AssociationList is not exposed for example? > > > > Note: that's just utility code for strings. > > Just use AssociationList. For return values it does not matter > much if domain is exposed or not. > Yes, this is what I did. I looked at some piece of code and it was more easy than I thought preliminarily. __ Greg -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAHnU2dYzJs%3D3G-LNDcgSeatCUoeUgcpPQzOVfVJmVvb23ikizQ%40mail.gmail.com.