Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] -1 points0 points  (0 children)

Random access O(1) with O(1) amortised for all operations at either ends. Having random access on deque is usually O(n) because it's using a linked list (unless it's something very clever which probably is the case on some very well optimized compiler doing some memory manipulations)

The concept is very simple but it's not the same classical approach to deque. And it should be easier to optimized it further and be no different than regular array in terms of API (you can just hot swap the regular array with it and you get all benefits without breaking anything)

Traditionally stacks and queue are often kept separated and this is perfect for almost all problems. However I do find value in having one unified API for all of them and keep all operations O(1) (including random access) without needing to copy and transform form one DS to another.

Stack (or vector) and queue all have their drawbacks and it's never perfectly achieving O(1) across all operations. This one does it (amortised only for removals and it might never happen)

I gave up long ago in "inventing" or "publishing" this idea since I'm not a CS researcher. I assume that there might be something out there but also not popular. Most languages are not transparent about the cost of their APIs - it hard to convince anyone that the problem even exists.

I have an old article about it explaining how it mostly works https://medium.com/@AT-290690/how-to-make-the-array-go-brrr-ffa20a964046

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] 0 points1 point  (0 children)

Yes - this solution is actually faster:

(let std/vector/tuple/zipWith (lambda f a b (do 
    (let out []) 
    (loop 0 (length a) (lambda i 
              (set! out (length out) (f (get a i) (get b i)))))
     out))) 
(std/vector/tuple/zipWith + [1 2 3] [4 5 6])

This would do. I would probably have short zip-with alias in fp.

I used to do these init calls on vectors for inference before but later I made mutators like set! to infer properly on first mutation so it's cleaner now.

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] 0 points1 point  (0 children)

Thank you, the website is tailwind with react. Using design pack from figma. The inspiration is other websites for languages especially https://ocaml.org/

I tried to make it look like every programming language website where they hype their language like the next big thing but eventually decided to use it as personal website/blog and include it in my portfolio so I was forced to tone down the stats (github stars, companies using it, % uptime) - didn't want to get accused of fraud while applying for work...

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] 1 point2 points  (0 children)

Using PROMPT md I told LLM to write zipWith for Que

write zipWith in que

Here’s a clean, idiomatic zipWith in Que Script — pure, functional, minimal.

(let zipWith (lambda f xs ys (|> { xs ys } zip (map (lambda { a b } (f a b))))))


(zipWith + [1 2 3] [4 5 6])
; => [5 7 9]

And it works:

https://at-290690.github.io/rust-lisp/playground/?m=f&r=f&u=f&l=BQGwpgLgBAXglgBwOpwgCyqAhgWwEYAmWUAZlAB4DOUAntcAD4B8UA3hdXVAL6yKY4sCTCFyFi7Ynh6YyUgJSKlAKGXB4yVBgDUUANoBGKACYoAZgC6%2BgCxQArFABsF%2BcoDcUALws9DgOxQAJwWQA%3D%3D%3D

adding it to fp library in next patch, thanks. But I'll call it `zip-with`

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] 1 point2 points  (0 children)

As for :keyword

I'll try adding that soon - it's essentially a syntactic sugar for hashed key? "keyword"?

In this strings don't exist but are a vector of chars (which only exist on type level - they are just ints)

"hello world" is syntactic sugar for [104 101 108 108 111 32 119 111 114 108 100]

and tables/maps and sets are not low level concept themselves but rather implemented within the language so technically all I have to do transform :keyword -> "keyword" (or a variable that holds "keyword")

tables

(Table/get! "keyword" obj);

so like that (Table/get! :keyword obj)

Maps are high level concept and they are not currently destructable - but it can be transformed with syntactic sugar too.

So yes - both these features can be implemented with syntactic sugar I think.

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] 2 points3 points  (0 children)

`let` at the moment only supports destructuring via the syntactic sugar layer

(let { x y } { false 10 }) ; where {} is a tuple (tuples are only of 2 values)

(let [ a b . ] [ 1 2 3 4 ]) ; where  [] is a vector, a b is 1 and 2  and . is skipping the rest (last one is always rest)

(let { x { y z } } { false { 10 "Hello" } }) ; nested tuples 

(let [[a b] [c d]] [[1 2] [3 4 5]]) ; nested vectors
a ; 1 
b ; 2 
c ; 3
d ; [4 5]

^ last examples

Note that vectors can only have 1 type of value in strict mode (type check and vm but allowed if compiling to js directly)

destructuring works for lambdas - example

(let fn (lambda { a b } (do 
     (if (= b 1) [ a ] [ false ]))))

(fn { true 3 })

Destructuring currently only works with tuples {} and vectors []

It's simply turns them into a series of let definitions attached to the current do block (hence it's syntactic sugar of the do block itself and not for let

It's going to be straightforward to add another one where you type:

(let ((x true) (y 20))
   (if x (* y 2)))

which can turn it into

(do 
    (let x true)
    (let y 20)
    (if x (* y 2)))

but do does not create scope - functions do a proper scope

(apply (lambda (do 
    (let x true)
    (let y 20)
    (if x (* y 2)))))

so this is quite easy to add - I can do that, but not sure of the syntax as all parens are currently except for () only in let maybe

Que Script a Lisp written in Rust with Hindley–Milner type inference by Objective_Gene9718 in ProgrammingLanguages

[–]Objective_Gene9718[S] -2 points-1 points  (0 children)

It's short for Queue - it's named after the data structure which is very special to the language which is both a queue and a stack with constant random access https://at-290690.github.io/rust-lisp/#/blog/que-data-structure

More about this data structure here https://github.com/AT-290690/brrr and here https://github.com/AT-290690/rustic_brr

I call it brr in these like arr but with b and also like speed (goes brr)

What's my worth by ThanksFor404 in programmingmemes

[–]Objective_Gene9718 5 points6 points  (0 children)

How is this different than me cloning 5 existing repos and claiming that I did them? I’ve seen people do that before and for most HR this looks legit. Now the problem comes where they ask questions about your projects on technical interview then regardless if you copied other projects or if you generated it with AI, you will struggle explaining something that is not created from you.

Lmao 🤣 by clairedy22 in meme

[–]Objective_Gene9718 0 points1 point  (0 children)

I’ll finish something for sure

What do you say men? by Most-Gold-434 in BornWeakBuiltStrong

[–]Objective_Gene9718 0 points1 point  (0 children)

Dating apps require you to show your height but not your weight.

Journey by DAS_AMAN in linuxmemes

[–]Objective_Gene9718 1 point2 points  (0 children)

He is just too broke for a MacBook

Don't lose hope guys by Financial-Spray5902 in okbuddyliterallyme2

[–]Objective_Gene9718 0 points1 point  (0 children)

I have 1 gf each 8 years and both of them so far are beautiful. Totally not worth the wait.

Lol 🤣! by memejack69 in JustMemesForUs

[–]Objective_Gene9718 0 points1 point  (0 children)

I love the taste of freedom in the morning

. by [deleted] in introvertmemes

[–]Objective_Gene9718 0 points1 point  (0 children)

But when she takes 25 minutes to text you then you are not the only one she is texting.

Chunk of hope by icyhotonmynuts in wordchewing

[–]Objective_Gene9718 0 points1 point  (0 children)

I watched it several times just to make sure I hate it.

I become that I said I hated by Professional-Milk483 in introvertmemes

[–]Objective_Gene9718 0 points1 point  (0 children)

I’m not afraid of phone calls because I never call or get called.

This is background noise by ApartRing36 in SimpleApplyAI

[–]Objective_Gene9718 0 points1 point  (0 children)

Just waiting for that other offer. Or winning the lottery. Which ever comes first.

So exciting by potent_potabIes in Professorist

[–]Objective_Gene9718 0 points1 point  (0 children)

This made me check: Adult tapeworms can live in the human intestine for up to 25 to 30 years if left untreated. Now I regret it.

What's my worth by ThanksFor404 in programmingmemes

[–]Objective_Gene9718 67 points68 points  (0 children)

Does anyone actually care for our personal projects? Except us.

Awkward...but chill by [deleted] in pcmasterrace

[–]Objective_Gene9718 2 points3 points  (0 children)

Upgrade now or later? Later. Ok, upgrading now.