Skip to content

Instantly share code, notes, and snippets.

@comboy
Last active August 29, 2015 14:11
Show Gist options
  • Save comboy/74d6d87fc76a30fc8455 to your computer and use it in GitHub Desktop.
Save comboy/74d6d87fc76a30fc8455 to your computer and use it in GitHub Desktop.
baby steps
!:
|_ [hid=hide ~]
++ poke-mars-args
|= [ost=bone you=ship *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:- [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
~[leaf/"hello mars!"]
++ peer
|=(* `+>)
--
:: display "hello $ARG!"
:: :planet "foo"
!:
|_ [hid=hide ~]
++ poke-planet-args
|= [ost=bone you=ship planet=tape *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:- [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
~[leaf/"hello {planet}!"]
++ peer
|=(* `+>)
--
~
:: counts douwn and boom!
!:
|_ [hid=hide ~]
++ poke-boom-args
|= [ost=bone you=ship *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:* [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
%- flop ^- (list tank) %- limo
=+ a=10
|-
?: =(a 0)
~[leaf/"BOOM!!!"]
:_ $(a (dec a))
leaf/"{(trip ?:(=((mod a 2) 0) 'tick' 'tock'))} - {(scow %ud a)}"
==
++ peer
|=(* `+>)
--
:: display fib sequence up to arg with steps
:: painfully suboptimal but that's irrelevant
:: :fib 10
!:
|_ [hid=hide ~]
++ poke-fib-args
|= [ost=bone you=ship upto=@ud *]
:_ +>.$
:- [ost %pass ~ %g %cide ~]
:* [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
%- flop ^- (list tank) %- limo
=+ a=1
|-
?: (gth a upto) ~
:_ $(a +(a))
leaf/(scow %ud (fib a))
==
++ fib
|= a=@ud
|-
?: (lte a 2) 1
(add $(a (sub a 1)) $(a (sub a 2)))
++ peer
|=(* `+>)
--
:: lazy hello mars, is it bad? if so then why?
|_ [hid=hide ~]
++ poke-hell-args
|= [ost=bone *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:- [ost %pass / %d %flog %text "mars is weird sometimes"]
~
--
:: failed attempt at fib sequence where new numbers would be displayed as soon
:: as they are computed :-(
|%
++ sign
$% $: %g
$% [%nice ~]
[%mean p=ares]
[%mean p=@ud]
== == ==
--
::
!:
|_ [hid=hide ~]
++ poke-fibo-args
|= [ost=bone sip=ship upto=@ud *]
:_ +>.$
:- [ost %give %nice ~]
:: XX couldnt flop it, probably type issue, tried (list move) but without luck
=+ a=upto
|-
?: (lte a 0) ~
:_ $(a (dec a))
[ost %pass / %g %mess [sip /fibo] sip %foo !>(a)]
::
++ poke-foo
|= [ost=bone sip=ship a=@ud]
:_ +>.$
:- [ost %pass / %d %flog %text (scow %ud (fib a))]
:- [ost %give %nice ~]
~
::
++ fib
|= a=@ud
|-
?: (lte a 2) 1
(add $(a (sub a 1)) $(a (sub a 2)))
::
++ pour
|= * `+>
::
++ peer
|= * `+>
--
@fsteinel
Copy link

1.mars with 2+2

!:
|_ [hid=hide ~]
++ poke-four-args
|= [ost=bone you=ship *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:- [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
~[leaf/"hello mars! {<(add 2 2)>}"]
++ peer
|=(* `+>)
-- 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment