langjam/jam0001

Team: elucent

Opened this issue · 3 comments

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

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

vic commented

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

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.