Coder Social home page Coder Social logo

seriously's Introduction

Actually Build Status Build status PyPI license codecov CII Best Practices

A golfing language that is probably terrible. It is currently being developed. Actually is the spiritual successor to Seriously. Actually is stack-based, and is unique in its amount of single-character commands. Every character whose ordinal is in [0,255] does something (or will, once I finish development).

All strings are valid programs. There is no such thing as a syntax error, and anything that appears to be a runtime error is actually a no-op (NOP). If you call a command that expects a string on top of the stack, but the top value is an integer, instead of throwing an error, it silently performs a NOP. Eventually, this will not be seen, as the goal for Seriously is for every character and stack state to map to a command.

Seriously's name was inspired by this challenge. Actually followed because it is also an adverb, and it also looks funny in answer headers.

Try the online interpreter. This is part of Try it online! by @DennisMitchell.

Commands

See commands.txt

Examples

Hello, World!

H

If you prefer a more interesting version:

"Hello, World!"

Primality Test

p

99 Bottles of Beer

N

Coprimality Test

g1=

Counting the divisors of a number

w⌠iXu⌡Mπ

or

÷l

seriously's People

Contributors

evlrobinson avatar kckennylau avatar maltysen avatar mego avatar misingnoglic avatar phase avatar quintopia avatar schas002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seriously's Issues

Vectorize functions

When a function whose first operand is not a list receives a list as its first operand, map the function over the entire list

cmp function

The cmp function is a Python 2 function, it allows easier comparison between numbers.

pop a,b: if a>b push 1; if a == b push 0; if a < b push -1.

Round by digits

Proposed:
pop a,b: push a rounded to b digits after decimal

Also consider:
pop a,b: push a rounded to b significant figures
pop a: push a in scientific notation (ex: 9000 => 9e3)
pop a,b: push a in scientific notation rounded to b significant figures

Also, I am currently experiencing roundoff errors.

Implicit input by default

Default behavior: read all bytes from STDIN, split on newlines, eval, and push to stack at start of program

With flag: operates as it does now (needing , to read from STDIN)

Excess input fails.

I dunno why, but, whenever I have something in STDIN that I don't use, the program errors out.

Try this one, for example, to get what I'm saying.

↑↓ - sort entire stack

  • (18) sorts entire stack ascending, like APL
  • (19) sorts entire stack descending, like APL

and might do something like "pop a; pob b; sort stack in range [a,b] ascending/descing."

If this is the wrong place to suggest these things... um, sorry.
[enhancement]

Actually eval

Actually seriously doesn't have an Actually eval? eval is also a very useful function.

Interacting with the system

Proposed:
pop "a","b": push "a" and write "b" to a file named "a"
pop "a" or [a]: push subprocess.call(a)

These would allow the original challenge to be done in Actually.

Also consider:
pop "a" or [a]: push subprocess.check_output(a)
41 (A): if stack is empty, push "Actually"
53 (S): if stack is empty, push "Seriously"

⌐ and ¬ don't work on lists

Need to make a universal plus function with all of the overloading logic that other functions can use instead of +/__add__ - same with other operators

Maybe subclasses of built-in types?

Comments?

Please? That would be great. Thanks!

References to O persist

Some files (probably just those based on files from the O programming language) still make references to O. For example, from ide.py:

if __name__ == '__main__':
    print('Compiling O...')
    check_call(['gcc', 'o.c', '-DIDE', '-o', 'o-ide', '-lm'])
    print('Starting server...')
    app.run(host='0.0.0.0',port=80)

↨ - set SORTFLAG; ▬ - get SORTFLAG

(17)

  • pop a
  • Set a variable I'll call SORTFLAG = a

SORTFLAG is used with [↑↓→←] to determine how sorting is done.
For example:

  1. sort strictly by value. (default)
  2. sort by value, strings first
  3. sort by value, strings last
    etc...

-f --sortflag: set starting SORTFLAG.

(16)

  • push SORTFLAG

Powerset

Powerset is a relatively useful built-in, e.g. for finding all pairs from a list.

Comparing the results of O and r

= doesn't play well with O's map objects and x's range objects. One needs to # everything to get comparisons to work.

Edit:
What doesn't work with O:
= and x (range)
Σ (sum)
σ (cumulative sum)
▼ ([x//gcd([a]) for x in a]; only returns one value)
H (head)
t (tail)

What does work:
π (product)
∩ (intersection
∙ (Cartesian product)

Duplicate doesn't work on a zip

After zipping two lists with Z, ; doesn't work. I need to use Z♂#; because just Z#; doesn't convert the inside lists to lists.

Lucas numbers

I guess this is more of a reminder than an actual issue, but please implement Lucas numbers in Seriously just as you promised to do.

index function is not working

Based in the commands.txt, ¡ is supposed to be the character to do the index function (like b.index(a)) but when I tried it, it didn't work. For this code:

[1,2,3]2¡
I got an output of:
2 [1,2,3]

Clearly, this is not expected. In the description, the ¡ character is said to "pop a,b: push a string representing a in base b" So even the description is messed up. Clearly this is a bug.

Printing without trailing newline?

I want a feature so that I can print without a trailing newline, like sys.stdout.write. Right now, using . doesn't suffice. Is there any such function alerady?

Implement Miller-Rabin primality testing for prime-related functions

Ideally, this will be a standalone implementation - no reliance on numpy or sympy. I'd like to avoid adding those as requirements, as they're quite large libraries.

The implementation must be deterministic.

Bonus points for using the current-best set of witnesses to ensure accuracy for very large numbers.

Use generators more

Really, there's no real reason to explicitly cast to list every time an iterable is pushed on the stack. Keeping iterables in generator form on the stack will reduce memory usage and increase performance. Lists should only be used when needed (like when printing).

split for lists not supported

Can you possibly add a split() function to Seriously? it would help with various different challenges on code golf.

Bug with ╡

╡ command (sublist; chunk by number) doesn't appear to work on TIO.

Factoring fails for large inputs

Code: :1965593254291461501637330902918203684832716283082y (w produces similar results)

Error:

Traceback (most recent call last):
  File "/opt/actually/seriously/seriously.py", line 231, in eval
    self.fn_table.get(ord_cp437(c), lambda x: x)(self)
  File "/opt/actually/seriously/SeriouslyCommands.py", line 1349, in <lambda>
    0x79:lambda x:x.push(factor(x.pop())),
  File "/opt/actually/seriously/SeriouslyCommands.py", line 579, in factor
    return [a for a,b in full_factor(n)]
  File "/opt/actually/seriously/SeriouslyCommands.py", line 560, in full_factor
    init_primes_up_to(int(rmath.sqrt(n))+1)
  File "/opt/actually/seriously/SeriouslyCommands.py", line 259, in init_primes_up_to
    temp=[1]*(n-max_tested)
OverflowError: cannot fit 'int' into an index-sized integer

The factoring algorithm needs to be more memory-efficient. Perhaps there should be a threshold value set for switching over to a slower-but-memory-efficient algorithm instead of the current somewhat-fast-but-memory-intensive approach.

@kckennylau Any thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.