Tag Info

New answers tagged

1

f[x_] := StringTake[IntegerString[Hash[ToString@x, "SHA256"], 16], -4] (* tiny version of requested function *) Clear[collision]; collision::usage = "store potential collisions as downvalues"; collision[_] = {}; Block[ {y}, For[i = 1, i <= 1000, i++, y = f[i]; collision[y] = Append[collision[y], i] ] ]; Sort[Select[#[[1, 1, 1]] -> ...


3

I suspect that a somewhat different structure will ultimately benefit you, and I shall attempt to recommend one if and when I better understand your needs. However for the moment these examples might be useful to you: data = {"apple", "banana", "kiwi"}; models = {"model1", "model2", "model3"}; result[m_List][par_] := result[#][par] & /@ m ...


3

I may have misunderstood the requirement but this seems to work for the example at least: problem = "a { b { c d } e } aa { bb cc }"; Map[Flatten, StringSplit[problem] //. {head___, x_, "{", Shortest[y__], "}", tail___} :> {head, Sequence @@ Thread[{x, {y}}], tail}] (* {{"a", "b", "c"}, {"a", "b", "d"}, {"a", "e"}, {"aa", "bb"}, {"aa", "cc"}} *)


0

Append[eMap // Normal, eMap[1] // Normal] // Dataset {<|"ModuleId" -> 0, "SegmentId" -> 0, "x1" -> 0, "y1" -> 0, "z1" -> 0, "x2" -> 0, "y2" -> 0, "z2" -> 0|>, <|"ModuleId" -> 0, "SegmentId" -> 0, "x1" -> 0, "y1" -> 0, "z1" -> 0, "x2" -> 0, "y2" -> 0, "z2" -> 0|>} Note: using eMap[1] as per your example. At this ...


3

If the curly braces are left out, this seems to work. Remove[eMap]; eMap = Dataset[{<|"ModuleId" -> 0, "SegmentId" -> 0, "x1" -> 0, "y1" -> 0, "z1" -> 0, "x2" -> 0, "y2" -> 0, "z2" -> 0|>}]; eMap = AppendTo[ eMap, <|"ModuleId" -> 0, "SegmentId" -> 1, "x1" -> 1, "y1" -> 0, "z1" -> 0, "x2" -> ...



Top 50 recent answers are included