LDQ: I'm making a language with macros. I'm thinking I'll probably have to compile the modules with macros before the modules that depend on them. One way to do that would be to go through all the modules before doing anything to see which modules they depend on. Another, much easier, way to do that would be to have the user declare which modules they're using at the top of each module, sorta like Python. Which would you guys recommend? (are there other solutions I'm missing?)
I think I'll just go with the first solution. It's more difficult to implement but much easier for users
But for the compiler to know that the Foo module is being used somewhere in your module, it'd either have to go through your entire module or you'd have to declare that you're using Foo at the top
Yeah, I was considering ::, but it's actually not possible to do Foo.bar on a type Foo here, so it's alright
Only problem would be if you do something like import Foo.Bar and there happens to be both a module Bar and a type Bar in Foo. I'll probably just have both the module and the type added to the scope then
you could also make it possible to represent overloading on the type level, which may work great or absolutely terribly depending on what kind of overloading you have :P
i was thinking more if you don't go for the correct approach of typeclasses, you'd have the overload type implicitly get built up with function definitions but not with normal values
@user say i have foo(1). the AST will be smth like Call(Variable(foo), 1). so when typing the call, it will also save the types of its arguments (Int) and pass that on when typing foo to get the correct overload
id like to allow overloading for function variables but thatll be weird; why should it only work on function variables?
In any programming language that existed before this question was asked, write a program (not a function) that outputs the characters Hello world! followed by a newline. Your program:
should not use any character more than once (including whitespace)
should only use ASCII characters
should not ...
In a certain chatroom, we like making acronym jokes about the build tool we use called sbt. While it usually stands for "Scala Build Tool", we aim to come up with all sorts of meanings, such as:
Stupid Brick Teeth
Sussy Baka Training
Shady Blue Tourists
Seriously Big Toes
Silly Bear Topics
Salac...
it has been ages since i've looked at the codebase i was trying to do circular module dependencies in so there might also just be something fundamentally wrong with how i was trying to organize things :P
This esolang I've been working on is...well I can't say but I am sooo excited to release it
For reasons I can't disclose it's going to require a somewhat complex UI for the interpreter tho, so it'll be a bit of a grind to get it to the point where I can release it
The encoding is incredibly complex and has required me to learn about data compression, probability, and number theory
Sum of consecutive squares
code-golf decision-problem math number
Your task
Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers.
Test cases
Truthy:
Input Explanation
5 1 + 4
13 4 + 9
14 1 + 4...
I’ve run into a language design issue. type* identifier is ambiguous to expression * expression, but I wish to avoid a dedicated variable declaration keyword.
Additionally, x = int y although is non-ideal, is allowed.