beginner question - sets

2023-08-13 Thread hugogranstrom
Use `incl` instead of `add` for sets

Why does ref object have this behaviour?

2023-08-08 Thread hugogranstrom
A `ref object` is basically a fancy pointer. Thus `a.addr` will give you a pointer to that pointer, and not the pointer value of `a`. If you dereference `a` using `a[].addr` you will get the pointer to the memory that `a` points to.

How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType")

2023-08-05 Thread hugogranstrom
Sweet! :D Macros are pretty frickin' cool when you realize how simple they can be! As for pragma, you should be set to go already:

How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType")

2023-08-05 Thread hugogranstrom
> Did you try this out? As long as the proc body is valid (which it is in this > case), it should to the best of my knowledge just work I'll add a bit more on this and how to solve this kind of problem when it doesn't work. Let's say that `generateMrapper` injected a new variable in your proc,

How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType")

2023-08-05 Thread hugogranstrom
I'm not entirely sure I understand you completely, but I read it as you wanting a nicer syntax for your `generateMapper` macro? > For context on why I have 2 parameters in my macro: I'm so far under the > impression that I need to keep the procdef and the explicit assignment > statements below

How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType")

2023-08-05 Thread hugogranstrom
To get the type of a node, you need to use a `typed` macro: macro generateMapper(body: typed): untyped = Run Simplified explanation: An untyped macro doesn't know anything about what each identifier (ident) actually refers to. A typed macro instead used symbols (as ne

Karkas: Karax library to build layouts and work with styles

2023-08-03 Thread hugogranstrom
Nice work, will try this out next time I need to create something requiring layouts :) > I'd like to do a special shoutout to the Nimibook team. In the docs, the > frontend samples are rendered live inside the doc pages, thanks to Nimib's > nbKaraxCode blocks. It's such a powerful feature, I'm

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2023-06-29 Thread hugogranstrom
nimiSlides v0.2.3 has been released! It contains multiple quality of life changes as well as the first steps towards a proper documentation. You can see the API docs [here](https://hugogranstrom.com/nimiSlides/docs/nimiSlides.html). And I have spent time writing tutorials for most of the feature

Using templates with generic or untyped parameters

2022-11-17 Thread hugogranstrom
If you want something more robust, the union library might be worth looking into as well:

Using templates with generic or untyped parameters

2022-11-17 Thread hugogranstrom
Ok, then I think I understand a bit of the problem. I have written a quick macro (bugs may exist) `expandIfCall` which let's you write inline if-statements like you showed earlier: What it does is essentially if you write: expandIfCall fun(if co

Using templates with generic or untyped parameters

2022-11-17 Thread hugogranstrom
Is `iterateThrough` equivalent of `doSth` in your example above? Or is it the body of it that you want to use things like this in? if myBool: 2 else: "X" Run

Using templates with generic or untyped parameters

2022-11-17 Thread hugogranstrom
I don't really understand what you mean, wouldn't you have to have 2^N of these inline versions instead? I think I would need an example with at least two of these "switches" and how they are related to be able to suggest a good solution.

Using templates with generic or untyped parameters

2022-11-17 Thread hugogranstrom
if myBool: 2 else: "X" Run is invalid because it is only determined at _runtime_ which type it will be. Hence the compiler can't know at compile-time which type the expression has. If you can use `when` instead of `if` I think it could work, but the `myBool` needs to be known

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-11-02 Thread hugogranstrom
That's a good point, will add it to the readme when I get home :) It's great to get feedback on things like this. I'm so used to nimib and nimiSlides so it's hard sometimes to get into the shoes of someone new to them.

NimConf 2022 - Saturday, October 22nd

2022-10-22 Thread hugogranstrom
My slides and the source for them can be found in the niiSlides repo: <https://github.com/HugoGranstrom/nimiSlides>

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-27 Thread hugogranstrom
As for the NimConf theme, this is as close as I have come to replicating the general look of PMunch's presentation: [image link](https://imgur.com/a/0mjgokF). The code for achieving this look is: template nimConfSlide(body: untyped) = ## Use this instead of `slide`, it will p

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-27 Thread hugogranstrom
Thank you, glad you liked it 😁 (it was your idea afterall ;))

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-27 Thread hugogranstrom
The new release is out! You can see the [changelog here](https://github.com/HugoGranstrom/nimiSlides/releases/tag/v0.2).

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-27 Thread hugogranstrom
The latest and last addition to nimiSlides 0.2 is actually adding an image in the corner so with it you should be able to get basically the same layout as PMunch had. I plan to release it tonight, so I'll get back to you tomorrow with a more complete set of templates you could use.

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-26 Thread hugogranstrom
Before going to bed now, I've thrown together something that you could use to get colors working: template nimConfTheme*() = setSlidesTheme(Black) nb.addStyle: """ :root { --r-heading-color: #ffe220; --r-link-color: #ffe220; --r-selection-color: #ffe

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-09-26 Thread hugogranstrom
I haven't thought about that tbh. Do you have any ideas in mind? Black background, yellow text and the Nim-logo somewhere on the page?

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-08-17 Thread hugogranstrom
> Is it possible to get the current slide number over the total number of > slides ? I have added `showSlideNumber()` and updated the [showcase](https://hugogranstrom.com/nimiSlides/showcase.html) to include it. > I see that the slides are not disposed in a linear way Indeed, you have the opti

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-08-17 Thread hugogranstrom
Thanks Pietro 😄 Feel free to share any slideshows you make using nimiSlide in this thread. I want to see them all 🤩

nimiSlides 🛷 Create beautiful slideshows in Nim 👑

2022-08-16 Thread hugogranstrom
# nimiSlides 🛷 Create beautiful slideshows in Nim 👑 [nimiSlide](https://github.com/HugoGranstrom/nimiSlides) is a library for making presentations about Nim, in Nim. It's a [nimib](https://github.com/pietroppeter/nimib) theme which uses [Reveal.js](https://revealjs.com/) to mak

how to call a function (that works on the dom) in karax after page is loaded

2022-08-03 Thread hugogranstrom
In other SPA frameoworks what you are looking for would probably be named "lifecycle hooks", the closest I could find was `postRenderCallback` first implemented in this PR: It can be supplied using `setRenderer`:

Nimib with release 0.3 becomes interactive

2022-08-03 Thread hugogranstrom
❤️ I think it was solved in this [PR](https://github.com/pietroppeter/nimibook/pull/50) but Nimibook 0.3 haven't been released yet. I think it's mainly documentation that is missing so it should be safe to use the latest commit. Could you try changing the dependency temporarily to `nimibook@#h

Nimib with release 0.3 becomes interactive

2022-08-02 Thread hugogranstrom
It's a pleasure and honor to join the nimib team ♥️ Writing a Nim tutorial has never been easier than with Nimib. You can literally start with the finished program, divide it into code chunks in nbCode blocks and intersperse them with explainations in nbText blocks. And in the end you can be re

Mastering Nim: A complete guide to the programming language

2022-06-23 Thread hugogranstrom
Nice with a new Nim book, but not making it available as an e-book is a dealbreaker for me.

Nim v2: what would you change?

2022-05-01 Thread hugogranstrom
> That's something that can always happen without breakage. Let's focus on > language/stdlib changes that need breakage :) The problem is that it won't happen _ever_ if not someone who knows the compiler actually does it... It may not be a backward-breaking change, but it certainly is a **back-

A love letter to SciNim

2022-01-22 Thread hugogranstrom

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread hugogranstrom
Plausible is really nice, here's an example of the analytics for SciNim's getting-started page (which @pietroppeter is kindly providing us with) of what kind of stats you get: [Plausible Analytics](https://plausible.io/scinim.github.io%2Fgetting-started)

Nim Community Survey 2021

2022-01-15 Thread hugogranstrom
I'm curious, have the graphs been made using Nim this year? Otherwise, tell us to remind you next year ;)

Pandas Equivalent for Nim?

2021-11-12 Thread hugogranstrom
We also have which is built on top of Arraymancer

Nim receives $100k in Bitcoin donations

2021-10-25 Thread hugogranstrom
Nice thanks :) But you can still answer what all the money you have gotten up until now have been used for ;) Or has it only been piled up on a bank account somewhere? I've gotten the impression from reading the chat over time that some people are paid to do work on the compiler but I haven't r

Nim receives $100k in Bitcoin donations

2021-10-25 Thread hugogranstrom
I would be interested to know what Nim are doing with its money and what your future intentions are. For example, is anyone getting payed, who and how much in such cases?

Nim 2.0 -- thoughts

2021-10-10 Thread hugogranstrom
During my years lurking in the Nim community, I've got the impression that the Nim compiler has evolved a lot during the years but sadly hasn't been refactored when new big changes have been made, but instead they were added on top of the old framework. And this fact of adding ad-hoc solutions u

Futhark: Automatic C imports in Nim using libclang

2021-09-23 Thread hugogranstrom
To be fair, c2nim's manual labor prevents many wrappers to be written _at all_. Better with a simple non-idiomatic wrapper than none at all.

Nim 1.6.0 RC1

2021-09-20 Thread hugogranstrom
If we are willing to play with fire (old `nimble develop`), then let us. Don't take away our lighters just because **you** think it's a bad idea.

The "reset password" routine does not seem to send me a message at my e-mail address

2021-09-15 Thread hugogranstrom
It feels like emails has been a problem for ages here on the forum. Every once in a while someone comes on Discord asking why they can't join the forum because they didn't get an email...

Is it possible to pass a list/array of types to a function?

2021-08-03 Thread hugogranstrom
If you really don't want to use a macro you could create a dummy variable of a tuple of the types you want like this: proc niceSize(a: tuple): int = for f in a.fields: result += sizeof f var temp: (int64, int8, int16) echo niceSize(temp) Run

Is it possible to have generic object members?

2021-08-03 Thread hugogranstrom
Well, the point of keeping track of side-effects is that you keep track of them... It's the "leaf functions" (functions that doesn't depend on other functions) that should be funcs, and then the rest of the functions can be funcs or procs depending on **what they actually are**. For example the

Is it possible to have generic object members?

2021-08-03 Thread hugogranstrom
You do you and if it works, nice! But I personally wouldn't use casting when safer alternatives are available though, but you do you :) Also something I'm not understanding: func getUniqueId(): int = {.cast(noSideEffect).}: var idCounter {.global.} = 0

Is it possible to have generic object members?

2021-08-03 Thread hugogranstrom
It ain't pretty but it works: 🙃

Is it possible to have generic object members?

2021-08-03 Thread hugogranstrom
Sadly it doesn't work out of the box but it is possible using macros to generate the `ImportantStuff` type and `get` proc automatically. type ImportantStuff = object littleMember_int: seq[int] littleMember_float: seq[float] littleMember_ComponentTypeA: seq[Com

Is it possible to have generic object members?

2021-08-03 Thread hugogranstrom
As @xigoi said, it's the object itself that is generic, not its fields. This is the correct code: type ImportantStuff[T] = object littleMember: seq[T] func get[T](a: ImportantStuff[T], i: int): T = a.littleMember[i] var c: ImportantStuff[int] dis

Possible to have a reference in a seq of another type?

2021-08-02 Thread hugogranstrom
> And as far as I know the reason why it's not used in Nim is not Types, but > Memory Layout. That is very true and it was actually this I had in my head. > With this reasoning you also may say, that Nim Variant Object is unsafe, > because unless you manually inspect its kind you don't know wha

Possible to have a reference in a seq of another type?

2021-08-02 Thread hugogranstrom
Luckily Nim isn't Typescript. I don't see that as type-safe at all. Unless you manually inspect the list you would NOT know whether `list[0]` is a number, string or Whatewer, that isn't type-safe! In Nim you know exactly what type you get from `a[0]`, that is type-safety.

How can I point to (the memory adress of) a variable?

2021-07-20 Thread hugogranstrom
> Yeah but how is pointing to the memory address of a variable unsafe? The (unsafe) pointer could exist longer than the memory it is pointing to, thus it is unsafe. Nim has multiple ways to handle pointer safely. One of them is `var T` which can be used like this in a function: pro

Migrated Norm docs to nimibook and loving it!

2021-07-20 Thread hugogranstrom
I think it depends entirely on what kind of content you are writing. For Docs, it may very well be more readable in a single view because then everything is about a single package. Other use-cases like SciNim's [getting-started](https://scinim.github.io/getting-started/) that span a wide range

Migrated Norm docs to nimibook and loving it!

2021-07-20 Thread hugogranstrom
You open an issue on NimiBook :) It _should_ not be too hard to just concatinate all the generated files into one big file. Something we don't support yet that will have to be added beforehand, is linkable headers.

Migrated Norm docs to nimibook and loving it!

2021-07-19 Thread hugogranstrom
Great to hear you enjoyed it! 😄 Pietro really has created a really powerful and extensible framework for writing code and text in a great manner. You could do virtually anything you want with it without any boilerplate thanks to metaprogramming in Nim. Regarding build times, yes it's quite slow

Binary unicode operators

2021-06-19 Thread hugogranstrom
Unicode in symbols are already supported: And I don't see it being misused too much. This proposal is just related to unicode in operators. If someone wrote a package using Chinese or Hiieroglyphs extensivly they would immediately lose a big portion of their

Binary unicode operators

2021-06-18 Thread hugogranstrom
The `Windows + .` is neat and I may eventually have fallen victim to the same behavior as you 🤫 I haven't checked much beyond the emojis but you are correct, there's all kinds of unicode symbols in there :O αΔ⨌³₁ↆ If it's this accessible then my entire argument falls apart :) I found [WinCompos

Binary unicode operators

2021-06-18 Thread hugogranstrom
@araq to be fair your example is both hard to read and hard to type (or to remember at least). So no wonder people don't use them. These Unicode operators would on the contrary be easy to read and easy to write for some but not others, so the comparison isn't fair imo. I can agree though that an

Binary unicode operators

2021-06-18 Thread hugogranstrom
If we are to go this path I think @xigoi's proposal sounds interesting because we must have a **simple** way of writing the Unicode symbols without having to google some obscure key combination you impossibly can remember. Julia fixes this in its tooling by providing tab-completions for the symb

SciNim - Call for tutorial ideas

2021-06-18 Thread hugogranstrom
> Maybe I'm not clear what I ment by Literate Nim Format. It's like plain Nim > code, with the only difference that all the code is indented by +2 spaces and > whatever is not intented by +2 spaces are threated as comments/text. Like Nim > source filters with 2 spaces as metaChar. Thank you for

SciNim - Call for tutorial ideas

2021-06-17 Thread hugogranstrom
It feels like we are talking about two separate things here. NimiBook isn't an alternative to Jupyter Notebooks (yet) but rather to mdBook and Gitbook, ie it generates static websites. Nimib is all about the generation of these HTML documents from Nim code. The reason we don't see this in a lot

SciNim - Call for tutorial ideas

2021-06-17 Thread hugogranstrom
As long as it's science- and Nim-related I'd say it's a fit. The limiting factor is that someone has to write the tutorials in the end of the day :)

SciNim - Call for tutorial ideas

2021-06-17 Thread hugogranstrom
I have very little familiarity with literal code style (google didn't help me either) but I agree with Vindaar that for coding tutorials the code is the king of the show. And by construct, Nimib does something which is crucial for keeping the tutorials updated: it compiles the code blocks and ma

SciNim - Call for tutorial ideas

2021-06-15 Thread hugogranstrom
[SciNim](https://github.com/scinim/) is an initiative to unite all scientific Nim packages under a common umbrella, and making sure they play along nicely with each other. Examples of packages we currently work on are [Flambeau](https://github.com/scinim/flambeau) (a wrapper for Pytorch's backe

Tetronimia: a version of *that* game for your terminal

2021-06-04 Thread hugogranstrom
Not going to go on anymore after this message 😄 but choosenim is so nice (if it would have worked with the lastest devel 🙃) that it could be used exactly for the sole purpose of switching a devel branch to try out a game because it is equally easy to go back to stable again. The only real cost i

Tetronimia: a version of *that* game for your terminal

2021-06-04 Thread hugogranstrom
Choosenim doesn't work or the game doesn't work on your `devel`?

Tetronimia: a version of *that* game for your terminal

2021-06-04 Thread hugogranstrom
@cantanima Time to try out choosenim perhaps? ;) Easy as `choosenim devel`

Open file > 2GB on raspi OS 32

2021-05-26 Thread hugogranstrom
I've hit similar issues on 64-bit Windows in asyncHttpclient and zip. And in the case of as asyncHttpClient it was exactly as enthus1ast says that it was a signed 32bit integer that was spooking. For me, it was `DWORD` (

Nim 2.0 -- thoughts

2021-05-15 Thread hugogranstrom
Look at that! :o I've managed to miss that it even exists :) It isn't very easily findable though unless you know exactly what you are looking for, hard to find a good keyword to search for when you don't know what you're looking for. `prelude` wasn't the first term that came to my mind at least

Nim 2.0 -- thoughts

2021-05-15 Thread hugogranstrom
Very interesting to hear your thoughts. It feels great to not have to fear anything resembling the Python2 -> Python3 transition. I don't know if it has been brought up before (it feels familiar) but if we are splitting `os.nim` into smaller packages, then it means even more std library names to

XML parsing performance

2021-04-25 Thread hugogranstrom
If I'm allowed to throw in my 5 cent into the discussion I think we should have a pinned FAQ forum thread with the title "FAQ - Read this before posting!" or something along those lines. And the top entry should of course be `--d:release` vs `--d:debug`. That way we can get their attention when

How to embed objects in another objects

2021-03-06 Thread hugogranstrom
You're welcome :)

How to embed objects in another objects

2021-03-06 Thread hugogranstrom
When you initilize your car it expects you to pass in an object of type `Battery` to the electric car's `battery_size` parameter (because that is what you defined it to be). So you must wrap your `70` in a `Battery` object like this: var c = ElectricCar(year: 2019, battery_size: B

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-21 Thread hugogranstrom
I ran `nimble install fusion` and then tried to import it and it worked

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread hugogranstrom
That's very true, a macro can solve most abstractions. It's always more convenient to use a macro someone else maintains instead of trying to find bugs in your own niche code ;) For you, I can totally understand that it's of utmost importance to get every ounce of speed out of it. Nim's meta pro

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread hugogranstrom
That certainly is a clever way to do it :) and probably more performant than pattern matching. The downside is that it's less readable and I'd have to memorize what each of the enum values represent. And readablility is high on my priority list. Or I could probably use `ord(symNumber)` in the `o

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread hugogranstrom
Oh yeah so enjoyful xD That's what happens when one wants to save the AST tree in a reasonably easy to handle way (:

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread hugogranstrom
Ohhh that seems really interesting! :D Gotta check it out a bit more, have heard people praise it on Discord a lot lately. Pattern matching seems really powerful and I could probably use it in other places in my lib as well. Thank you for your help and great job on writing the library in the fir

Any way to avoid nested case statements for proc taking two variant objects?

2021-02-20 Thread hugogranstrom
I have a variant object with 7 different kinds that I want to do some operations on (eg. addition, multiplication) but it becomes really ugly as I have to nest two case statements and end up with 49 branches in the end and that's really ugly. Here's what it looks like currently when I only popul

Google Summer of Code, Feb 19, 2021

2021-01-17 Thread hugogranstrom
Ah ok that's a fair point :) I have fallen into that pit many times myself. In this case concepts seems to be a great fit. It's not really related to imports in any way though, more about unclearities on which procs must be defined for objects.

Google Summer of Code, Feb 19, 2021

2021-01-16 Thread hugogranstrom
I actually see Nim's error messages as really good. I can easily see the codepath which caused my error. The problem with that specific example is that the compiler can't know where for example `Table` could be defined. It could be from the stdlib tables but nothing is stopping you from defining

Advent of Nim 2020 megathread

2020-12-04 Thread hugogranstrom
I'll chip in with my repo as well. It's not the prettiest and simplest solutions but they do work 🙃https://github.com/HugoGranstrom/AdventOfNim

Is there any nim based 2d collision detection lib?

2020-11-27 Thread hugogranstrom
I saw this the other day, maybe it is of interest?

strange syntax - please explain

2020-11-08 Thread hugogranstrom
I don't think it's so strange because they mean two different thing depending on if there is a space between the minus sign and the one. * "\- 1" mean "something minus 1" * "-1" means "negative 1" So when you write `RIn -1` it should be read "RIn neagtive 1" as Nim's function calling synt

What Nim projects are you working on?

2020-10-24 Thread hugogranstrom
I'm mainly doing stuff in computational science and I'm tinkering with my two libraries [NumericalNim](https://github.com/HugoGranstrom/numericalnim/) (numerical integration, ODE, interpolation) and [SymbolicNim](https://github.com/HugoGranstrom/symbolicnim) (symbolic algebra like

Version 1.4.0 released

2020-10-18 Thread hugogranstrom
That was a really good summary! :D

A nice read about Nim (blog article)

2020-10-14 Thread hugogranstrom
Probably something else that's limiting as well, but what about putting the CT/RT object definitions in a `when nimvm: ### else: ###`?

Attracting more people...

2020-09-06 Thread hugogranstrom
I agree, pictures is a very effective way to get people's attention and to convey information. [Julia's](https://julialang.org/) website got a "Ecosystem" section if you scroll down just a bit where they showcase a picture or animation from each one of its most common areas. Something along the

SymbolicNim, symbolic algebra in Nim

2020-09-02 Thread hugogranstrom
Symbolicnim is now on Nimble: `nimble install symbolicnim` And to celebrate it I bring you `subs` so you can fullfill all your substitution needs. It's what you could expect: echo subs(sin(x + y)^z, x + y, z) # sin(z)^z Run And to showcase it a bit I've implemented a

SciNim / Nim-science: IRC-Discord-Gitter bridge

2020-08-21 Thread hugogranstrom
I agree, it would make it easier for people new to Nim to see that there is a Science community here. Right now you have to be lucky to find it basically :P

SymbolicNim, symbolic algebra in Nim

2020-08-19 Thread hugogranstrom
The lastest release of SymbolicNim (0.2.1) uses the new AST now. In my microbenchmarks I've seen a big improvement in performance compared to the old AST (it's faster than sympy for this benchmark as well fwiw). This new AST is inspired by @mratsim's in Lux but simpler in some senses and more co

General recommendation for optimum performance?

2020-08-19 Thread hugogranstrom
That feeling when you find the one thing that makes your code 50x faster, wonderful! 🤩 In this case it was caching of hashes for Nodes in a AST.

General recommendation for optimum performance?

2020-08-19 Thread hugogranstrom
Ohhh... I thought I had to have them so I actived them :P Now that looks a lot better! Thank you! :D

General recommendation for optimum performance?

2020-08-19 Thread hugogranstrom
I downloaded VTune and ran it on one of my programs. Is it normal that `nimFrame` is listed as 4/5 hotspots?

New blog post: Ray tracing in Nim

2020-08-17 Thread hugogranstrom
Ok, yeah then I get what you're getting at :) A certain amount of overhead must always be expected from a scheduler but this suggests there's room for improvements (Weave is relatively young after all).

New blog post: Ray tracing in Nim

2020-08-17 Thread hugogranstrom
Isn't a high CPU usage a good thing when it comes to multithreading? It means more of the cpu is utilized. But if they are doing the same work in the same amount of time then I understand your concerns. Have you benchmarked how fast Weave and threadpool takes to finish? Are they equally fast?

SymbolicNim, symbolic algebra in Nim

2020-08-16 Thread hugogranstrom
a symbolic expression to one (or several) procs: [in the compileTime branch](https://github.com/HugoGranstrom/symbolicnim/blob/7240a365717c2ba450ca32bb024cdb4d6a088b80/src/symbolicnim/CTsymbolicnim.nim#L519) The code isn't as clean as @mratsim's but it does have more of a focus on bei

Nim website front page redesign (unofficial and WIP)

2020-08-15 Thread hugogranstrom
I quite like the moving crown actually, gives it some "character", it's an eye-catcher for new users (can't find a good english word for it) ;)

Compiler Seg faulting when using "object" instead of "ref object" for nested object.

2020-08-15 Thread hugogranstrom
I'm just curious, wouldn't a ordinary object type like your `Node` which is nested in itself use an infinite amount of memory? Because the first Node will save its `next` Node directly besides it in memory. And it will then do the same until you have filled the entire heap? Using a `ref object`

Nim website front page redesign (unofficial and WIP)

2020-08-15 Thread hugogranstrom
Looks really good on mobile now :D the playground and the pragma titles looks even better. They feel more intentional now

SymbolicNim, symbolic algebra in Nim

2020-08-14 Thread hugogranstrom
Just an idea: we create a pragma for the different passes and then you add a simplification proc by adding the correct pragma to it. The code then get's added to a global "simplification database" that is executed when compiling or calling simplify() on a symbolic expression. For example:

SymbolicNim, symbolic algebra in Nim

2020-08-14 Thread hugogranstrom
The problem I've had with Term rewriting macros is that they can only be used a certain number of times before it is ignored. So any code that contains more than a few of these simplifications will only be partially simplified (ex: up to line 20 and not below that). But your point about it not r

SymbolicNim, symbolic algebra in Nim

2020-08-14 Thread hugogranstrom
Yes but the problem is that the compiler doesn't know about the simplifications for Besselfunctions because it is defined by a user. Perhaps the easiest way to solve this problem is for them to make a PR to the symbolic compiler and add it in the deep embedding instead of creating their own? 🤷

SymbolicNim, symbolic algebra in Nim

2020-08-13 Thread hugogranstrom
I'm thinking something in the lines of this: [https://play.nim-lang.org/#ix=2u5w](https://play.nim-lang.org/#ix=2u5w) But more advanced of course.

  1   2   >