Coder Social home page Coder Social logo

Building a training set of tags for 8th about 8th HOT 25 OPEN

iHiD avatar iHiD commented on June 26, 2024
Building a training set of tags for 8th

from 8th.

Comments (25)

iHiD avatar iHiD commented on June 26, 2024

Exercise: hello-world

Code

: hello-world \ -- s
"Hello, World!"

Tags:

paradigm:imperative
paradigm:procedural
paradigm:concatenative
construct:colon-definition
construct:string
uses:informal-sed

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: armstrong-numbers

Code

: armstrong? \ n -- 

Tags:

No tags generated

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: isogram

Code

: isogram? \ s -- T

Tags:

construct:backslash
construct:colon
construct:word
construct:parameter
construct:tagged-template-string
construct:visibility-modifiers
paradigm:declarative
paradigm:functional
technique:higher-order-functions
uses:BackslashInString

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: acronym

Code

: acronym \ s -- s
  /[^a-zA-Z']/ s:/ ( 0 1 s:slice s:uc ) a:map "" a:join
;

Tags:

No tags generated

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: gigasecond

Code

: +gigasecond \ s  s

Tags:

construct:add
construct:gigasecond
construct:keyword
construct:parameter
construct:space
construct:variable
paradigm:imperative
paradigm:functional

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: trinary

Code

: num> \ c -- n
    dup 48 = if drop 0 ;then
    dup 49 = if drop 1 ;then
    dup 50 = if drop 2 ;then
    null 
;

: do_trinary> \ s -- n
    dup "" = if 0 ;then
    0 s:@ num>
    swap s:len 1 - 3 swap n:^ rot n:*
    swap 1 -1 s:slice null? if drop ;then
    recurse n:+ 
;

:  trinary> \ s -- n
     dup ( swap null? if 2drop null else drop num> then ) 0 s:reduce
     null? if 3drop 0 ;then
     drop do_trinary>
;

Tags:

construct:assignment
construct:boolean
construct:char
construct:comment
construct:define
construct:drop
construct:if-else
construct:if-elseif
construct:invocation
construct:lambda
construct:local
construct:method
construct:multiply
construct:null
construct:nullability
construct:number
construct:parameter
construct:recursive-call
construct:subtract
construct:swap
construct:then
construct:variable
paradigm:functional
paradigm:imperative
paradigm:object-oriented
technique:higher-order-functions
technique:recursion

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: darts

Code

: hypot \ x y -- sqrt(x^2 + y^2)
  n:sqr swap n:sqr n:+ n:sqrt ;
: n:<= \ x y -- T
  2dup n:= -rot n:< or ;
: darts-score \ n n -- n
  hypot
  dup  1 n:<= if drop 10 ;then
  dup  5 n:<= if drop  5 ;then
  dup 10 n:<= if drop  1 ;then
  drop 0
;

Tags:

construct:add
construct:boolean
construct:drop
construct:floating-point-number
construct:if-then-else
construct:invocation
construct:lambda
construct:number
construct:or
construct:parameter
construct:stack
construct:swap
construct:word
paradigm:functional
paradigm:stack-oriented
technique:boolean-logic
uses:add

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: darts

Code

with: n
: darts-score \ n n -- n
   sqr swap sqr + \ Sum of x² + y²
   [10, 5, 1, 0] \ scores for inner, middle, outer, and beyond rings
   [1, 5, 10] ' sqr a:map \ radius² of inner, middle, outer rings
   rot
   ( > if 1 else -1 then ) \ less-than-or-equal
   a:pigeon \ Score of ring where x² + y² <= radius²
;
;with

Tags:

construct:add
construct:annotation
construct:backslash
construct:char
construct:comment
construct:define
construct:if-else
construct:invocation
construct:lambda
construct:list
construct:map
construct:number
construct:parameter
construct:tuple
construct:variable
construct:visibility-modifiers
paradigm:functional
paradigm:object-oriented
technique:higher-order-functions

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: atbash-cipher

Code

: encode-char \ c -- c
  dup 'a 'z n:between if
    'z swap n:- 'a n:+ 
  then
  ;

\ decode FROM a cipher
: atbash> \ s -- s
  /[^[:alnum:]]/ "" s:replace! s:lc
  ' encode-char s:map
  ;

\ encode TO a cipher
: >atbash \ s -- s
  atbash>
  [5] s:/ " " a:join
  ;

Tags:

construct:char
construct:comment
construct:define
construct:invocation
construct:lambda
construct:method
construct:parameter
construct:pattern
construct:quotations
construct:stack
construct:word
paradigm:functional
paradigm:reflective
technique:higher-order-functions

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: resistor-color

Code

: colors \ -- a
  ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"] ;
: color-code \ s -- n
  colors swap ' s:= a:indexof nip ;

Tags:

construct:assignment
construct:char
construct:comment
construct:invocation
construct:lambda
construct:list
construct:parameter
construct:quotations
construct:stack
construct:swap
construct:word
paradigm:functional
paradigm:imperative
paradigm:reflective
technique:higher-order-functions

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: etl

Code

: keys-to-values \ m key value -- m
    swap >n >r
    ( s:lc r@ m:! ) a:each!
    drop rdrop
;

: transform \ m -- m
    m:new swap
    ' keys-to-values m:each
    drop
;

Tags:

construct:comment
construct:definition
construct:drop
construct:invocation
construct:keyword
construct:parameter
construct:quotations
construct:stack
construct:swap
construct:word
paradigm:functional
paradigm:reflective
technique:higher-order-functions

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Exercise: pop-count

Code

: eggCount  \ n -- n
  0 >r             \ keep the count on the r-stack
  repeat
    dup 0 n:= if   \ stop when n = 0
      break
    else
      dup 1 band   \ isolate zeroth bit 
      r> n:+ >r    \ add to count
      1 shr        \ and shift the input number
    then
  again
  drop r>          \ drop the number and pull the count from r-stack
;

Tags:

construct:assignment
construct:band
construct:break
construct:comment
construct:drop
construct:if
construct:invocation
construct:method
construct:number
construct:parameter
construct:repeat
construct:stack
construct:then
construct:word
paradigm:stack-based

from 8th.

axtens avatar axtens commented on June 26, 2024

Everything after "\ " is a comment. So the guesses are a bit wide of the mark sometimes

from 8th.

iHiD avatar iHiD commented on June 26, 2024

Everything after "\ " is a comment. So the guesses are a bit wide of the mark sometimes

Yes, I'd expect lower-frequency languages like 8th to be less accurate, but once the tags are updated and we retrain it, it should learn :)

from 8th.

ErikSchierboom avatar ErikSchierboom commented on June 26, 2024

This is an automated comment

Hello 👋 Next week we're going to start using the tagging work people are doing on these. If you've already completed the work, thank you! If you've not, but intend to this week, that's great! If you're not going to get round to doing it, and you've not yet posted a comment letting us know, could you please do so, so that we can find other people to do it. Thanks!

from 8th.

glennj avatar glennj commented on June 26, 2024

@axtens I will not be able to help out with this.

from 8th.

axtens avatar axtens commented on June 26, 2024

from 8th.

axtens avatar axtens commented on June 26, 2024

from 8th.

ErikSchierboom avatar ErikSchierboom commented on June 26, 2024

@axtens Do you know when you'll have time?

from 8th.

axtens avatar axtens commented on June 26, 2024

from 8th.

axtens avatar axtens commented on June 26, 2024

@iHiD @ErikSchierboom you seem to have mis-scanned some. There is a full-blown version in the .meta folder but you seem to have taken some of the examples from the root of the task rather than its .meta. +gigasecond for example.

from 8th.

ErikSchierboom avatar ErikSchierboom commented on June 26, 2024

you seem to have mis-scanned some.

Yes, sorry about that!

from 8th.

ErikSchierboom avatar ErikSchierboom commented on June 26, 2024

@axtens Did you get a chance to work on this? If not, that's fine too, and we can do it later.

from 8th.

axtens avatar axtens commented on June 26, 2024

from 8th.

axtens avatar axtens commented on June 26, 2024
--hello-world
paradigm:imperative
paradigm:procedural
paradigm:concatenative
construct:colon-definition
construct:string
uses:informal SED
--two-fer
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
construct:colon-definition
construct:if
construct:boolean
construct:null
construct:string
uses:informal SED
uses:string-format
--bob
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
technique:regular-expression
construct:logical-and
construct:logical-not
construct:colon-definition
construct:if
construct:boolean
construct:number
construct:string
construct:int
construct:array
uses:informal SED
--leap
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
construct:colon-definition
construct:if
construct:divide
construct:boolean
construct:number
construct:int
uses:informal SED
--triangle
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
construct:colon-definition
construct:if
construct:add
construct:subtract
construct:boolean
construct:number
construct:int
uses:informal SED
uses:r-stack
--collatz-conjecture
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:bit-manipulation
technique:recursion
construct:colon-definition
construct:if
construct:add
construct:bitwise-and
construct:multiply
construct:subtract
construct:boolean
construct:null
construct:number
construct:int
uses:informal SED
--armstrong-numbers
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
technique:higher-order-functions
technique:type-conversion
construct:explicit-conversion
construct:lambda
construct:variable
construct:colon-definition
construct:add
construct:exponentiation
construct:boolean
construct:null
construct:number
construct:string
construct:int
construct:array
uses:informal SED
--isogram
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
technique:higher-order-functions
technique:regular-expression
technique:sorting
construct:explicit-conversion
construct:lambda
construct:colon-definition
construct:boolean
construct:string
construct:array
uses:informal SED
--acronym
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:higher-order-functions
technique:regular-expression
construct:explicit-conversion
construct:lambda
construct:colon-definition
construct:string
construct:array
uses:informal SED
--gigasecond
paradigm:imperative
paradigm:procedural
paradigm:concatenative
construct:explicit-conversion
construct:colon-definition
construct:add
construct:date-time
uses:informal SED
--trinary
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:higher-order-functions
construct:colon-definition
construct:break
construct:if
construct:add
construct:multiply
construct:subtract
construct:exponentiation
construct:boolean
construct:number
construct:string
construct:int
uses:informal SED
uses:r-stack
--darts
paradigm:imperative
paradigm:procedural
paradigm:concatenative
construct:colon-definition
construct:if
construct:add
construct:exponentiation
construct:boolean
construct:number
construct:int
construct:float
uses:informal SED
--series
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
technique:higher-order-functions
construct:colon-definition
construct:if
construct:number
construct:string
construct:int
construct:array
uses:r-stack
--atbash-cipher
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
technique:higher-order-functions
technique:regular-expression
construct:explicit-conversion
construct:colon-definition
construct:if
construct:subtract
construct:boolean
construct:number
construct:string
construct:int
uses:informal SED
--resistor-color
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:boolean-logic
construct:indexer
construct:colon-definition
construct:number
construct:string
construct:int
construct:array
uses:informal SED
--etl
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:higher-order-functions
construct:explicit-conversion
construct:lambda
construct:colon-definition
construct:string
construct:array
construct:dictionary
uses:informal SED
--pop-count
paradigm:imperative
paradigm:procedural
paradigm:concatenative
technique:bit-manipulation
technique:bit-shifting
technique:boolean-logic
construct:colon-definition
construct:repeat-until-loop
construct:add
construct:bitwise-right-shift
construct:number
construct:int
uses:informal SED

from 8th.

Related Issues (14)

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.