langjam / jam0001

269 stars 141 forks source link

Team: elucent #330

Open sophiajt opened 3 years ago

sophiajt commented 3 years ago

Add your votes to this issue by using emoji reactions

You can find this team's project at: https://github.com/langjam/jam0001/tree/main/elucent

vic commented 3 years ago

@classerase, remember that only 👍 emojis are valid for voting :) so perhaps you'd like to vote again.

vic commented 3 years ago

Hey @elucent, thanks for making smal, love to see more people doing stack/concatenative languages. I'd have loved to write a nice documentation as yours ^^.

asrp commented 3 years ago

Very nice design. I don't quite get how in and defining binary function works.

fn mod15 [
  in [a]
  [b] = 15
  putv([mod15 a =]) putv(a)
  putv([mod15 b =]) putv(b)
  if (a < b) [a] [mod15(a - b)]
]
fn mod [
  in [a]
  in [b]
  putv([mod a =]) putv(a)
  putv([mod b =]) putv(b)
  if (a < b) [a] [
    [c] = a - b
    (mod c b)]
]
putv(mod15 100)
putv(mod 100 15)

shows

mod15 a =
100
mod15 b =
15
mod15 a =
85
mod15 b =
15
mod15 a =
70
mod15 b =
15
mod15 a =
55
mod15 b =
15
mod15 a =
40
mod15 b =
15
mod15 a =
25
mod15 b =
15
mod15 a =
10
mod15 b =
15
10
mod a =
100
mod b =
15

instead of the same result for both calls.