lawspec 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/README.md +10 -4
- package/bin/lawspec.mjs +13 -3
- package/build.json +9 -9
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/learn/adapters.mjs +226 -0
- package/learn/app.mjs +1279 -0
- package/learn/assert.mjs +33 -0
- package/learn/assets.mjs +15 -0
- package/learn/browser-runtime.mjs +58 -0
- package/learn/bundle.mjs +118 -0
- package/learn/compile-worker.mjs +106 -0
- package/learn/compiler.mjs +230 -0
- package/learn/coverage.json +8187 -0
- package/learn/curriculum.json +2952 -0
- package/learn/fantomas-worker.mjs +25 -0
- package/learn/format-worker.mjs +148 -0
- package/learn/fsharp.mjs +83 -0
- package/learn/harness-host.mjs +22 -0
- package/learn/index.html +326 -0
- package/learn/lawspec-core.mjs +223 -0
- package/learn/lawspec-language.mjs +69 -0
- package/learn/node-test.mjs +11 -0
- package/learn/presentation.mjs +73 -0
- package/learn/runner.mjs +72 -0
- package/learn/sandbox-frame.html +34 -0
- package/learn/sandbox.mjs +91 -0
- package/learn/store.mjs +141 -0
- package/learn/story.mjs +42 -0
- package/learn/style-options.json +16 -0
- package/learn/style.css +1023 -0
- package/learn/theme.js +77 -0
- package/learn/typescript.mjs +53 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
- package/learn/vendor/assemblies.json +1 -0
- package/learn/vendor/editor-worker.js +30 -0
- package/learn/vendor/editor.css +1 -0
- package/learn/vendor/editor.mjs +931 -0
- package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
- package/learn/vendor/esbuild.mjs +2683 -0
- package/learn/vendor/esbuild.wasm +0 -0
- package/learn/vendor/fable-library/Array.js +1347 -0
- package/learn/vendor/fable-library/Async.js +134 -0
- package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
- package/learn/vendor/fable-library/BigInt.js +306 -0
- package/learn/vendor/fable-library/BitConverter.js +138 -0
- package/learn/vendor/fable-library/Boolean.js +22 -0
- package/learn/vendor/fable-library/CHANGELOG.md +242 -0
- package/learn/vendor/fable-library/Char.js +202 -0
- package/learn/vendor/fable-library/Choice.js +184 -0
- package/learn/vendor/fable-library/CollectionUtil.js +182 -0
- package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
- package/learn/vendor/fable-library/Date.js +841 -0
- package/learn/vendor/fable-library/DateOffset.js +261 -0
- package/learn/vendor/fable-library/DateOnly.js +124 -0
- package/learn/vendor/fable-library/Decimal.js +238 -0
- package/learn/vendor/fable-library/Double.js +47 -0
- package/learn/vendor/fable-library/Encoding.js +185 -0
- package/learn/vendor/fable-library/Event.js +93 -0
- package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
- package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
- package/learn/vendor/fable-library/FSharp.Core.js +156 -0
- package/learn/vendor/fable-library/Global.js +29 -0
- package/learn/vendor/fable-library/Guid.js +161 -0
- package/learn/vendor/fable-library/Int32.js +135 -0
- package/learn/vendor/fable-library/List.js +1323 -0
- package/learn/vendor/fable-library/Long.js +47 -0
- package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
- package/learn/vendor/fable-library/Map.js +1396 -0
- package/learn/vendor/fable-library/MapUtil.js +130 -0
- package/learn/vendor/fable-library/MutableMap.js +339 -0
- package/learn/vendor/fable-library/MutableSet.js +233 -0
- package/learn/vendor/fable-library/Native.js +14 -0
- package/learn/vendor/fable-library/Numeric.js +75 -0
- package/learn/vendor/fable-library/Observable.js +113 -0
- package/learn/vendor/fable-library/Option.js +104 -0
- package/learn/vendor/fable-library/README.md +3 -0
- package/learn/vendor/fable-library/Random.js +172 -0
- package/learn/vendor/fable-library/Range.js +45 -0
- package/learn/vendor/fable-library/Reflection.js +479 -0
- package/learn/vendor/fable-library/RegExp.js +141 -0
- package/learn/vendor/fable-library/Result.js +165 -0
- package/learn/vendor/fable-library/Seq.js +1417 -0
- package/learn/vendor/fable-library/Seq2.js +111 -0
- package/learn/vendor/fable-library/Set.js +1816 -0
- package/learn/vendor/fable-library/String.js +674 -0
- package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
- package/learn/vendor/fable-library/System.Text.js +200 -0
- package/learn/vendor/fable-library/System.js +289 -0
- package/learn/vendor/fable-library/TimeOnly.js +122 -0
- package/learn/vendor/fable-library/TimeSpan.js +180 -0
- package/learn/vendor/fable-library/Timer.js +67 -0
- package/learn/vendor/fable-library/Types.js +198 -0
- package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
- package/learn/vendor/fable-library/Uri.js +165 -0
- package/learn/vendor/fable-library/Util.js +796 -0
- package/learn/vendor/fable-library/big.d.ts +338 -0
- package/learn/vendor/fable-library/lib/big.js +825 -0
- package/learn/vendor/fable-library/package.json +24 -0
- package/learn/vendor/fable-library/quotation.js +618 -0
- package/learn/vendor/fable.js +430 -0
- package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.5arcua4vy0.wasm +0 -0
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.u1ne3a6xd2.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
- package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
- package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
- package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
- package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
- package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
- package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
- package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
- package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
- package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
- package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
- package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
- package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
- package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
- package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.js +1233 -0
- package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
- package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
- package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
- package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
- package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
- package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
- package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
- package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
- package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
- package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
- package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
- package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
- package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
- package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
- package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
- package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
- package/learn/vendor/fast-check-LICENSE.txt +21 -0
- package/learn/vendor/fast-check.mjs +37 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
- package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
- package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
- package/learn/vendor/formatter-licenses/README.md +12 -0
- package/learn/vendor/manifest.json +1358 -0
- package/learn/vendor/metadata/Browser.Blob.dll +0 -0
- package/learn/vendor/metadata/Browser.Dom.dll +0 -0
- package/learn/vendor/metadata/Browser.Event.dll +0 -0
- package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
- package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
- package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
- package/learn/vendor/metadata/FSharp.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
- package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
- package/learn/vendor/metadata/System.Collections.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
- package/learn/vendor/metadata/System.Console.dll +0 -0
- package/learn/vendor/metadata/System.Core.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
- package/learn/vendor/metadata/System.Globalization.dll +0 -0
- package/learn/vendor/metadata/System.IO.dll +0 -0
- package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
- package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
- package/learn/vendor/metadata/System.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
- package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
- package/learn/vendor/metadata/System.Threading.dll +0 -0
- package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
- package/learn/vendor/metadata/System.dll +0 -0
- package/learn/vendor/metadata/mscorlib.dll +0 -0
- package/learn/vendor/metadata/netstandard.dll +0 -0
- package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
- package/learn/vendor/prettier/babel.mjs +16 -0
- package/learn/vendor/prettier/brace-style.mjs +376 -0
- package/learn/vendor/prettier/estree.mjs +44 -0
- package/learn/vendor/prettier/standalone.mjs +29 -0
- package/learn/vendor/prettier/typescript.mjs +22 -0
- package/learn/vendor/prettier-LICENSE.txt +7 -0
- package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
- package/learn/vendor/typescript-LICENSE.txt +55 -0
- package/learn/vendor/typescript-libs.json +1 -0
- package/learn/vendor/typescript.mjs +451 -0
- package/learn/vendor/zod-LICENSE.txt +21 -0
- package/learn/web-format.mjs +8 -0
- package/learn.mjs +126 -0
- package/package.json +3 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const symbol = Symbol("numeric");
|
|
2
|
+
export function isNumeric(x) {
|
|
3
|
+
return typeof x === "number" || typeof x === "bigint" || x?.[symbol];
|
|
4
|
+
}
|
|
5
|
+
export function isIntegral(x) {
|
|
6
|
+
// Not perfect, because in JS we can't distinguish between 1.0 and 1
|
|
7
|
+
return typeof x === "number" && Number.isInteger(x) || typeof x === "bigint";
|
|
8
|
+
}
|
|
9
|
+
export function compare(x, y) {
|
|
10
|
+
if (typeof x === "number") {
|
|
11
|
+
return x < y ? -1 : (x > y ? 1 : 0);
|
|
12
|
+
}
|
|
13
|
+
else if (typeof x === "bigint") {
|
|
14
|
+
return x < y ? -1 : (x > y ? 1 : 0);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return x.CompareTo(y);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function multiply(x, y) {
|
|
21
|
+
if (typeof x === "number") {
|
|
22
|
+
return x * y;
|
|
23
|
+
}
|
|
24
|
+
else if (typeof x === "bigint") {
|
|
25
|
+
return x * BigInt(y);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return x[symbol]().multiply(y);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function toFixed(x, dp) {
|
|
32
|
+
if (typeof x === "number") {
|
|
33
|
+
return x.toFixed(dp);
|
|
34
|
+
}
|
|
35
|
+
else if (typeof x === "bigint") {
|
|
36
|
+
return x.toString();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return x[symbol]().toFixed(dp);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function toPrecision(x, sd) {
|
|
43
|
+
if (typeof x === "number") {
|
|
44
|
+
return x.toPrecision(sd);
|
|
45
|
+
}
|
|
46
|
+
else if (typeof x === "bigint") {
|
|
47
|
+
return x.toString();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return x[symbol]().toPrecision(sd);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function toExponential(x, dp) {
|
|
54
|
+
if (typeof x === "number") {
|
|
55
|
+
return x.toExponential(dp);
|
|
56
|
+
}
|
|
57
|
+
else if (typeof x === "bigint") {
|
|
58
|
+
return x;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return x[symbol]().toExponential(dp);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export function toHex(x) {
|
|
65
|
+
if (typeof x === "number") {
|
|
66
|
+
return (Number(x) >>> 0).toString(16);
|
|
67
|
+
}
|
|
68
|
+
else if (typeof x === "bigint") {
|
|
69
|
+
// TODO: properly handle other bit sizes
|
|
70
|
+
return BigInt.asUintN(64, x).toString(16);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return x[symbol]().toHex();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Choice_tryValueIfChoice1Of2, Choice_tryValueIfChoice2Of2 } from "./Choice.js";
|
|
2
|
+
import { value } from "./Option.js";
|
|
3
|
+
export class Observer {
|
|
4
|
+
constructor(onNext, onError, onCompleted) {
|
|
5
|
+
this.OnNext = onNext;
|
|
6
|
+
this.OnError = onError || ((_e) => { return; });
|
|
7
|
+
this.OnCompleted = onCompleted || (() => { return; });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class Observable {
|
|
11
|
+
constructor(subscribe) {
|
|
12
|
+
this.Subscribe = subscribe;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function protect(f, succeed, fail) {
|
|
16
|
+
try {
|
|
17
|
+
return succeed(f());
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
fail(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function add(callback, source) {
|
|
24
|
+
source.Subscribe(new Observer(callback));
|
|
25
|
+
}
|
|
26
|
+
export function choose(chooser, source) {
|
|
27
|
+
return new Observable((observer) => source.Subscribe(new Observer((t) => protect(() => chooser(t), (u) => { if (u != null) {
|
|
28
|
+
observer.OnNext(value(u));
|
|
29
|
+
} }, observer.OnError), observer.OnError, observer.OnCompleted)));
|
|
30
|
+
}
|
|
31
|
+
export function filter(predicate, source) {
|
|
32
|
+
return choose((x) => predicate(x) ? x : void 0, source);
|
|
33
|
+
}
|
|
34
|
+
export function map(mapping, source) {
|
|
35
|
+
return new Observable((observer) => source.Subscribe(new Observer((t) => {
|
|
36
|
+
protect(() => mapping(t), observer.OnNext, observer.OnError);
|
|
37
|
+
}, observer.OnError, observer.OnCompleted)));
|
|
38
|
+
}
|
|
39
|
+
export function merge(source1, source2) {
|
|
40
|
+
return new Observable((observer) => {
|
|
41
|
+
let stopped = false;
|
|
42
|
+
let completed1 = false;
|
|
43
|
+
let completed2 = false;
|
|
44
|
+
const h1 = source1.Subscribe(new Observer((v) => { if (!stopped) {
|
|
45
|
+
observer.OnNext(v);
|
|
46
|
+
} }, (e) => {
|
|
47
|
+
if (!stopped) {
|
|
48
|
+
stopped = true;
|
|
49
|
+
observer.OnError(e);
|
|
50
|
+
}
|
|
51
|
+
}, () => {
|
|
52
|
+
if (!stopped) {
|
|
53
|
+
completed1 = true;
|
|
54
|
+
if (completed2) {
|
|
55
|
+
stopped = true;
|
|
56
|
+
observer.OnCompleted();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
const h2 = source2.Subscribe(new Observer((v) => { if (!stopped) {
|
|
61
|
+
observer.OnNext(v);
|
|
62
|
+
} }, (e) => {
|
|
63
|
+
if (!stopped) {
|
|
64
|
+
stopped = true;
|
|
65
|
+
observer.OnError(e);
|
|
66
|
+
}
|
|
67
|
+
}, () => {
|
|
68
|
+
if (!stopped) {
|
|
69
|
+
completed2 = true;
|
|
70
|
+
if (completed1) {
|
|
71
|
+
stopped = true;
|
|
72
|
+
observer.OnCompleted();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
return {
|
|
77
|
+
Dispose() {
|
|
78
|
+
h1.Dispose();
|
|
79
|
+
h2.Dispose();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function pairwise(source) {
|
|
85
|
+
return new Observable((observer) => {
|
|
86
|
+
let last;
|
|
87
|
+
return source.Subscribe(new Observer((next) => {
|
|
88
|
+
if (last != null) {
|
|
89
|
+
observer.OnNext([last, next]);
|
|
90
|
+
}
|
|
91
|
+
last = next;
|
|
92
|
+
}, observer.OnError, observer.OnCompleted));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export function partition(predicate, source) {
|
|
96
|
+
return [filter(predicate, source), filter((x) => !predicate(x), source)];
|
|
97
|
+
}
|
|
98
|
+
export function scan(collector, state, source) {
|
|
99
|
+
return new Observable((observer) => {
|
|
100
|
+
return source.Subscribe(new Observer((t) => {
|
|
101
|
+
protect(() => collector(state, t), (u) => { state = u; observer.OnNext(u); }, observer.OnError);
|
|
102
|
+
}, observer.OnError, observer.OnCompleted));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function split(splitter, source) {
|
|
106
|
+
return [
|
|
107
|
+
choose((v) => Choice_tryValueIfChoice1Of2(splitter(v)), source),
|
|
108
|
+
choose((v) => Choice_tryValueIfChoice2Of2(splitter(v)), source)
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
export function subscribe(callback, source) {
|
|
112
|
+
return source.Subscribe(new Observer(callback));
|
|
113
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Exception, structuralHash, equals, compare } from "./Util.js";
|
|
2
|
+
// Using a class here for better compatibility with TS files importing Some
|
|
3
|
+
export class Some {
|
|
4
|
+
constructor(value) {
|
|
5
|
+
this.value = value;
|
|
6
|
+
}
|
|
7
|
+
toJSON() {
|
|
8
|
+
return this.value;
|
|
9
|
+
}
|
|
10
|
+
// Don't add "Some" for consistency with erased options
|
|
11
|
+
toString() {
|
|
12
|
+
return String(this.value);
|
|
13
|
+
}
|
|
14
|
+
GetHashCode() {
|
|
15
|
+
return structuralHash(this.value);
|
|
16
|
+
}
|
|
17
|
+
Equals(other) {
|
|
18
|
+
if (other == null) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return equals(this.value, other instanceof Some ? other.value : other);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
CompareTo(other) {
|
|
26
|
+
if (other == null) {
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return compare(this.value, other instanceof Some ? other.value : other);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function nonNullValue(x) {
|
|
35
|
+
if (x == null) {
|
|
36
|
+
throw new Exception("Nullable has no value");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return x;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function value(x) {
|
|
43
|
+
if (x == null) {
|
|
44
|
+
throw new Exception("Option has no value");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return x instanceof Some ? x.value : x;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function unwrap(opt) {
|
|
51
|
+
return opt instanceof Some ? opt.value : opt;
|
|
52
|
+
}
|
|
53
|
+
export function some(x) {
|
|
54
|
+
return x == null || x instanceof Some ? new Some(x) : x;
|
|
55
|
+
}
|
|
56
|
+
export function ofNullable(x) {
|
|
57
|
+
// This will fail with unit probably, an alternative would be:
|
|
58
|
+
// return x === null ? undefined : (x === undefined ? new Some(x) : x);
|
|
59
|
+
return x == null ? undefined : x;
|
|
60
|
+
}
|
|
61
|
+
export function toNullable(x) {
|
|
62
|
+
return x == null ? null : value(x);
|
|
63
|
+
}
|
|
64
|
+
export function flatten(x) {
|
|
65
|
+
return x == null ? undefined : value(x);
|
|
66
|
+
}
|
|
67
|
+
export function toArray(opt) {
|
|
68
|
+
return (opt == null) ? [] : [value(opt)];
|
|
69
|
+
}
|
|
70
|
+
export function defaultArg(opt, defaultValue) {
|
|
71
|
+
return (opt != null) ? value(opt) : defaultValue;
|
|
72
|
+
}
|
|
73
|
+
export function defaultArgWith(opt, defThunk) {
|
|
74
|
+
return (opt != null) ? value(opt) : defThunk();
|
|
75
|
+
}
|
|
76
|
+
export function orElse(opt, ifNone) {
|
|
77
|
+
return opt == null ? ifNone : opt;
|
|
78
|
+
}
|
|
79
|
+
export function orElseWith(opt, ifNoneThunk) {
|
|
80
|
+
return opt == null ? ifNoneThunk() : opt;
|
|
81
|
+
}
|
|
82
|
+
export function filter(predicate, opt) {
|
|
83
|
+
return (opt != null) ? (predicate(value(opt)) ? opt : undefined) : opt;
|
|
84
|
+
}
|
|
85
|
+
export function map(mapping, opt) {
|
|
86
|
+
return (opt != null) ? some(mapping(value(opt))) : undefined;
|
|
87
|
+
}
|
|
88
|
+
export function map2(mapping, opt1, opt2) {
|
|
89
|
+
return (opt1 != null && opt2 != null) ? mapping(value(opt1), value(opt2)) : undefined;
|
|
90
|
+
}
|
|
91
|
+
export function map3(mapping, opt1, opt2, opt3) {
|
|
92
|
+
return (opt1 != null && opt2 != null && opt3 != null) ? mapping(value(opt1), value(opt2), value(opt3)) : undefined;
|
|
93
|
+
}
|
|
94
|
+
export function bind(binder, opt) {
|
|
95
|
+
return opt != null ? binder(value(opt)) : undefined;
|
|
96
|
+
}
|
|
97
|
+
export function tryOp(op, arg) {
|
|
98
|
+
try {
|
|
99
|
+
return some(op(arg));
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { ArgumentNullException_$ctor_Z721C83C5, ArgumentOutOfRangeException_$ctor_Z721C83C5 } from "./System.js";
|
|
2
|
+
import { Operators_IsNull } from "./FSharp.Core.js";
|
|
3
|
+
import { class_type } from "./Reflection.js";
|
|
4
|
+
import { fromFloat64, op_Addition, toInt32_unchecked, toFloat64, compare, fromInt32, toInt64_unchecked } from "./BigInt.js";
|
|
5
|
+
import { item, setItem } from "./Array.js";
|
|
6
|
+
function Native_random() {
|
|
7
|
+
return Math.random();
|
|
8
|
+
}
|
|
9
|
+
function Native_randomNext(minValue, maxValue) {
|
|
10
|
+
if (maxValue < minValue) {
|
|
11
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("minValue must be less than maxValue");
|
|
12
|
+
}
|
|
13
|
+
return Math.floor(Math.random() * (maxValue - minValue)) + minValue;
|
|
14
|
+
}
|
|
15
|
+
function Native_randomBytes(buffer) {
|
|
16
|
+
if (Operators_IsNull(buffer)) {
|
|
17
|
+
throw ArgumentNullException_$ctor_Z721C83C5("buffer");
|
|
18
|
+
}
|
|
19
|
+
for (let i = 0; i < buffer.length; i += 6) {
|
|
20
|
+
// Pick random 48-bit number. Fill buffer in 2 24-bit chunks to avoid bitwise truncation.
|
|
21
|
+
let r = Math.floor(Math.random() * 281474976710656); // Low 24 bits = chunk 1.
|
|
22
|
+
const rhi = Math.floor(r / 16777216); // High 24 bits shifted via division = chunk 2.
|
|
23
|
+
for (let j = 0; j < 6 && i + j < buffer.length; j++) {
|
|
24
|
+
if (j === 3) {
|
|
25
|
+
r = rhi;
|
|
26
|
+
}
|
|
27
|
+
buffer[i + j] = r & 255;
|
|
28
|
+
r >>>= 8;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
;
|
|
32
|
+
}
|
|
33
|
+
export class NonSeeded {
|
|
34
|
+
constructor() {
|
|
35
|
+
}
|
|
36
|
+
Next0() {
|
|
37
|
+
return Native_randomNext(0, 2147483647) | 0;
|
|
38
|
+
}
|
|
39
|
+
Next1(maxValue) {
|
|
40
|
+
return Native_randomNext(0, maxValue) | 0;
|
|
41
|
+
}
|
|
42
|
+
Next2(minValue, maxValue) {
|
|
43
|
+
return Native_randomNext(minValue, maxValue) | 0;
|
|
44
|
+
}
|
|
45
|
+
NextDouble() {
|
|
46
|
+
return Native_random();
|
|
47
|
+
}
|
|
48
|
+
NextBytes(buffer) {
|
|
49
|
+
Native_randomBytes(buffer);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function NonSeeded_$reflection() {
|
|
53
|
+
return class_type("Random.NonSeeded", undefined, NonSeeded);
|
|
54
|
+
}
|
|
55
|
+
export function NonSeeded_$ctor() {
|
|
56
|
+
return new NonSeeded();
|
|
57
|
+
}
|
|
58
|
+
export class Seeded {
|
|
59
|
+
constructor(seed) {
|
|
60
|
+
this.MBIG = 2147483647;
|
|
61
|
+
this.inext = 0;
|
|
62
|
+
this.inextp = 0;
|
|
63
|
+
this.seedArray = (new Int32Array(56));
|
|
64
|
+
let ii = 0;
|
|
65
|
+
let mj = 0;
|
|
66
|
+
let mk = 0;
|
|
67
|
+
const subtraction = ((seed === -2147483648) ? 2147483647 : Math.abs(seed)) | 0;
|
|
68
|
+
mj = ((161803398 - subtraction) | 0);
|
|
69
|
+
this.seedArray[55] = (mj | 0);
|
|
70
|
+
mk = 1;
|
|
71
|
+
for (let i = 1; i <= 54; i++) {
|
|
72
|
+
ii = (((21 * i) % 55) | 0);
|
|
73
|
+
this.seedArray[ii] = (mk | 0);
|
|
74
|
+
mk = ((mj - mk) | 0);
|
|
75
|
+
if (mk < 0) {
|
|
76
|
+
mk = ((mk + this.MBIG) | 0);
|
|
77
|
+
}
|
|
78
|
+
mj = (item(ii, this.seedArray) | 0);
|
|
79
|
+
}
|
|
80
|
+
for (let k = 1; k <= 4; k++) {
|
|
81
|
+
for (let i_1 = 1; i_1 <= 55; i_1++) {
|
|
82
|
+
this.seedArray[i_1] = ((item(i_1, this.seedArray) - item(1 + ((i_1 + 30) % 55), this.seedArray)) | 0);
|
|
83
|
+
if (item(i_1, this.seedArray) < 0) {
|
|
84
|
+
this.seedArray[i_1] = ((item(i_1, this.seedArray) + this.MBIG) | 0);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
this.inext = 0;
|
|
89
|
+
this.inextp = 21;
|
|
90
|
+
}
|
|
91
|
+
Next0() {
|
|
92
|
+
const this$ = this;
|
|
93
|
+
return Seeded__InternalSample(this$) | 0;
|
|
94
|
+
}
|
|
95
|
+
Next1(maxValue) {
|
|
96
|
+
const this$ = this;
|
|
97
|
+
if (maxValue < 0) {
|
|
98
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("maxValue must be positive");
|
|
99
|
+
}
|
|
100
|
+
return ~~(Seeded__Sample(this$) * maxValue) | 0;
|
|
101
|
+
}
|
|
102
|
+
Next2(minValue, maxValue) {
|
|
103
|
+
const this$ = this;
|
|
104
|
+
if (minValue > maxValue) {
|
|
105
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("minValue must be less than maxValue");
|
|
106
|
+
}
|
|
107
|
+
const range = toInt64_unchecked(fromInt32(maxValue - minValue));
|
|
108
|
+
return ((compare(range, toInt64_unchecked(fromInt32(2147483647))) <= 0) ? (~~(Seeded__Sample(this$) * toFloat64(range)) + minValue) : ~~toInt32_unchecked(toInt64_unchecked(op_Addition(toInt64_unchecked(fromFloat64(Seeded__GetSampleForLargeRange(this$) * toFloat64(range))), toInt64_unchecked(fromInt32(minValue)))))) | 0;
|
|
109
|
+
}
|
|
110
|
+
NextDouble() {
|
|
111
|
+
const this$ = this;
|
|
112
|
+
return Seeded__Sample(this$);
|
|
113
|
+
}
|
|
114
|
+
NextBytes(buffer) {
|
|
115
|
+
const this$ = this;
|
|
116
|
+
if (Operators_IsNull(buffer)) {
|
|
117
|
+
throw ArgumentNullException_$ctor_Z721C83C5("buffer");
|
|
118
|
+
}
|
|
119
|
+
for (let i = 0; i <= (buffer.length - 1); i++) {
|
|
120
|
+
setItem(buffer, i, (Seeded__InternalSample(this$) % (~~255 + 1)) & 0xFF);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export function Seeded_$reflection() {
|
|
125
|
+
return class_type("Random.Seeded", undefined, Seeded);
|
|
126
|
+
}
|
|
127
|
+
export function Seeded_$ctor_Z524259A4(seed) {
|
|
128
|
+
return new Seeded(seed);
|
|
129
|
+
}
|
|
130
|
+
function Seeded__InternalSample(_) {
|
|
131
|
+
let retVal = 0;
|
|
132
|
+
let locINext = _.inext;
|
|
133
|
+
let locINextp = _.inextp;
|
|
134
|
+
locINext = ((locINext + 1) | 0);
|
|
135
|
+
if (locINext >= 56) {
|
|
136
|
+
locINext = 1;
|
|
137
|
+
}
|
|
138
|
+
locINextp = ((locINextp + 1) | 0);
|
|
139
|
+
if (locINextp >= 56) {
|
|
140
|
+
locINextp = 1;
|
|
141
|
+
}
|
|
142
|
+
retVal = ((item(locINext, _.seedArray) - item(locINextp, _.seedArray)) | 0);
|
|
143
|
+
if (retVal === _.MBIG) {
|
|
144
|
+
retVal = ((retVal - 1) | 0);
|
|
145
|
+
}
|
|
146
|
+
if (retVal < 0) {
|
|
147
|
+
retVal = ((retVal + _.MBIG) | 0);
|
|
148
|
+
}
|
|
149
|
+
_.seedArray[locINext] = (retVal | 0);
|
|
150
|
+
_.inext = (locINext | 0);
|
|
151
|
+
_.inextp = (locINextp | 0);
|
|
152
|
+
return retVal | 0;
|
|
153
|
+
}
|
|
154
|
+
export function Seeded__Sample(this$) {
|
|
155
|
+
return Seeded__InternalSample(this$) * (1 / this$.MBIG);
|
|
156
|
+
}
|
|
157
|
+
export function Seeded__GetSampleForLargeRange(this$) {
|
|
158
|
+
let result = Seeded__InternalSample(this$);
|
|
159
|
+
if ((Seeded__InternalSample(this$) % 2) === 0) {
|
|
160
|
+
result = -result;
|
|
161
|
+
}
|
|
162
|
+
let d = result;
|
|
163
|
+
d = (d + (2147483647 - 1));
|
|
164
|
+
d = (d / (2 * ((2147483647 - 1) >>> 0)));
|
|
165
|
+
return d;
|
|
166
|
+
}
|
|
167
|
+
export function nonSeeded() {
|
|
168
|
+
return NonSeeded_$ctor();
|
|
169
|
+
}
|
|
170
|
+
export function seeded(seed) {
|
|
171
|
+
return Seeded_$ctor_Z524259A4(seed);
|
|
172
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Exception, compare } from "./Util.js";
|
|
2
|
+
import { unfold, delay } from "./Seq.js";
|
|
3
|
+
import { toUInt64_unchecked, toInt64_unchecked, op_Addition, fromZero } from "./BigInt.js";
|
|
4
|
+
import { op_Addition as op_Addition_1, fromParts } from "./Decimal.js";
|
|
5
|
+
export function makeRangeStepFunction(step, stop, zero, add) {
|
|
6
|
+
const stepComparedWithZero = compare(step, zero) | 0;
|
|
7
|
+
if (stepComparedWithZero === 0) {
|
|
8
|
+
throw new Exception("The step of a range cannot be zero");
|
|
9
|
+
}
|
|
10
|
+
const stepGreaterThanZero = stepComparedWithZero > 0;
|
|
11
|
+
return (x) => {
|
|
12
|
+
const comparedWithLast = compare(x, stop) | 0;
|
|
13
|
+
return ((stepGreaterThanZero && (comparedWithLast <= 0)) ? true : (!stepGreaterThanZero && (comparedWithLast >= 0))) ? [x, add(x, step)] : undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function integralRangeStep(start, step, stop, zero, add) {
|
|
17
|
+
const stepFn = makeRangeStepFunction(step, stop, zero, add);
|
|
18
|
+
return delay(() => unfold(stepFn, start));
|
|
19
|
+
}
|
|
20
|
+
export function rangeBigInt(start, step, stop) {
|
|
21
|
+
return integralRangeStep(start, step, stop, fromZero(), op_Addition);
|
|
22
|
+
}
|
|
23
|
+
export function rangeDecimal(start, step, stop) {
|
|
24
|
+
return integralRangeStep(start, step, stop, fromParts(0, 0, 0, false, 0), op_Addition_1);
|
|
25
|
+
}
|
|
26
|
+
export function rangeDouble(start, step, stop) {
|
|
27
|
+
return integralRangeStep(start, step, stop, 0, (x, y) => (x + y));
|
|
28
|
+
}
|
|
29
|
+
export function rangeInt64(start, step, stop) {
|
|
30
|
+
return integralRangeStep(start, step, stop, 0n, (x, y) => toInt64_unchecked(op_Addition(x, y)));
|
|
31
|
+
}
|
|
32
|
+
export function rangeUInt64(start, step, stop) {
|
|
33
|
+
return integralRangeStep(start, step, stop, 0n, (x, y) => toUInt64_unchecked(op_Addition(x, y)));
|
|
34
|
+
}
|
|
35
|
+
export function rangeChar(start, stop) {
|
|
36
|
+
const intStop = ~~stop.charCodeAt(0) | 0;
|
|
37
|
+
return delay(() => unfold((i) => {
|
|
38
|
+
if (i <= intStop) {
|
|
39
|
+
return [String.fromCharCode(i & 0xFFFF), i + 1];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}, ~~start.charCodeAt(0)));
|
|
45
|
+
}
|